Skip to content

#88 - Reject keyword arguments passed without positional arguments - #91

Open
0z5a wants to merge 1 commit into
NVIDIA:mainfrom
0z5a:fix/kwargs-only-call-ignored
Open

0z5a wants to merge 1 commit into
NVIDIA:mainfrom
0z5a:fix/kwargs-only-call-ignored

Conversation

@0z5a

@0z5a 0z5a commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #88

A function decorated with @nsight.analyze.kernel and called as bench(n=4096) dropped the keyword argument. The call was profiled with the default value of n, or with the decorator-time configs, and the results reported that configuration.

bench(42, y=23) already raised ProfilerException: Keyword arguments are not supported yet. The check was inside if len(args) > 0: in _sanitize_configs, so it did not run when there were no positional arguments.

Change

  • nsight/collection/core.py: run the keyword-argument check for every call, with the same exception and message as before. The _sanitize_configs docstring no longer says that args and kwargs are combined.
  • nsight/analyze.py: the kernel docstring now says that **kwargs are not supported and raise ProfilerException.
  • tests/test_profiler.py: test_config_at_call_time_with_only_kwargs, next to the existing test_config_at_call_time_with_kwargs.

Testing

Run on x86_64 Linux without a GPU (CUDA_VISIBLE_DEVICES empty), Python 3.12.3, on main at fcb47f2:

  • pytest tests/test_profiler.py -k config_at_call_time_with: main with only the new test added, 1 failed (the call is not rejected and reaches profiling), 1 passed; with this change, 2 passed. The new test raises before profiling starts, so it needs no GPU.
  • pytest tests/test_collection.py tests/test_transformation.py tests/test_info_collector.py: 54 passed, on main and with this change.
  • black --check ., isort --check ., mypy --strict --ignore-missing-imports . (lint environment with the project, black, isort and mypy): clean.

Not run: the GPU tests and the examples (NCU and CUPTI), and the docs build. The Nsight Compute on the machine used was older than the version the tests require.

No release-note entry is included; I can add one to this PR if you want it.

This change was drafted with Claude Code (claude-fable-5-2, rebase and PR text with claude-opus-5-5); the test results above are from the runs described.

Calling a function decorated with nsight.analyze.kernel as f(n=4096)
dropped the keyword argument. The call was profiled with the default
value of n, or with the decorator-time configs, and the results
reported that other configuration.

f(42, y=23) already raised "Keyword arguments are not supported yet".
Raise the same error whenever keyword arguments are passed, and say so
in the kernel docstring.

Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
@copy-pr-bot

copy-pr-bot Bot commented Nov 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nvssatoor
nvssatoor requested a review from Alok-Joshi November 16, 2026 06:20
@nvssatoor

Copy link
Copy Markdown
Collaborator

/ok to test 50fddbf

@copy-pr-bot

copy-pr-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

/ok to test 50fddbf

@nvssatoor, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@acollins3

Copy link
Copy Markdown
Collaborator

/ok to test 50fddbf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyword arguments are silently ignored when a decorated function is called without positional arguments

3 participants