WIP: fix(vk): the switch table has a row for every switch the game reads, the translator's EDEN_ ones and four more #2143
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2143
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:fix/switch-table-misses"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
gpu/vk/switches.defis meant to list every switch the game reads, andtests/test_switch_table.pyholds it to the source. The check only saw"RX_…","HOS_…"and"LONGSHOT_…"strings in the C ofgpu/,host/andnx2/, so 14 switches the game reads had no row, and the start's "switches set" log line never named them:EDEN_switches (EDEN_NX2_GM_LEGACY,_GM_SPLIT,_GM_PORT_PROGS,_TENSOR,_LOCAL_ZERO,_UNDEF_ZERO,_GM_INLINE,_GM_NATIVE,_GM_COMPETING,EDEN_F32_ADD_TRACK), all in the program cache's stamp;NVN_NO_POOL(host/nvn_native.c),A64_SITE_PROFILE(the lifter's runtime,third_party/a64-kit/rt);RX_ASTC_THREADS(suyu's ASTC decoder, built into the game);HOS_NO_FASTFP, read by the Cnx2/fastfp.pywrites into the lifted game.This adds the 14 rows, each written from its read. The check now also reads:
EDEN_,A64_andNVN_, besideRX_,HOS_andLONGSHOT_, aslongshot_env.txtalready takesEDEN_andNVN_;getenvin the C a build script writes.A name of no family read on a line that reads the environment fails too, unless the check lists it:
CRASH_TEST_CURL, only in the crash dialog's test build.The start's report names the new families' switches when set. An
EDEN_orNVN_name that is no switch is said as a likely typo. An unknownA64_name is passed over, as an unknownLONGSHOT_one is, because the lift'sA64_build switches are often still set where the game starts.switches.defandswitches.hare no translator sources, so no program cache moves.On main: start the game with
NVN_NO_POOL=0 NVN_NOT_A_SWITCH=1. The log'svk: switches setline names neither.Overlaps:
gpu/vk/switches.def) set out to make the same list inhost/switches.def; main's table and its check have since done that, and this PR completes it.longshot_env.txttakes inhost/hos_main.c, which already takesEDEN_andNVN_. This PR doesn't touch that list.Read first:
tests/test_switch_table.py(FAMILY_NAMES,THIRD_PARTY_IN_GAME,OUTSIDE,NOT_IN_GAME,literals()),gpu/vk/switches.h(ours,listed_family), the 14 rows.This is the first step of making switches change during a run, so many can be tested in one run (claimed in #agent-updates): first, the table lists every switch.
Testing
Tested: Windows 11, RTX 3080 (NVIDIA 621.14), from the
kokiri-startsave with Skip title screen, through the PC's job queue. Both runtimes were made over main971f77f52's base: main's alone, and one with this branch's pack and the stamp PR's change beside it (fix/translator-stamp-env, a separate code path). I setNVN_NO_POOL=0(its default behaviour),NVN_NOT_A_SWITCH=1andA64_FASTFP=1(a lift build switch), and ran to the 900th present.vk: switches set (5): HOS_AUDIO=0 (kill), …, LONGSHOT_BUILD_NAME=…. NoNVN_line.vk: switches set (6): …, NVN_NO_POOL=0 (kill);vk: NVN_NOT_A_SWITCH is set, and is not a switch of this build: a misspelt name, or one from another build;A64_FASTFP.tests/test_switch_table.pypasses (767 rows). With main'sswitches.defit fails and names the 14 with their reads.host/nvn_native.c(env_on("ZELDA_PLANTED_SWITCH")) fails it.ours/listed_familyfor the new families, anA64_switch said and anA64_build name passed over, and anEDEN_name that is none.tests/run_all.py, llvm-mingw, both PRs' commits together): 770 passed, 108 failed, 59 skipped. Main971f77f52on this PC: 767 passed, 112 failed. No check failed here that passed on that main. Main's #2171 has since repaired many of its checks, so this comparison is against971f77f52only; the suite has not run on current main.1101b6127e's own push too (the guide's review hashes for menu files main changed); not this PR's.Still to test:
HOS_NO_FASTFP=1(one of the new rows; the farm sets onlyRX_VK_,HOS_andLONGSHOT_names, so not theNVN_ones), expecting the build to pass and the start's log to sayvk: switches set (…): …, HOS_NO_FASTFP=1 (kill)(@Beanstalk)Measurements
Nothing to measure: a table, its check and one start-up log line; nothing that runs during play changes.
Risks
A run that sets an
EDEN_orNVN_name that is no switch gets a log line saying so. Nothing else changes for a player: no cache, no option, no default. Reverting is enough.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.gpu/vk/switches.def.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, RTX 3080, NVIDIA 621.14, from the kokiri-start save to the 900th present, over main 971f77f52's base. With NVN_NO_POOL=0, NVN_NOT_A_SWITCH=1 and A64_FASTFP=1 set, the start's report names NVN_NO_POOL=0 (kill) and says NVN_NOT_A_SWITCH is no switch of this build; A64_FASTFP is passed over. Main's report names neither.
Possibly related, for context:
@Beanstalk Linux, any GPU: build this PR and start the game once with NVN_NO_POOL=0 and NVN_NOT_A_SWITCH=1 set, then quit. Expecting the build to pass and the start's log to say
vk: switches set (…): …, NVN_NO_POOL=0 (kill)andvk: NVN_NOT_A_SWITCH is set, and is not a switch of this build.Beanstalk test farm · ⛔ can't be tested as asked
Commit
fc52f0b· approved by dyst (untrusted) · dashboardNot run: the farm can't test this as asked, so nothing is built or run:
What it could test instead: The alternative plan builds main and the pull request on Linux, then starts each once at the title screen. It checks for a crash but cannot verify the requested switch-report lines because those environment variables cannot be set by the farm. The game runs take roughly 10 minutes per tester, excluding builds.
A member of
BigBeanscan comment@Beanstalk <new words>to ask for something else, or@Beanstalk test it anywayto run the plan regardless.The 14 rows are right, and the read check is complete on current main once its order is fixed — but the PR is not on current main, and the rebased
tests/test_switch_table.pyfails on current main's ownswitches.deforder, not on this PR's rows.Strongest finding: the PR is based on
971f77f5, while the PR's declared base isa2dc5385. The head's table has 767 rows; current main has 788 (35 more, 21 of themSWrows). Ona2dc5385+ this PR,tests/test_switch_table.pyfails:and after moving that pair, the next is
RX_VK_HALF_RATE_SHADING comes after RX_VK_SIM_TURF_POOLS. The culprit is #2093 (1885234b), which insertedRX_VK_SIM_TURF_ADAPTIVE/RX_VK_SIM_TURF_POOLSahead of names that sort beforeSIM; the sort check already exists on main, so this is a current-main failure the rebase exposes. When I sorted the 802SWrows, the test passed: 802 rows, 810 names read — so the 14 new rows plus current main's 35 rows are all covered by the source; only the order blocks it. Rebasing and moving theRX_VK_SIM_TURF_*rows into place (here or in a prerequisite, since this PR is the table) is enough; the "on current main"/"767 rows"/"mise run testpasses" claims are on971f77f5.The 14 rows. On the head,
tests/test_switch_table.pypasses (767 rows, 775 names read). The tenEDEN_rows are read in the Eden translator,NVN_NO_POOLinhost/nvn_native.c,A64_SITE_PROFILEinthird_party/a64-kit/rt/a64_rt.c,RX_ASTC_THREADSin suyu's texture decoders, andHOS_NO_FASTFPinnx2/fastfp.py's emitted C; the test finds each.switches.h'sours()/listed_family()and the fixture'sEDEN_typo,NVN_typo,A64_switch-vs-build-name andNOT_IN_GAMEcases behave as the PR says. The rows' kinds (kill/attempt/diag/hw) match the reads; theEDEN_atoi"=onis off" caveat is written down.Name ordering. The 14 are in the right blocks:
A64_beforeEDEN_beforeHOS_,NVN_NO_POOLbeforeRX_,HOS_NO_FASTFPbetweenHOS_NO_DAV1DandHOS_NO_HANDOFF,RX_ASTC_THREADSbeforeRX_NVN_TEXELS_LOG. The current-main disorder is #2093's, not these.Completeness claim / ways a switch can still slip. The check is good for the 14 and the current families, but its coverage is a manual path list, not the build's source list:
THIRD_PARTY_IN_GAMEnames only suyu's texture decoders and the lifter runtime. The suyugpu/third_party/suyu/shader_recompilercopy has sevenRX_reads not in the table (RX_CBUF_CLAMP,RX_DEBUG_VS_NONFINITE,RX_EARLY_Z_ATTR,RX_NO_D16_DREF,RX_NO_DREF_CLAMP,RX_NO_GATHER_NUDGE,RX_STRIP_CONDITIONAL_BARRIERS). They are not game reads today —nx2/build.pycompiles onlyvideo_core/textures/{decoders,astc}.cpp, and Eden's recompiler is the one built — but if that build fact changes they are read and unlisted. The check should say it trusts the build's source list, or derive it.third_party/a64-kit/lift/suyu/arm64_to_c.h) emitsgetenv("SUYU_RECOMP_FPX_SHADOW_LOG")andgetenv("SUYU_RECOMP_STRICT"), but neither is a game read today:a64_configsetsg_emit_fpx_shadow = false, so the shadow variant is never emitted, andSUYU_HOSTED_RECOMPis not defined for the game. They are the emitter's/recomp module's; no rows needed. A future shadow build would make the first a game read and the check would miss it.BUILD_DEFINEscans onlynx2/build.py; anothernx2/*.pythat hands a C file a-DNAME="RX_..."that the Cgetenvs (asbuild.pydoes withPGO_ENV) is missed.EMITTED_GETENValready scans everynx2/*.py; extendBUILD_DEFINEthe same way. The current-Duses outsidebuild.py(LONGSHOT_SPLIT_GIANTS,LONGSHOT_VERSION,ZSTD_ZBIC_SUPPORT) are build flags, not switch reads.strangerscheck is per line: a read of a new family split across lines (getenv(on one line, the literal on the next) or through a non-literal name is not seen; a whole literal of an existing family is always seen byLITERALregardless of the call. ThePREFIXESlist covers the dynamic existing-family prefixes; a future family has to be added toFAMILY_NAMESandswitches.h'sours/listed_family, which is the same manual step as this PR.Generated table vs
switches.def. Consistent:switches.hfind()/report()over the.defand the fixture's new-family cases pass; no generator or hand-edited generated file is involved. The.defis the source and the test parses it.What remains. Rebase onto
a2dc5385; move #2093'sRX_VK_SIM_TURF_*rows into order (this PR or a prerequisite); runmise run teston current main, not971f77f52; the Linux build/start withHOS_NO_FASTFP=1in Still to test; and decide whether to hardenTHIRD_PARTY_IN_GAME/BUILD_DEFINEor leave them as the documented manual lists. I could not run the game; the head's table and check are complete for what the game reads today.No approval, no claim.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.