From 901fab9b9ddd4a64eca24ee26b0e63bac87104d4 Mon Sep 17 00:00:00 2001 From: Songhao Jia Date: Mon, 19 Oct 2026 22:56:14 -0700 Subject: [PATCH] Skip the batch sampler runtime test on ROCm Summary: The ROCm AOTI unittest job on main fails during pytest collection: the newly added batch sampler test imports the Python runtime at module scope, and the ROCm CI build only ships executor_runner, not the pybindings extension. One collection error aborts the whole backends/cuda/tests run, so every ROCm test stops running. Import the runtime inside the test and skip the class on ROCm, following the existing convention for tests that load through the Python runtime. Differential Revision: D126231386 --- backends/cuda/tests/test_batch_sampler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backends/cuda/tests/test_batch_sampler.py b/backends/cuda/tests/test_batch_sampler.py index 52bcb87d76a..9c8d62a7f6d 100644 --- a/backends/cuda/tests/test_batch_sampler.py +++ b/backends/cuda/tests/test_batch_sampler.py @@ -20,7 +20,6 @@ from executorch.exir.passes import MemoryPlanningPass from executorch.exir.passes.propagate_device_pass import PropagateDeviceConfig from executorch.extension.llm.batching.sampler import BatchSampler -from executorch.runtime import Runtime def export_sampler(directory: Path, vocab: int): @@ -56,8 +55,14 @@ def export_sampler(directory: Path, vocab: int): @unittest.skipUnless(torch.cuda.is_available(), "CUDA required") +@unittest.skipIf( + torch.version.hip is not None, + "loads through the Python runtime, which the ROCm build does not include", +) class CudaBatchSamplerTest(unittest.TestCase): def test_dynamic_rows_with_masked_reduction_lanes(self): + from executorch.runtime import Runtime + # A vocabulary spanning several reduction tiles exposes padding lanes. vocab = 202048 with tempfile.TemporaryDirectory() as temporary: