Keyword arguments are silently ignored when a decorated function is called without positional arguments
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 76/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- python
- Domínio
- performance
Direção de pesquisa
Comece em nsight/collection/core.py e acompanhe o tratamento da configuração no momento da chamada em torno de _sanitize_configs e da verificação if len(args) > 0. Leia test_config_at_call_time_with_kwargs e adicione cobertura para uma chamada somente com argumentos nomeados, como bench(n=4096). O trabalho estará concluído quando os argumentos nomeados forem usados como configuração ou gerarem consistentemente a ProfilerException documentada, sem recorrer silenciosamente ao valor padrão.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
Calling a function decorated with @nsight.analyze.kernel with only keyword arguments drops them. The call is profiled with the parameter default (or with the decorator-time configs), and the results report that configuration instead of the requested one. No error or warning is raised.
import nsight
import torch
@nsight.analyze.kernel
def bench(n: int = 64) -> None:
a = torch.randn(n, n, device="cuda")
b = torch.randn(n, n, device="cuda")
with nsight.annotate("add"):
_ = a + b
df = bench(n=4096).to_dataframe()
print(df[["Annotation", "n", "Metric"]]) # n is 64, not 4096
The same happens with @nsight.analyze.kernel(configs=[(64,)]) and bench(n=4096).
bench(42, y=23) already raises ProfilerException: Keyword arguments are not supported yet: ['y'] (_sanitize_configs in nsight/collection/core.py, tested by test_config_at_call_time_with_kwargs). That check sits inside if len(args) > 0:, so it is skipped when there are no positional arguments.
Expected
The same ProfilerException, or the keyword arguments being used as the configuration.
Environment
nsight-python main at c89d4b5, Python 3.12.3, Linux x86_64.
How this was checked: no GPU was available, so the profiling backend was replaced by a mock (NVTX ranges and NCUCollector.collect). Config handling, the run loop, extraction and aggregation were the real nsight code. An equivalent script with the kernel launch stubbed out shows n=64 in the results for both cases (requested n=4096, profiled n=64). It has not been run on a GPU with NCU or CUPTI.
A small fix is ready if you approve it: move the existing check out of the if len(args) > 0: block, so keyword arguments raise the same ProfilerException on every call, and add a test next to test_config_at_call_time_with_kwargs. That turns today's silent wrong result into an error for callers who use bench(n=...). Supporting keyword arguments instead would be your call.
This was found with an AI coding assistant (Claude Code, claude-fable-5-2), which also wrote and ran the mocked repro and drafted this report.
- Linguagem predominante
- Python
- Estrelas
- 301
- Forks
- 23
- Merge médio
- 2d 20h
- PRs com merge (30d)
- 12
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de NVIDIA/nsight-python
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 54/100
NVIDIA/nsight-python#89 ·
Mantenedores costumam responder em até 1 dia
-
Enable collecting metrics from a setTalvez livre de novo @Alok-Joshi assumiu há 57 dias e não há nenhum pull request aberto. Aberta
NVIDIA/nsight-python#7 · 3 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de NVIDIA/nsight-python
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
FAIRmat-NFDI/pynxtools#861 ·
-
Criteria can pass when the deliverable is missingTalvez já em andamento @clementtisseau assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
harveyai/harvey-labs#217 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
databrickslabs/ontos#1420 ·
Mantenedores costumam responder em até 3 dias
-
[Bug] method_logger uses fragile definition-time inspect stack frame instead of func.__qualname__Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia