From c6f39028a6b293edb2c413b8229b6480fd0c5204 Mon Sep 17 00:00:00 2001 From: quartz-heron-58 <245169279+quartz-heron-58@users.noreply.github.com> Date: Sat, 28 Nov 2026 07:38:24 +0800 Subject: [PATCH 1/2] make_game: --mesh-serial-waves forwards the translator's switch (BUILD-MAKEGAME-MESH-SERIAL-WAVES) #2435 added rdna2spirv.py --mesh-serial-waves, but make_game.py never passed it, so a build of main got none of its effect. The option is one more entry in FALLBACK_FLAGS: forwarded to every translator run, recorded in translator_flags.txt, and turning it on or off translates the shaders again. Off by default; it changes nothing for shaders translated natively or with --mesh-compute. Tests: the option is opt-in and forwarded, it is recorded after the older flags so existing folders keep their recorded spelling, and every forwarded flag is an option the translator defines. Co-Authored-By: Claude Fable 5.2 --- README.md | 5 +++++ make_game.py | 10 +++++++--- tests/test_make_game_translator_flags.py | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f739ab0522..60bf06553e 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,11 @@ skips a shader without `shaderSignedZeroInfNanPreserveFloat32`; needs PR #664's on by itself on Intel's Windows Vulkan driver, whose native mesh draws crash, BUILD-2202, unless `--native-mesh`). Each is documented in [docs/design.md](docs/design.md). +`--mesh-serial-waves` is forwarded and saved the same way. It is off by default: with wave64 emulation it runs +the waves of a mesh shader of more than 64 threads one after the other in 64 invocations instead of side by side +(docs/design.md, "Mesh shaders with their waves in series"). It changes nothing for shaders translated natively or +with `--mesh-compute`. + The build records which llvm-mc command and version produced the disassembly. Changing either, or reusing a work folder that predates this record, reruns disassembly and translation while keeping the extracted shader inputs. diff --git a/make_game.py b/make_game.py index f1af5a172d..823f511ba2 100644 --- a/make_game.py +++ b/make_game.py @@ -1383,8 +1383,8 @@ def shaders(game: str, work: str, jobs: int, emulate: bool = False, keep_emulate "translating again") drop(translated) # The translation also depends on the fallback flags (--no-float-controls, --bary-fallback, - # --texel-offset-fallback, --mesh-compute), so they are kept beside it like the wave64 mode. A folder from - # before the file existed was translated without them. + # --texel-offset-fallback, --mesh-compute, --mesh-serial-waves, ...), so they are kept beside it like the wave64 + # mode. A folder from before the file existed was translated without them. flags_file = os.path.join(spirv, "translator_flags.txt") want_flags = translator_flags_setting(fallbacks) had_flags = read_shader_setting(flags_file) @@ -1847,7 +1847,7 @@ def exe_shaders(game: str, work: str, mc_signature: str, jobs: int = 1, emulate: FALLBACK_FLAGS = (("--no-float-controls", "no_float_controls"), ("--bary-fallback", "bary_fallback"), ("--texel-offset-fallback", "texel_offset_fallback"), ("--mesh-compute", "mesh_compute"), ("--f16-interp-fallback", "f16_interp_fallback"), ("--pc-tail-ubo", "pc_tail_ubo"), - ("--compact-spirv", "compact_spirv")) + ("--compact-spirv", "compact_spirv"), ("--mesh-serial-waves", "mesh_serial_waves")) def fallback_flags(a) -> tuple[str, ...]: @@ -3155,6 +3155,10 @@ def main() -> int: help="translate mesh shaders to compute shaders writing an output buffer, for devices " "without VK_EXT_mesh_shader; on by itself on Intel's Windows Vulkan driver, whose mesh " "draws crash on the corpus' mesh shaders (BUILD-2202)") + ap.add_argument("--mesh-serial-waves", action="store_true", + help="with wave64 emulation, run the waves of a mesh shader of more than 64 threads one after " + "the other in 64 invocations (the translator's --mesh-serial-waves, #2435); off by " + "default, no effect on shaders translated natively or with --mesh-compute") ap.add_argument("--native-mesh", action="store_true", help="keep native mesh shaders on Intel's Windows Vulkan driver instead of turning on " "--mesh-compute (for a driver that fixes BUILD-2202's crash)") diff --git a/tests/test_make_game_translator_flags.py b/tests/test_make_game_translator_flags.py index ffae8710d9..a3d152af1e 100644 --- a/tests/test_make_game_translator_flags.py +++ b/tests/test_make_game_translator_flags.py @@ -37,6 +37,13 @@ def test_each_flag_alone(self): def test_all_flags_in_record_order(self): self.assertEqual(make_game.fallback_flags(self.args_with(*reversed(ALL_FLAGS))), ALL_FLAGS) + def test_every_forwarded_flag_is_a_translator_option(self): + # The flags go to rdna2spirv.py verbatim: one it does not define would end every translation with a usage error. + with open(os.path.join(ROOT, "tools", "rdna2spirv.py"), encoding="utf-8") as f: + translator = f.read() + for flag, _attr in make_game.FALLBACK_FLAGS: + self.assertIn(f'ap.add_argument("{flag}"', translator, flag) + class TranslateFallbacksTest(unittest.TestCase): """translate() passes the fallback flags to every shard, and re-plans when they change.""" @@ -222,6 +229,18 @@ def test_no_flags_by_default(self): self.assertEqual(pre, ()) self.assertEqual(sh, ()) + def test_mesh_serial_waves_is_opt_in_and_forwarded(self): + # #2435's translator switch: nothing passes it unless asked, and asking forwards it like the other flags. + pre, sh = self.run_main("--mesh-serial-waves") + self.assertEqual(pre, ("--mesh-serial-waves",)) + self.assertEqual(sh, pre) + + def test_mesh_serial_waves_is_recorded_after_the_older_flags(self): + # Appended to FALLBACK_FLAGS, so the settings recorded for existing folders keep their spelling. + pre, _sh = self.run_main("--mesh-serial-waves", "--mesh-compute", "--no-float-controls") + self.assertEqual(pre, ("--no-float-controls", "--mesh-compute", "--mesh-serial-waves")) + self.assertEqual(make_game.translator_flags_setting(pre), "--no-float-controls --mesh-compute --mesh-serial-waves") + def test_f16_interp_fallback_follows_the_device(self): """On by itself where vk_subgroup_info says the GPU can't take PerVertexKHR inputs (MoltenVK), not where it can or can't tell; asked for explicitly, it is on everywhere.""" From 4ff5c90644a6c5d732ac70e4ff422996f9863181 Mon Sep 17 00:00:00 2001 From: quartz-heron-58 <245169279+quartz-heron-58@users.noreply.github.com> Date: Sat, 28 Nov 2026 10:11:28 +0800 Subject: [PATCH 2/2] make_game: say which mesh shaders --mesh-serial-waves changes Review note on #2513: the help text and the README said only 'more than 64 threads'. The translator also needs a wave64 program, a thread count that is a multiple of 64, and no LDS instruction, store or atomic; the others come out as before. Both texts now say so, and that the option retranslates everything but changes only those. Co-Authored-By: Claude Fable 5.2 --- README.md | 7 ++++--- make_game.py | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 60bf06553e..44f1d1a5db 100644 --- a/README.md +++ b/README.md @@ -208,9 +208,10 @@ on by itself on Intel's Windows Vulkan driver, whose native mesh draws crash, BU Each is documented in [docs/design.md](docs/design.md). `--mesh-serial-waves` is forwarded and saved the same way. It is off by default: with wave64 emulation it runs -the waves of a mesh shader of more than 64 threads one after the other in 64 invocations instead of side by side -(docs/design.md, "Mesh shaders with their waves in series"). It changes nothing for shaders translated natively or -with `--mesh-compute`. +the waves of a mesh shader one after the other in 64 invocations instead of side by side (docs/design.md, "Mesh +shaders with their waves in series"). Only a wave64 mesh shader of more than 64 threads, a multiple of 64, with no +LDS instruction, store or atomic takes that form; every other shader, and every shader translated natively or with +`--mesh-compute`, comes out as before, so turning it on retranslates everything but changes only those. The build records which llvm-mc command and version produced the disassembly. Changing either, or reusing a work folder that predates this record, reruns disassembly and translation while keeping the extracted shader inputs. diff --git a/make_game.py b/make_game.py index 823f511ba2..5283eaa8a0 100644 --- a/make_game.py +++ b/make_game.py @@ -3156,9 +3156,11 @@ def main() -> int: "without VK_EXT_mesh_shader; on by itself on Intel's Windows Vulkan driver, whose mesh " "draws crash on the corpus' mesh shaders (BUILD-2202)") ap.add_argument("--mesh-serial-waves", action="store_true", - help="with wave64 emulation, run the waves of a mesh shader of more than 64 threads one after " - "the other in 64 invocations (the translator's --mesh-serial-waves, #2435); off by " - "default, no effect on shaders translated natively or with --mesh-compute") + help="with wave64 emulation, run the waves of a mesh shader one after the other in 64 " + "invocations instead of side by side (the translator's --mesh-serial-waves, #2435). " + "Only wave64 mesh shaders of more than 64 threads, a multiple of 64, with no LDS " + "instruction, store or atomic take that form; the others, and every shader translated " + "natively or with --mesh-compute, come out as before. Off by default") ap.add_argument("--native-mesh", action="store_true", help="keep native mesh shaders on Intel's Windows Vulkan driver instead of turning on " "--mesh-compute (for a driver that fixes BUILD-2202's crash)")