|
22 | 22 | launch, |
23 | 23 | ) |
24 | 24 | from cuda.core._utils.cuda_utils import CUDAError |
| 25 | +from cuda.core._utils.version import binding_version, driver_version |
25 | 26 | from cuda.core.typing import WorkqueueSharingScopeType |
26 | 27 |
|
27 | 28 | # --------------------------------------------------------------------------- |
@@ -337,11 +338,23 @@ def test_discovery_mode(self, sm_resource): |
337 | 338 | assert len(groups) == 1 |
338 | 339 | assert groups[0].sm_count >= sm_resource.min_partition_size |
339 | 340 |
|
340 | | - def test_discovery_respects_alignment(self, sm_resource): |
341 | | - groups, _ = sm_resource.split(SMResourceOptions(count=None)) |
| 341 | + def test_discovery_respects_explicit_coscheduled_sm_count(self, sm_resource): |
| 342 | + """Constrain discovery explicitly because unconstrained discovery may use all SMs.""" |
| 343 | + if binding_version() < (13, 1, 0) or driver_version() < (13, 1, 0): |
| 344 | + pytest.skip("explicit co-scheduled SM discovery requires CUDA 13.1+") |
| 345 | + |
| 346 | + alignment = sm_resource.coscheduled_alignment |
| 347 | + if alignment <= 0: |
| 348 | + pytest.skip("device does not report a co-scheduled SM alignment") |
| 349 | + |
| 350 | + groups, _ = sm_resource.split( |
| 351 | + SMResourceOptions( |
| 352 | + count=None, |
| 353 | + coscheduled_sm_count=alignment, |
| 354 | + ) |
| 355 | + ) |
342 | 356 |
|
343 | | - if sm_resource.coscheduled_alignment > 0: |
344 | | - assert groups[0].sm_count % sm_resource.coscheduled_alignment == 0 |
| 357 | + assert groups[0].sm_count % alignment == 0 |
345 | 358 |
|
346 | 359 | def test_two_groups(self, sm_resource): |
347 | 360 | """Two-group split succeeds for a supported explicit request.""" |
|
0 commit comments