Skip to content

Commit abf5fea

Browse files
committed
Refine SM discovery alignment coverage
1 parent 5e0631c commit abf5fea

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

cuda_core/tests/test_green_context.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -405,21 +405,35 @@ 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+
@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+
414+
groups, _ = sm_resource.split(SMResourceOptions(count=None))
415+
416+
assert groups[0].sm_count % sm_resource.coscheduled_alignment == 0
417+
408418
def test_discovery_respects_explicit_coscheduled_sm_count(self, sm_resource):
409419
"""Constrain discovery explicitly because unconstrained discovery may use all SMs."""
410-
if binding_version() < (13, 1, 0) or driver_version() < (13, 1, 0):
420+
if driver_version() < (13, 1, 0):
411421
pytest.skip("explicit co-scheduled SM discovery requires CUDA 13.1+")
412422

413423
alignment = sm_resource.coscheduled_alignment
414-
if alignment <= 0:
415-
pytest.skip("device does not report a co-scheduled SM alignment")
416-
417-
groups, _ = sm_resource.split(
418-
SMResourceOptions(
419-
count=None,
420-
coscheduled_sm_count=alignment,
424+
try:
425+
groups, _ = sm_resource.split(
426+
SMResourceOptions(
427+
count=None,
428+
coscheduled_sm_count=alignment,
429+
)
421430
)
422-
)
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
423437

424438
assert groups[0].sm_count % alignment == 0
425439

0 commit comments

Comments
 (0)