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
cuda.core: expose driver-populated fields on WorkqueueResource (#2330)
* cuda.core: expose driver-populated fields on WorkqueueResource
Add read-only sharing_scope, concurrency_limit, and device properties
on WorkqueueResource so users can inspect the driver-populated config
without dropping to raw cydriver. Add WorkqueueSharingScopeType StrEnum
in cuda.core.typing to give the sharing scope a typed return; strings
matching the enum member values remain accepted for backward compat.
Follows section 5(d) "opaque but round-trippable" from the green ctx
design doc, which was written into SMResource but not applied to
WorkqueueResource.
* cuda.core: fill in PR number in release-notes entry
* cuda.core: drop TYPE_CHECKING Device import to satisfy cython-lint
The lazy import inside WorkqueueResource.device already imports Device
at call time; the top-level TYPE_CHECKING import was unused as far as
cython-lint could see and blocked pre-commit.
* cuda.core: fold #2329 + #2330 release notes; parametrize enum test; add 2-GPU device check
- Merge the two 1.1.0 workqueue entries into one bullet crediting both PRs.
- Parametrize test_configure_scope_with_enum over both WorkqueueSharingScopeType members.
- Add test_device_id_matches_source_multi_gpu verifying WorkqueueResource.device.device_id
tracks the source device when the caller switches devices. Uses the established
system.get_num_devices() < 2 skip pattern.
* cuda.core tests: drop init_cuda from multi-GPU workqueue test
* cuda.core tests: drop unnecessary set_current calls in multi-GPU workqueue test
cuDeviceGetDevResource doesn't require the device to be current; verified
locally that cuCtxGetCurrent returns the same context before and after
the test body.
* cuda.core tests: extract shared _RESOURCE_UNAVAILABLE_ERRORS tuple with rationale
* cuda.core: restore Device TYPE_CHECKING import with noqa
mypy needs Device resolvable in the generated .pyi (WorkqueueResource.device
returns 'Device' as a string forward reference); noqa: F401 keeps cython-lint
from re-flagging it as unused.
* cuda.core: simplify noqa to bare form (cython-lint didn't parse the parenthetical)
* cuda.core: use bare Device annotation on WorkqueueResource.device
cython-lint doesn't count string-quoted forward references as usage of
the TYPE_CHECKING import. The bare form works because from __future__
import annotations makes it a string at runtime anyway (matches
_stream.pyx pattern).
* cuda.core tests: register WorkqueueSharingScopeType in _CASES
test_all_str_enums_in_cases enforces that every StrEnum in
cuda.core.typing is bound to a driver-side counterpart or explicitly
marked unbound. WorkqueueSharingScopeType wraps
CUdevWorkqueueConfigScope 1:1 — clean binding-coverage entry.
* cuda.core tests: gate WorkqueueSharingScopeType binding entry on CUDA 13+
CUdevWorkqueueConfigScope doesn't exist in CUDA 12.x cuda_bindings, so
importing test_enum_coverage crashed with AttributeError. Only register
the binding-coverage entry when the driver exposes the enum; otherwise
mark the wrapper as unbound so test_all_str_enums_in_cases still passes.
Verified both paths locally (real CUDA 13 + delattr-simulated CUDA 12).
* cuda.core tests: sharpen CUDA-version boundary in WorkqueueSharingScopeType comment
CUdevWorkqueueConfigScope landed in the driver in 13.1, not 13.0. Update
the inline comment on the hasattr gate to reflect that the missing-driver-enum
path covers cuda-bindings for both CUDA 12.x and CUDA 13.0.x.
* cuda.core: apply Mike's suggestion for WorkqueueResourceOptions.sharing_scope docstring
* fix typing
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
* Update _device_resources.pyi
* cuda.core: regenerate .pyi to match stubgen-pyx output
end-of-file-fixer excludes .pyi (per .pre-commit-config.yaml), so the
trailing newline manually added in the previous commit made stubgen-pyx
flag the file every run. Reverting to the newline-less form stubgen
emits.
* Apply suggestions from code review
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
---------
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
0 commit comments