Skip to content

make_game: a GPU probe that can't tell keeps the automatic fallback flags of a finished translation - #3656

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
kotorvr:make-game-keep-auto-fallbacks
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
kotorvr:make-game-keep-auto-fallbacks

Conversation

@kotorvr

@kotorvr kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new BUILD item, claim in #3574 (no ID yet)

What was wrong

main() turns --f16-interp-fallback and --pc-tail-ubo on by itself when tools/vk_subgroup_info.py says the runtime's GPU needs them. When the probe can't tell (runtime_gpu_per_vertex() / runtime_gpu_max_push_constants() return None on any error and on the 60 s timeout), the flag is simply absent. shaders() then compares the flags with spirv/translator_flags.txt, logs "the fallback flags are now none (the shaders were translated with ...): translating again" and translates the whole corpus without them. The next run that can ask the GPU translates it a third time.

Reproduced on main f847748c (my own run) with the real main() and shaders() on one work folder, only the probe and the subprocesses mocked: probe says no / can't tell / says no again / says no gives translations with (f16, pc-tail), (), (f16, pc-tail), none: three translations where one is enough. The new test test_a_probe_that_cannot_tell_keeps_both_automatic_flags runs the same sequence. wave64 auto already keeps its mode in this situation (keep_emulated); the fallback flags had nothing like it.

The change

  • When a probe can't tell, an automatic flag that the existing translation was made with (read from translator_flags.txt) stays on, and the log says so: "couldn't ask the GPU the runtime would use whether it needs ; the shaders were translated with it and it stays on instead of translating them all again (a run that can ask the GPU decides again)".
  • Nothing else changes: a probe that answers still decides (a GPU that doesn't need the flag translates again without it, as before); a folder translated without the flag gets none from a failed probe; a first build with no answer gets no automatic flag; the flags the user passes are compared as before.
  • One edge to know: translator_flags.txt does not record whether a flag came from the probe or from the command line, so a user who passed --pc-tail-ubo once and then drops it keeps it for as long as the probe can't answer.
  • The existing MainWiringTest.run_main now builds into an empty --out: main() reads the recorded flags, and the default folder is the user's own.

Not changed: docs/design.md says these flags are on by themselves where the GPU needs them, which is still true.

Tested

Windows 11, Python 3.13, no GPU or game files involved (probe and tools mocked):

  • python -I tests/test_make_game_translator_flags.py: 25 tests OK (5 new in ProbeFailureKeepsAutomaticFlagsTest, which also re-runs the 4 RecordedFlagsTest cases it inherits its folder set-up from). With main's make_game.py: 3 failures and 1 error, all four in the new class.
  • All 15 tests/test_make_game_*.py files with python -I: OK.
  • python -m compileall -q make_game.py tests, python -I make_game.py --help, python -I tests/test_text_write_line_endings.py: OK.
  • Not run: a real probe failure on hardware; the probe's None is mocked.

An independent run by a second session reproduced the test counts above before this was opened.

Overlap with open pull requests (trial merges): conflicts with #3302 in make_game.py and tests/test_make_game_translator_flags.py, and with #3086 in tests/test_make_game_translator_flags.py; clean with #3484 and #3092. Neither is needed by this one; whichever lands second rebases.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…lags of a finished translation

main() turns --f16-interp-fallback and --pc-tail-ubo on when
vk_subgroup_info.py says the runtime's GPU needs them. When the probe could
not tell (any error, or its 60 s timeout) the flags were simply absent, so
shaders() saw a changed flag set, logged "the fallback flags are now none
...: translating again" and translated the whole corpus without them; the
next run that could ask translated it a third time.

When the probe can't tell, a flag the existing translation was made with
now stays on, and the log says so. A probe that answers still decides, a
folder translated without the flag gets none from a failed probe, and the
flags the user passes are compared as before. wave64 `auto` already keeps
its mode for the same reason.

The main() wiring tests now build into an empty --out instead of the
user's default folder, since main() reads the recorded flags.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@evilclanker9000

Copy link
Copy Markdown
Contributor

Second check on Windows at a82f8147. All 90 flag and preflight tests passed. In a separate source-only workspace I ran the actual main() and shaders() path with stubbed probes and translator. With a matching saved index, two inconclusive probes caused the base to translate once without either fallback. This head translated zero times, kept both flags, and preserved the index byte for byte. Definite answers still added or removed the flags with one translation as appropriate. Explicit flags bypassed both probes and reused the matching index.

I also checked an interrupted-translation state with a flags file but no index. This head carried the saved flags into the retry, so the behavior also covers an unfinished translation with recorded flags. A first attempt with no cached flags still added none. No hardware probe was run.

AI-assisted.

@zneel

zneel commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Reviewed and tested a82f8147 on Windows 11 Pro 10.0.26300, AMD Ryzen 7 9800X3D CPU (64 GB RAM), AMD Radeon RX 9070 XT (AMD 26.11.2), Python 3.12.10: looks good.

run result
pytest tests/test_make_game_translator_flags.py 25 passed, 7 subtests passed in 0.90s
python -m compileall -q make_game.py tools tests clean

Review: I read the new keep_recorded_fallback() / recorded_fallback_flags() (make_game.py:955-971), the probe wiring in main() (make_game.py:1689-1706) and the flag comparison in shaders() (make_game.py:816-822). The kept flag goes into fallbacks before both preflight() and shaders(), and only a None probe answer keeps a flag already recorded in translator_flags.txt, so a definite answer still decides and the other fallback flags behave as before. Run against the merge-base make_game.py (f847748), the new tests give the 3 failures and 1 error the description reports, so they test the change. A trial merge with #3484 (which also edits translate() and this test file) is clean, and the merged test file passes (26 OK). Vonsek's second check already covered the real main()/shaders() path and the interrupted-translation case; the one side effect, a hand-passed --pc-tail-ubo or --f16-interp-fallback that stays on while the probe can't answer, is stated in the description for the first flag and applies equally to the second (make_game.py:1689-1696).

AI-assisted (Claude Code); I checked the results.

@sds-228 sds-228 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.

Code review of a82f814: no issues found. A probe with no answer now keeps only the two automatic flags actually recorded in translator_flags.txt; an answered probe still decides, and a folder translated without a flag gains none. The added cases cover both flags independently, the no-flag baseline and an unrelated user flag. Code read only.

AI-assisted (OpenCode).

@ItsNotRexed
ItsNotRexed merged commit 6998994 into ItsNotRexed:main Nov 23, 2026
2 of 4 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.

5 participants