feat(cuda.core): add synchronization_policy to LaunchConfig - #2637
feat(cuda.core): add synchronization_policy to LaunchConfig#2637atiaomar1978-hub wants to merge 12 commits into
Conversation
Expose CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY through LaunchConfig so cuda.core users can set per-launch CPU wait policies without dropping to cuda.bindings.driver. Adds SynchronizationPolicyType and tests for native attribute mapping and real kernel launches. Closes NVIDIA#2628. Co-authored-by: Cursor <cursoragent@cursor.com>
Declare sync_policy_value at function scope so Cython can cast to CUsynchronizationPolicy when building the launch attribute. Co-authored-by: Cursor <cursoragent@cursor.com>
Use cuda.bindings.driver.CUsynchronizationPolicy constants for the public IntEnum and skip GPU launch smoke tests when CUDA 13 bindings run against a CUDA 12 driver. Co-authored-by: Cursor <cursoragent@cursor.com>
GPU validation report (RunPod, contributor-run)Validated this change on real NVIDIA hardware outside upstream CI. Environment
Command pytest cuda_core/tests/test_launcher.py -k "synchronization_policy" -vResults: 10 passed, 4 skipped, 0 failed
The four launch smoke tests were skipped because this host exposes a CUDA 12 driver while the build used CUDA 13 bindings ( Cost: ~ |
Sort imports in test_launcher.py (ruff I001) and regenerate _launch_config.pyi via stubgen-pyx after LaunchConfig changes. Co-authored-by: Cursor <cursoragent@cursor.com>
Expose CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY through LaunchConfig so cuda.core users can set per-launch CPU wait policies without dropping to cuda.bindings.driver. Adds SynchronizationPolicyType and tests for native attribute mapping and real kernel launches. Closes NVIDIA#2628. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Omar Atie <atiaomar1978@gmail.com>
Declare sync_policy_value at function scope so Cython can cast to CUsynchronizationPolicy when building the launch attribute. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Omar Atie <atiaomar1978@gmail.com>
Use cuda.bindings.driver.CUsynchronizationPolicy constants for the public IntEnum and skip GPU launch smoke tests when CUDA 13 bindings run against a CUDA 12 driver. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Omar Atie <atiaomar1978@gmail.com>
Sort imports in test_launcher.py (ruff I001) and regenerate _launch_config.pyi via stubgen-pyx after LaunchConfig changes. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Omar Atie <atiaomar1978@gmail.com>
9f4bb0a to
0008aca
Compare
Fix ruff I001 unsorted-imports for pre-commit.ci on PR NVIDIA#2637. Signed-off-by: Omar Atie <atiaomar1978@gmail.com>
Clean up test_launcher.py after merging the pre-force-push commit lineage back into the branch. Signed-off-by: Omar Atie <omaratie@Omars-Mac-mini.local> Co-authored-by: Cursor <cursoragent@cursor.com>
Record that feat/launch-config-sync-policy-2628 includes upstream main at db28018. Future updates will use merge commits, not force-push. Signed-off-by: Omar Atie <atiaomar1978@gmail.com>
Branch update: history preserved, main merged, no force-pushForce-push fixThe earlier force-push (
The PR graph now shows both the original and rewritten commits. Main merge
Going forward
|
Note on commit signingThe two history-restore commits ( Re-signing those commits in place would require rewriting their SHAs and force-pushing the branch — which we're deliberately avoiding to preserve PR history per maintainer guidance. All new commits going forward on this branch will be SSH-signed with |
Summary
LaunchConfig.synchronization_policyto exposeCU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICYfromcuda.core, closing [FEA]: Add support for CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICY in LaunchConfig #2628.SynchronizationPolicyTypeincuda.core.typing(AUTO,SPIN,YIELD,BLOCKING_SYNC) aligned withcuda.bindings.driver.CUsynchronizationPolicy.LaunchConfig._to_native_launch_config()and the standalone_to_native_launch_config()helper used in tests.tests/test_launcher.py, plus a GPU launch smoke test (skipped when CUDA 13 bindings run against a CUDA 12 driver).Motivation
Pool-backed and other
LaunchConfiglaunch attributes already route throughcuLaunchKernelEx. Users should be able to set per-launch CPU wait policy without dropping to rawcuda.bindings.driverAPIs. This follows the incrementalLaunchConfigattribute coverage tracked under #496 (same approach asprogrammatic_stream_serialization).Example
Test plan
pytest cuda_core/tests/test_launcher.py -k synchronization_policy -v$0.16/hr)RunPod GPU report (contributor-run)
feat/launch-config-sync-policy-2628cuda_core, CUDA 13 headers/bindingspytest tests/test_launcher.py -k synchronization_policy -vMapping tests verify
CU_LAUNCH_ATTRIBUTE_SYNCHRONIZATION_POLICYfor all four policies, invalid-input rejection, defaultNone, and combination withis_cooperative. The four GPU launch smoke tests were skipped on this host because the RunPod image exposes a CUDA 12 driver while the build used CUDA 13 bindings (cubin load is incompatible); upstream CI with matched driver/toolkit should cover the launch path.Closes #2628.
Made with Cursor