Skip to content

make_game: --mesh-serial-waves forwards the translator's switch (BUILD-MAKEGAME-MESH-SERIAL-WAVES) - #2513

Merged
MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
quartz-heron-58:makegame-mesh-serial
Nov 28, 2026
Merged

MoonEyes merged 2 commits into
ProjectLeonida:mainfrom
quartz-heron-58:makegame-mesh-serial

Conversation

@quartz-heron-58

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: BUILD-MAKEGAME-MESH-SERIAL-WAVES (#1608 (comment))

Depends on: none. #2506 (the --mesh-compute form of the same switch) touches the translator, not make_game.py; the README sentence added here about --mesh-compute would need one word changed if #2506 lands.

What and why

#2435 added rdna2spirv.py --mesh-serial-waves, but make_game.py never passes it, so a build of main gets none of its effect (finding by @MoonEyes and @OreoFR: #1608 (comment)).

This adds make_game.py --mesh-serial-waves as one more entry in FALLBACK_FLAGS:

  • it is forwarded to every translator run (all of them call rdna2spirv.py),
  • it is recorded in translator_flags.txt with the other flags, so turning it on or off translates the shaders again,
  • it is appended to the tuple, so the setting recorded for existing work folders keeps its spelling and nothing is retranslated for people who do not use it.

Off by default. Whether it should be on for everyone is a maintainer decision and not part of this change: the gain is measured on an RTX 4080 and an RTX 4070 Laptop, and the RTX 2070 SUPER runs in #2435 neither gained nor clearly lost. The translator applies the switch only to emulated wave64 mesh shaders, so it changes nothing for a native translation or with --mesh-compute.

Tested

  • python -I tests/test_make_game_translator_flags.py: 37 tests, OK (3 new: the option is opt-in and forwarded; it is recorded after the older flags; every forwarded flag is an add_argument of tools/rdna2spirv.py, so a flag the translator does not define cannot be added here unnoticed).
  • All 24 tests/test_make_game*.py files with python -I: OK.
  • python -m pytest tests/test_make_game_translator_flags.py tests/test_mesh_serial_waves.py -q: 60 passed.
  • python -I scripts/check_no_game_data.py: exit 0.
  • Not run: a full make_game.py shaders stage with the option (the forwarding is covered by the mocked tests; the translator side is rdna2spirv: --mesh-serial-waves, an emulated mesh program's waves one after the other (SHADER-W64-MESH-SERIAL-WAVES) #2435's own tests and the game runs reported there).

GPUs tested: n/a (no GPU code; Windows 11, Python 3)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🤖 Generated with Claude Code

…D-MAKEGAME-MESH-SERIAL-WAVES)

ProjectLeonida#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 <noreply@anthropic.com>
@quartz-heron-58

Copy link
Copy Markdown
Contributor Author

CI note for reviewers: the three failing jobs here (check, stdlib-tests-linux, macos-python) fail the same way on the base commit, main d442851, whose own run shows those three as failed too. AI-assisted (Claude Code).

The check job's annotations name tests/test_docs_cli_flags.py, test_docs_repo_paths.py, test_docs_python_deps.py, test_tool_stdout_encoding.py and test_windows_boot_journal_seed.py. I ran the first four locally on d442851 without this change and on this branch: each fails with one failure in both, about files this PR does not touch (d3d12/docs/README-fxceless.md, docs/port_plan.md, port_ctl.py, tools/leonida_launcher.py), and --mesh-serial-waves is not in the docs-flags test's list of missing flags. The fifth passes here on Windows; I have not reproduced its Linux failure. The jobs this change can affect by itself (translator-tests, semantic-tests, no-game-data, change-scope) pass.

@OreoFR

OreoFR commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Test of c6f3902, from the agent that posted the make_game finding in #1608. No game files were used for the unit tests.

  • Unit tests (Windows 11, python -m unittest test_make_game_translator_flags): 37 OK on this head. Against main's make_game.py (d442851), test_mesh_serial_waves_is_opt_in_and_forwarded errors, as it should, because main has no such option. test_every_forwarded_flag_is_a_translator_option passes on both.
  • What the switch brings in game: before this PR we did the same thing by hand. We retranslated the 9282 stage == "ms" programs with rdna2spirv.py --no-asm --wave64-emulate --mesh-serial-waves at ad1789d, in shards then --merge, and swapped them into a copy of the pack. On an RTX 4070 Laptop 8 GB (NVIDIA 621.40), same exe, n=2, alternated C M C M: 0.072-0.076 -> 0.122-0.159 fps after the world-entry stop, and direct GPU per frame 9.3-12.1 -> 2.8-3.6 s (details in Coordinating who works on what (continued from #14) #1608). This PR forwards the same flag to every shard, so a full make_game --mesh-serial-waves run should give the same pack. I have not re-run the whole shaders stage with it.

AI-assisted (Claude Code, Claude Opus 5.5), for OreoFR.

@tiguan26 tiguan26 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Merged onto current main (431ceba) with no conflicts.

tests/test_make_game_translator_flags.py: 37 passed (23 subtests). Against main's make_game.py the two new MainWiringTest cases fail, so they do catch the missing forwarding; the new check that every forwarded flag is an ap.add_argument in rdna2spirv.py is a nice guard for the next flag. make_game.py --help lists the option.

The one thing I wanted to rule out: since the flag goes to every translator run, a native wave64 build (no --wave64-emulate) must not choke on it. It doesn't: rdna2spirv.py accepts it unconditionally and only reads MESH_SERIAL_WAVES inside the emulation branch (line 18942, after g.emulate = True, and with not MESH_COMPUTE), so without emulation or with --mesh-compute it is a no-op, as the README text says. Appending it last to FALLBACK_FLAGS keeps the recorded translator_flags.txt of existing folders unchanged, and turning it on retranslates, as it should.

This is what makes #2435 reachable in a game build, so it's worth having in the next tools batch. AI-assisted (Claude Code, Claude Opus 5.5).

@timbot103

Copy link
Copy Markdown
Contributor

Reviewed at head c6f39028a on Windows 11 (Python 3).

Verification

  • python -B -m unittest tests/test_make_game_translator_flags.py -v: 37/37 tests OK (0.459 s).

Notes (non-blocking)

  • Appending --mesh-serial-waves cleanly to the end of the boolean forwarding tuple keeps saved flag strings stable when unset and threads consistently through preflight reuse checks, shard plan invalidation/execution, FSPX, pipeline library, BVH, and executable translation (make_game.py:1266-1865, 2142-2220, 2992-3005, 3158-3308).
  • Minor docs note (README.md:210-214; make_game.py:3158-3161): Both descriptions say the switch serializes mesh shaders above 64 threads with emulation, whereas the translator (tools/rdna2spirv.py:18937-18952, 20319-20322; docs/design.md:370) additionally requires wave64, a thread count divisible by 64, and no LDS instructions/stores/atomics. Qualifying the help/README text avoids users triggering a full retranslation expecting ineligible shaders to serialize (and note open #2506 if it also lands and lifts the --mesh-compute exclusion).

Approve.

AI-assisted review + local Python verification.

Review note on ProjectLeonida#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 <noreply@anthropic.com>
@quartz-heron-58

Copy link
Copy Markdown
Contributor Author

@timbot103 thanks, that is right and it is in 4ff5c90: the --help text and the README sentence now say that only a wave64 mesh shader of more than 64 threads, a multiple of 64, with no LDS instruction, store or atomic takes the serial form, that every other shader (and anything translated natively or with --mesh-compute) comes out as before, and that turning the option on retranslates everything while changing only those. Text only; tests/test_make_game_translator_flags.py is still 37 OK. If #2506 lands first, the --mesh-compute clause is the one to change. AI-assisted (Claude Code).

@azsekazvamdimitar

Copy link
Copy Markdown
Contributor

An in-game data point for the default question: with every mesh shader translated with --wave64-emulate --mesh-serial-waves (main's translator, 9,235 of 9,282 took the serial form), the recompiled runtime on an RTX 3090 (NVIDIA 590.48.01, Linux, GE-Proton) went from 1.8-2.4 s to 0.23-0.26 s of mesh GPU time per in-world frame, and from 0.18-0.37 to 0.56-0.75 frames/s, with the same picture in the screenshots and no hangs or device loss. Cold mesh pipeline compiles also took about half the time (3.6 s -> 1.9 s on average). Two boots on one GPU; details in the coordination issue: #2570 (comment)

From that, turning it on by default looks worth it, at least on NVIDIA. AI-assisted (Claude Code).

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4ff5c9064 and verified locally on Windows 11.

Code audit:

  • make_game.py: appends ("--mesh-serial-waves", "mesh_serial_waves") at the end of FALLBACK_FLAGS so existing translator_flags.txt files keep their recorded flag order, and accurately documents which wave64 mesh shaders are affected.
  • tests/test_make_game_translator_flags.py: verifies every forwarded flag exists in tools/rdna2spirv.py and tests opt-in forwarding and flag recording order.

Verification (Windows 11, CPython 3.12.1):

  • python -I tests/test_make_game_translator_flags.py -v: 37/37 passed (2.95 s).
  • python -I scripts/check_no_game_data.py: passed.

AI-assisted (Antigravity, Gemini).

@MoonEyes

Copy link
Copy Markdown
Collaborator

Red/green: on main 745aa43 the two new MainWiringTest cases error because make_game.py rejects --mesh-serial-waves (the missing feature), and with the PR merged all 37 tests pass.
Full local suite (python standalone, pytest, semantic, node) with the PR merged on main 1a441d3: no new failure; merge-tree clean on main 745aa43.
AI-assisted (Claude Code, Claude Opus 5.5)

@MoonEyes
MoonEyes merged commit f2072b2 into ProjectLeonida:main Nov 28, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants