Skip to content

Commit c6c283b

Browse files
test(cuda.core): cover cluster policy getter/setter and launch run-through
Align #2629 tests with reviewer guidance: round-trip each policy on LaunchConfig and exercise launch() for DEFAULT/SPREAD/LOAD_BALANCING. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Omar Atie <atiaomar1978@gmail.com>
1 parent 18c95f2 commit c6c283b

1 file changed

Lines changed: 41 additions & 4 deletions

File tree

cuda_core/tests/test_launcher.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,46 @@ class _FakeDev:
476476
assert driver.CUlaunchAttributeID.CU_LAUNCH_ATTRIBUTE_CLUSTER_SCHEDULING_POLICY_PREFERENCE in attr_ids
477477

478478

479-
@pytest.mark.agent_authored(model="composer-2.5-fast")
480-
def test_launch_cluster_scheduling_policy_smoke(init_cuda):
481-
"""Smoke-test launching with cluster scheduling policy on Hopper+."""
479+
@pytest.mark.parametrize(
480+
"policy",
481+
[
482+
ClusterSchedulingPolicyType.DEFAULT,
483+
ClusterSchedulingPolicyType.SPREAD,
484+
ClusterSchedulingPolicyType.LOAD_BALANCING,
485+
],
486+
)
487+
@pytest.mark.agent_authored(model="cursor-grok-4.6")
488+
def test_launch_config_cluster_scheduling_policy_getter_setter(monkeypatch, policy):
489+
"""Getter/setter round-trip for each cluster scheduling policy."""
490+
from cuda.core import _launch_config as _lc_mod
491+
492+
class _FakeDev:
493+
compute_capability = (9, 0)
494+
495+
monkeypatch.setattr(_lc_mod, "Device", lambda: _FakeDev())
496+
497+
cfg = LaunchConfig(grid=1, block=1)
498+
assert cfg.cluster_scheduling_policy_preference is None
499+
cfg.cluster_scheduling_policy_preference = policy
500+
assert cfg.cluster_scheduling_policy_preference is policy
501+
502+
cfg2 = LaunchConfig(grid=1, block=1, cluster_scheduling_policy_preference=policy)
503+
assert cfg2.cluster_scheduling_policy_preference is policy
504+
cfg2.cluster_scheduling_policy_preference = None
505+
assert cfg2.cluster_scheduling_policy_preference is None
506+
507+
508+
@pytest.mark.parametrize(
509+
"policy",
510+
[
511+
ClusterSchedulingPolicyType.DEFAULT,
512+
ClusterSchedulingPolicyType.SPREAD,
513+
ClusterSchedulingPolicyType.LOAD_BALANCING,
514+
],
515+
)
516+
@pytest.mark.agent_authored(model="cursor-grok-4.6")
517+
def test_launch_cluster_scheduling_policy_smoke(init_cuda, policy):
518+
"""Application code runs through launch() for each policy on Hopper+."""
482519
dev = Device()
483520
if dev.compute_capability < (9, 0):
484521
pytest.skip("Cluster scheduling policy requires compute capability >= 9.0")
@@ -492,7 +529,7 @@ def test_launch_cluster_scheduling_policy_smoke(init_cuda):
492529
grid=1,
493530
block=32,
494531
cluster=(2, 1, 1),
495-
cluster_scheduling_policy_preference=ClusterSchedulingPolicyType.LOAD_BALANCING,
532+
cluster_scheduling_policy_preference=policy,
496533
)
497534
launch(stream, launch_config, kernel)
498535
stream.sync()

0 commit comments

Comments
 (0)