Keyword arguments are silently ignored when a decorated function is called without positional arguments
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- performance
Hướng nghiên cứu
Bắt đầu trong nsight/collection/core.py và theo dõi cách xử lý cấu hình tại thời điểm gọi quanh _sanitize_configs và kiểm tra if len(args) > 0. Đọc test_config_at_call_time_with_kwargs và bổ sung kiểm thử cho lời gọi chỉ có đối số từ khóa, chẳng hạn bench(n=4096). Công việc được xem là hoàn tất khi các đối số từ khóa được dùng làm cấu hình hoặc luôn phát sinh ProfilerException đã được tài liệu hóa, không âm thầm quay về giá trị mặc định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 301
- Fork
- 23
- Merge trung bình
- 2 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA/nsight-python
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 54/100
NVIDIA/nsight-python#89 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Enable collecting metrics from a setCó thể làm lại được @Alok-Joshi đã nhận 57 ngày trước và không có pull request nào đang mở. Đang mở
NVIDIA/nsight-python#7 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của NVIDIA/nsight-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
FAIRmat-NFDI/pynxtools#861 ·
-
Criteria can pass when the deliverable is missingCó thể đã có người làm @clementtisseau đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
harveyai/harvey-labs#217 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
databrickslabs/ontos#1420 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Bug] method_logger uses fragile definition-time inspect stack frame instead of func.__qualname__Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày