Keyword arguments are silently ignored when a decorated function is called without positional arguments
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 76/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- performance
Rechercherichtung
Beginne in nsight/collection/core.py und verfolge die Verarbeitung der Konfiguration zum Aufrufzeitpunkt rund um _sanitize_configs und die Prüfung if len(args) > 0. Lies test_config_at_call_time_with_kwargs und ergänze Tests für einen Aufruf mit ausschließlich Schlüsselwortargumenten wie bench(n=4096). Die Aufgabe ist abgeschlossen, wenn Schlüsselwortargumente entweder als Konfiguration verwendet werden oder konsistent die dokumentierte ProfilerException auslösen, ohne stillschweigend auf den Standardwert zurückzufallen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 301
- Forks
- 23
- Ø Merge
- 2 T. 20 Std.
- Gemergte PRs (30 T.)
- 12
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus NVIDIA/nsight-python
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 54/100
NVIDIA/nsight-python#89 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Enable collecting metrics from a setEvtl. wieder frei @Alok-Joshi hat das vor 57 Tagen übernommen, und es ist kein Pull Request offen. Offen
NVIDIA/nsight-python#7 · 3 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in NVIDIA/nsight-python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
FAIRmat-NFDI/pynxtools#861 ·
-
Criteria can pass when the deliverable is missingEvtl. vergeben @clementtisseau hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
harveyai/harvey-labs#217 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
databrickslabs/ontos#1420 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
[Bug] method_logger uses fragile definition-time inspect stack frame instead of func.__qualname__Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag