Repository navigation
feat(build): record the CPU flags a build compiled with - #2673
steefzilla wants to merge 3 commits into
Conversation
A finished game could not say which -march it was built for, so nothing later could tell two builds of the same release apart.
The game-free run already builds each define into the job that consumes it. The flag record was only calling the helper and searching the source.
Joey-Magnus
left a comment
There was a problem hiding this comment.
I merged this into current main and ran the full tests/run_all.py: 427 passed, with only test_lift_cache failing, as on main here. tests/test_compile_flags.py and test_cpu_target.py pass. Passing the -D to hos_main.c alone matches how HOOKSHOT_VERSION is done.
Points for the maintainers and you:
- #2608 (JooaoPedro15, opened earlier, now conflicting) implements the same request, #2576, with a JSON file. Only one should land, so someone needs to pick. #2576 itself was closed as a duplicate of #2505, and the reopen request there is unanswered.
RX_CPU_FLAGSis new. It's more than recording: it injects arbitrary flags into every object, lifted code included. nx2/compile_flags.py:22 drops only -I, --sysroot and -ffp-contract, so-ffast-mathor-Ofastwould get through and break the exact float behaviour the lifted code relies on (the same reason contraction is off). I'd either keep it to-m*flags or leave the knob out of this PR.- make_game.py:2368 writes the file from
compile_flags.current(), which re-derives the flags in make_game's process instead of taking what build.py printed. They match today, but a later env tweak in make_game would make them drift silently.
RX_CPU_FLAGS keeps only -m flags, so a float flag cannot reach the lifted code. The game folder copies the line the compile printed, the same line the log shows.
|
Thank you for running the suite and for the notes. Two of them are in e715a35.
#2608 records the same idea and also embeds its text in the binary. Its |
A finished game could not say which -march it was built for, so two builds of the same release could not be told apart.
The build writes that CPU flag list to hookshot_flags.txt and prints it as the log's second line. The list is -march, -ffp-contract=off, an -mtune when one is set, and any extra RX_CPU_FLAGS. Include paths are left out. Reading those flags back on an update is left to #2577.
Tested with the game-free unit tests, then a full Linux build (i7-11700KF, RTX 3080, driver 595.99.02, Ubuntu 24.04) into a separate folder. The log printed
-march=rocketlake -ffp-contract=off -mprefer-vector-width=256, hookshot_flags.txt matched, and the game was played with DLSS on.Fixes #2576
Summary
Test plan
python3 -I -B tests/test_compile_flags.pypython3 -I -B tests/test_cpu_target.pyMade with Cursor