-
Notifications
You must be signed in to change notification settings - Fork 228
Add missing driver & runtime bindings for functions new in CTK 13.1.0 #1337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
The generate_output function was reading .in files without specifying UTF-8 encoding, causing UnicodeDecodeError on Windows where Python defaults to cp1252 encoding. The generated .in files contain UTF-8 characters (smart quotes from CUDA documentation), which cannot be decoded with cp1252. This fix adds encoding='utf-8' to all file operations in generate_output to ensure proper handling of UTF-8 content on all platforms.
d80b774 to
a28aa9f
Compare
|
/ok to test |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This comment has been minimized.
This comment has been minimized.
|
The bindings are complete (see code-gen PR) and the existing tests pass. This PR could be merged as-is. I'm keeping it in draft mode because I'm hoping to find time to add test coverage for the new bindings. |
Add comprehensive tests for the new graph and node ID getter functions introduced in CUDA 13.1: Driver API tests (test_cuda.py): - test_cuGraphGetId: Tests graph ID retrieval - test_cuGraphExecGetId: Tests graph execution ID retrieval - test_cuGraphNodeGetLocalId: Tests node local ID retrieval - test_cuGraphNodeGetToolsId: Tests node tools ID retrieval - test_cuGraphNodeGetContainingGraph: Tests containing graph retrieval Runtime API tests (test_cudart.py): - test_cudaGraphGetId: Tests graph ID retrieval - test_cudaGraphExecGetId: Tests graph execution ID retrieval - test_cudaGraphNodeGetLocalId: Tests node local ID retrieval - test_cudaGraphNodeGetToolsId: Tests node tools ID retrieval - test_cudaGraphNodeGetContainingGraph: Tests containing graph retrieval All tests include: - Version checks (CUDA 13.1+) - API availability checks - Proper resource cleanup - Validation of return types and uniqueness - Edge case testing (child graphs) All 92 tests pass successfully.
|
/ok to test |
Add comprehensive tests for the new resource management functions introduced in CUDA 13.1: Driver API tests (test_cuda.py): - test_cuStreamGetDevResource: Tests getting device resource from stream Runtime API tests (test_cudart.py): - test_cudaStreamGetDevResource: Tests getting device resource from stream - test_cudaDeviceGetDevResource: Tests getting device resource from device - test_cudaExecutionCtxGetDevResource: Tests getting device resource from execution context - test_cudaExecutionCtxGetDevice: Tests getting device handle from execution context - test_cudaExecutionCtxGetId: Tests getting unique ID from execution context All tests include: - Version checks (CUDA 13.1+) - API availability checks - Proper resource cleanup - Validation of return types and values - Execution context handling using cudaDeviceGetExecutionCtx All 98 tests pass successfully (10 Phase 1 + 6 Phase 2 + 82 existing).
Add comprehensive tests for the complex resource management and context functions introduced in CUDA 13.1: Driver API tests (test_cuda.py): - test_cuDevSmResourceSplit: Tests splitting SM resource into structured groups Runtime API tests (test_cudart.py): - test_cudaDevSmResourceSplit: Tests splitting SM resource into structured groups - test_cudaDevSmResourceSplitByCount: Tests splitting SM resource by count - test_cudaDevResourceGenerateDesc: Tests generating resource descriptor - test_cudaGreenCtxCreate: Tests creating green context with resources - test_cudaExecutionCtxStreamCreate: Tests creating stream for execution context - test_cudaGraphConditionalHandleCreate_v2: Tests creating conditional handle with execution context All tests include: - Version checks (CUDA 13.1+) - API availability checks - Proper resource cleanup - Validation of return types and values - Resource splitting and descriptor generation workflows - Green context creation and stream management All 105 tests pass successfully (10 Phase 1 + 6 Phase 2 + 7 Phase 3 + 82 existing).
|
/ok to test |
|
Super high-level vetting that all newly added bindings are covered by tests (@ commit 1520d38 in this PR): NOTE: The script and the inputs are attached below. |
…elpful after this PR is merged).
|
/ok to test |
|
Local testing with CUDA 13.1 drivers Full test logs: linux-64 qa_bindings_linux_2025-12-07+172935_tests_log.txt linux-aarch64 qa_bindings_linux_2025-12-07+173026_tests_log.txt win-64 qa_bindings_windows_2025-12-07+172434_tests_log.txt |
|
It would be nice if we didn't need to track the driver version for every new API introduced and instead caught the specific error code returned by the driver / runtime libraries that corresponds to not having a new enough driver and xfailed. Future enhancement 😄. |
|
That'll be closer to the user experience; I created issue #1346, for prioritization. I think it'll be pretty easy to do with the help of Cursor. |
Closes #1321
The added unit tests were generated by Cursor and focus purely on exercising proper functioning of the bindings code. It was verified (see comment below) that they cover all added functions, ensuring this goal is met. The tests received only superficial review beyond the high-level vetting, as deeper inspection would not add value for the present purposes, given the straightforward nature of the tests.
All new tests are currently SKIPPED in CI (38 out of 52 test configurations). This is expected and correct behavior. The 14 CI configurations that don't show the new tests at all are running CUDA 12.9.1, where the tests are skipped at collection time due to the version check.
The new CUDA 13.1+ functions require CUDA 13.1+ driver support at runtime, not just CTK 13.1.0 for building. The skip condition checks
driverVersionLessThan(13010), which callscuDriverGetVersion()to determine the runtime driver version:13000 < 13010tests correctly skippedThe bindings are built with CTK 13.1.0, but the runtime driver version determines API availability. This is confirmed by the warning in CI logs: "The CUDA driver version is older than the backend version."
Local testing with CUDA 13.1 drivers:
All new tests PASS when run with CUDA 13.1+ drivers (see comment below). Verified on:
To highlight this small general fix:
Fixes Windows build failure: added UTF-8 encoding to file operations in
setup.py'sgenerate_outputfunction. Required because generated.infiles contain UTF-8 characters (smart quotes from CUDA 13.1 header documentation), and Python on Windows defaults to cp1252 encoding which cannot decode them.