|
1 | 1 | """Tests for known_block_size attribute on @flyc.kernel.""" |
2 | 2 |
|
3 | | -import re |
4 | | - |
5 | 3 | import pytest |
6 | 4 |
|
7 | 5 | import flydsl.compiler as flyc |
@@ -129,14 +127,6 @@ def _get_source_ir(launch_fn, *args): |
129 | 127 | return artifact.source_ir |
130 | 128 |
|
131 | 129 |
|
132 | | -def _get_compiled_ir(launch_fn, x): |
133 | | - """Call the JIT function once, then return the compiled IR string.""" |
134 | | - launch_fn(x, stream=torch.cuda.current_stream()) |
135 | | - assert launch_fn._mem_cache, "expected at least one cached compilation" |
136 | | - artifact = next(iter(launch_fn._mem_cache.values())) |
137 | | - return artifact.ir |
138 | | - |
139 | | - |
140 | 130 | # --------------------------------------------------------------------------- |
141 | 131 | # Tests |
142 | 132 | # --------------------------------------------------------------------------- |
@@ -168,14 +158,6 @@ def test_static_numeric_dims_are_inferred(self): |
168 | 158 | assert "known_block_size = array<i32: 64, 1, 1>" in source_ir |
169 | 159 | assert "known_block_size = array<i32: 32, 2, 1>" in source_ir |
170 | 160 |
|
171 | | - def test_compiled_ir_has_max_flat_workgroup_size(self): |
172 | | - compiled_ir = _get_compiled_ir(_launch_bs128_4_2, self.x) |
173 | | - # The compiled IR should report max_flat_workgroup_size >= total_threads |
174 | | - match = re.search(r"max_flat_workgroup_size\s*=\s*(\d+)", compiled_ir) |
175 | | - assert match is not None, f"max_flat_workgroup_size not found in compiled IR:\n{compiled_ir}" |
176 | | - max_wg = int(match.group(1)) |
177 | | - assert max_wg >= 1024, f"max_flat_workgroup_size={max_wg} < total_threads=1024" |
178 | | - |
179 | 161 | def test_dynamic_block_size_omits_exact_attribute(self): |
180 | 162 | source_ir = _get_source_ir(_launch_dynamic_blocks, self.x, 64, 64) |
181 | 163 | # Check for the attribute syntax, not just the substring (which may |
@@ -203,9 +185,10 @@ def test_reused_explicit_name_gets_unique_symbols(self): |
203 | 185 | assert "gpu.func @_kn_named_block_specialization(" in source_ir |
204 | 186 | assert "gpu.func @_kn_named_block_specialization_1(" in source_ir |
205 | 187 |
|
206 | | - def test_kernel_launches_successfully(self): |
207 | | - """Ensure the kernel actually launches without hipErrorLaunchFailure.""" |
208 | | - _launch_bs64(self.x, stream=torch.cuda.current_stream()) |
| 188 | + @pytest.mark.parametrize("launch_fn", [_launch_bs64, _launch_bs128_4_2], ids=["64", "1024"]) |
| 189 | + def test_kernel_launches_successfully(self, launch_fn): |
| 190 | + """Exercise backend workgroup metadata, including a 1024-thread launch.""" |
| 191 | + launch_fn(self.x, stream=torch.cuda.current_stream()) |
209 | 192 | torch.cuda.synchronize() # would raise if launch failed |
210 | 193 |
|
211 | 194 |
|
|
0 commit comments