Skip to content

Commit 20f6ff8

Browse files
authored
Merge branch 'main' into enable-security-suite
2 parents c79213c + 5ac37a9 commit 20f6ff8

2 files changed

Lines changed: 41 additions & 3 deletions

File tree

cuda_core/docs/source/release/1.2.0-notes.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ Fixes and enhancements
7373
Windows, both ``ctypes.CFUNCTYPE`` and ``ctypes.WINFUNCTYPE`` are accepted.
7474
(`#2439 <https://github.com/NVIDIA/cuda-python/issues/2439>`__)
7575

76+
- Starting with CUDA 13.4, unconstrained SM-resource discovery through
77+
:meth:`SMResource.split` with ``SMResourceOptions(count=None)`` may return
78+
every available SM, even when that count is not divisible by the device's
79+
:attr:`SMResource.coscheduled_alignment`. CUDA 13.1 through 13.3 returned an
80+
aligned subset for the same request. An omitted or zero
81+
``coscheduled_sm_count`` still selects the driver's default internally, but
82+
CUDA 13.4 no longer guarantees that the returned :attr:`SMResource.sm_count`
83+
is a multiple of that default. A green context created from the discovered
84+
group may therefore span the full GPU and leave an empty remainder. Set
85+
``coscheduled_sm_count`` explicitly when an aligned result is required.
86+
(`#2389 <https://github.com/NVIDIA/cuda-python/pull/2389>`__)
87+
7688
Deprecation Notices
7789
-------------------
7890

cuda_core/tests/test_green_context.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,37 @@ def test_discovery_mode(self, sm_resource):
405405
assert len(groups) == 1
406406
assert groups[0].sm_count >= sm_resource.min_partition_size
407407

408-
def test_discovery_respects_alignment(self, sm_resource):
408+
@pytest.mark.agent_authored(model="gpt-5.6-sol")
409+
def test_by_count_discovery_respects_alignment(self, sm_resource):
410+
"""CUDA 12 SplitByCount discovery returns an aligned SM count."""
411+
if binding_version()[0] != 12:
412+
pytest.skip("test covers the CUDA 12 SplitByCount path")
413+
409414
groups, _ = sm_resource.split(SMResourceOptions(count=None))
410415

411-
if sm_resource.coscheduled_alignment > 0:
412-
assert groups[0].sm_count % sm_resource.coscheduled_alignment == 0
416+
assert groups[0].sm_count % sm_resource.coscheduled_alignment == 0
417+
418+
def test_discovery_respects_explicit_coscheduled_sm_count(self, sm_resource):
419+
"""Constrain discovery explicitly because unconstrained discovery may use all SMs."""
420+
if driver_version() < (13, 1, 0):
421+
pytest.skip("explicit co-scheduled SM discovery requires CUDA 13.1+")
422+
423+
alignment = sm_resource.coscheduled_alignment
424+
try:
425+
groups, _ = sm_resource.split(
426+
SMResourceOptions(
427+
count=None,
428+
coscheduled_sm_count=alignment,
429+
)
430+
)
431+
except RuntimeError as exc:
432+
pytest.skip(str(exc))
433+
except CUDAError as exc:
434+
if _is_invalid_resource_configuration(exc):
435+
pytest.skip(str(exc))
436+
raise
437+
438+
assert groups[0].sm_count % alignment == 0
413439

414440
def test_two_groups(self, sm_resource):
415441
"""Two-group split succeeds for a supported explicit request."""

0 commit comments

Comments
 (0)