You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(cuda.core): query green stream contexts with v2 - #3448
This is to fix internal bug 7080277 which is a test helper issue.
On CUDA 12.9, test_device_receiver_targets_stored_green_context fails because the shared helper calls cuStreamGetCtx on a stream created by cuGreenCtxStreamCreate.
The CUDA 12.9 documentation states that this query returns CUDA_ERROR_NOT_SUPPORTED and recommends cuStreamGetCtx_v2. CUDA 13.0 supports these streams with the legacy query, but the helper should also work on CUDA 12.9.
Use cuStreamGetCtx_v2 for green contexts, require a non-null pGreenCtx, and convert it with cuCtxFromGreenCtx before comparing it with the bound context handle. The returned pCtx is the device primary context. Keep the legacy query for regular contexts to preserve compatibility with older drivers.
Validation
Reran all three tests using this helper:
Windows, Tesla T4, CUDA 12.9, cuda-core 1.3.0, cuda-bindings 12.9.8: 3 passed on each of Python 3.11, 3.12, 3.13, 3.14, and free-threaded 3.14.
Windows, CUDA 13.4 driver and development wheels, Python 3.14: 2 passed, 1 skipped (requires two GPUs).
Reviewing files that changed from the base of the PR and between 8c8facf and 40288d5.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Tests
Improved validation that streams created with green contexts belong to the device’s bound context.
The test helper now uses cuStreamGetCtx_v2 and cuCtxFromGreenCtx to check green-context streams against the device’s bound context. Regular-context streams continue to use cuStreamGetCtx.
For green-context streams, the helper checks the returned handle and converts it to a CUDA context before comparison. Regular-context streams continue to use cuStreamGetCtx. The mismatch assertion no longer names a specific API.
Possibly related issues
NVIDIA/cuda-python#2366 — This change covers the issue’s context-query audit for green-context streams by using cuStreamGetCtx_v2.
Suggested labels:test, cuda.core
Suggested reviewers:andy-jost
Change: Other
Merge Risk: Minimal · previous review 94452
This updates a test helper so the green-context test works on CUDA 12.9. It does not change product behavior. No concrete merge-blocking risk was found. The PR metadata check should be satisfied before merging.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 303fbda and 94452c7.
Files selected for processing: 1
cuda_core/tests/helpers/contexts.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Approving. The helper is right on both driver lines. cuStreamGetCtx_v2 returns the green context in pGreenCtx, and cuCtxFromGreenCtx is the same conversion cuda.core uses to build Context.handle, so the comparison is exact. Regular contexts keep the legacy query, so nothing changes for them. The check is also stronger than before, because it now requires a green context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cuda.coreEverything related to the cuda.core moduletestImprovements or additions to teststo-be-backportedTrigger the bot to raise a backport PR upon merge
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is to fix internal bug 7080277 which is a test helper issue.
On CUDA 12.9,
test_device_receiver_targets_stored_green_contextfails because the shared helper callscuStreamGetCtxon a stream created bycuGreenCtxStreamCreate.The CUDA 12.9 documentation states that this query returns
CUDA_ERROR_NOT_SUPPORTEDand recommendscuStreamGetCtx_v2. CUDA 13.0 supports these streams with the legacy query, but the helper should also work on CUDA 12.9.Use
cuStreamGetCtx_v2for green contexts, require a non-nullpGreenCtx, and convert it withcuCtxFromGreenCtxbefore comparing it with the bound context handle. The returnedpCtxis the device primary context. Keep the legacy query for regular contexts to preserve compatibility with older drivers.Validation
Reran all three tests using this helper: