fix(vk): map global loads across the reserved register boundary #2179
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
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2179
Loading…
Reference in a new issue
No description provided.
Delete branch "nachochee3e/Longshot:fix/203-vector-load-register-boundary"
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
Fixes #203. In frozen Zora's Domain as Adult Link, look down from the stairs at the snow-covered rocks around the round pedestal. Parts of the rocks flash pink and green.
The mesh shader loads four registers starting at R204. Its reserved range begins at R206, so the upper two values must go to extended registers 462 and 463. The Ampere-to-Maxwell translator checked only R204 and skipped the register map. This applies nachochee3e's fix to check every destination a global load writes. Original patch and in-game comparison
Testing
Tested: On November 22, I checked the rocks around the round pedestal in frozen Zora's Domain as Adult Link. They flashed pink and green on
main(a2dc538) and looked correct on PR #2179 (5888b3a). Both runs used native mesh shaders on Windows with an RTX 4070 SUPER and NVIDIA driver 621.14.I repeated the comparison using copies of the same adult save and a scripted camera tilt. On
a2dc538, the rocks at Link’s feet showed pink and green patches. On5888b3a, they kept their snow shading with native mesh shaders and withRX_VK_MESH_SHADERS=compute. The renderer log confirmed the compute path, and the rocks kept their color in four frames sampled during a camera pan. Matching screenshots on the current buildsThe game-free register-map regression now covers register-address and uniform-address global loads. I compiled the same test at
62dd3d9against the headers from both revisions using LLVM-MinGW Clang and MSVC on Windows. Both 128-bit cases failed on main (a2dc538) and passed on the PR, where one prefix covers R206–R207. All four 32-bit and 64-bit controls passed on both revisions. The strict Windows runner also passed the updated test. Commit62dd3d9changes only the test. The in-game comparisons above used the same renderer code.I also ran both translator revisions locally on the full mesh shader from the report,
bc3f20d8b42b27c1. At byte offset0x81b0, main emitted no register-map prefix. The PR emitted a single run mapping R206–R207 to extended registers 462–463.The patch author's earlier in-game run on this PC used the nightly-411 Vulkan renderer, a nightly-407 host, and the same manual save for both captures. On Windows 11 with an RTX 4070 SUPER, driver 621.14, and native mesh shaders, the patched renderer restored blue-white shading and the rocks retained their surface detail. The patch in that comparison is byte-for-byte identical to the supplied attachment. Before and after
The strict Windows checks selected for the changed files passed 16 of 17. The same failure reproduced on untouched main:
test_lower_atomg_cas.pyexpects the IR opcode table to have a literal size of 544, while main declares it withNUM_OPCODES.Across the full strict Windows suite and its reruns, 844 checks passed, 58 failed, and 50 were skipped for this platform. All 58 failures also reproduced on untouched main and are listed below. The last outstanding check,
tests/test_job_queue.py, passed in 4.3 seconds at5888b3awhen run in its own Windows process group with localhost ping available. In the restricted runner, the same fixture errored on both revisions because its temporary ping process exited before the test could find it. The control-bridge test passed on an isolated rerun after a temporary log-file sharing error. The no-GPU startup fixture passed using an ASCII-only temporary directory in the workspace.Checks that also failed on main
nx2/test_import_windows.pynx2/test_nup_codec.pynx2/test_nup_paths.pynx2/test_nup_read_name.pynx2/test_nup_stand_in.pynx2/test_nup_verify.pytests/test_auto_handheld.pytests/test_build_long_paths.pytests/test_close_waits_for_save.pytests/test_compile_zero_byte.pytests/test_control.pytests/test_copy_writable.pytests/test_crash_dialog.pytests/test_damaged_rom_files.pytests/test_dev_ab.pytests/test_dev_build.pytests/test_dev_migrate.pytests/test_dev_packs.pytests/test_dev_update.pytests/test_discover.pytests/test_draw_stream_visibility.pytests/test_fs_save_commit.pytests/test_fsr3fi_hud_layer.pytests/test_fsr3fi_hudless_colour.pytests/test_fsr_uniform_ownership.pytests/test_game_menu_mouse_buttons.pytests/test_guest_copies.pytests/test_hold_toggle.pytests/test_input_movie.pytests/test_insn_fixed_convert.pytests/test_lift_lookups.pytests/test_linux_preflight.pytests/test_long_paths.pytests/test_lower_atomg_cas.pytests/test_make_game_cache.pytests/test_menu_i18n.pytests/test_menu_keys.pytests/test_menu_slider_ends.pytests/test_native_zstd.pytests/test_options_path.pytests/test_pads_after_menu.pytests/test_perf_report.pytests/test_pipeline_cache_file.pytests/test_portable_builder_home.pytests/test_portable_builder_startup.pytests/test_prepare_at_build.pytests/test_prompt_guide_lines.pytests/test_prompt_hand_guides.pytests/test_prompt_picture_tint.pytests/test_prompt_speed.pytests/test_recording_admission.pytests/test_sampler_admission.pytests/test_sdiv_overflow.pytests/test_sim_turf_pools.pytests/test_switch_table.pytests/test_tls_objects.pytests/test_vibration_menu.pytests/test_walk.pyStill to test:
Measurements
Verdict: The failing 128-bit load now writes both upper destination registers where the lighting calculation reads them.
a2dc53862dd3d9Risks
Both register-address and uniform-address global loads use this check. Other shaders whose global loads straddle the reserved range can also change. Issue #2243 tracks the local-load case in four depth and shadow mesh shaders and documents the synthetic shared-load case. Updating the translator changes the shader-cache stamp, so the next start rebuilds cached shaders. Reverting the translator change restores the previous behavior.
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.mainand here, for a change that shows on screen. Main and PR capturesAssisted-by:/Co-Authored-By:trailers.Ready to merge
Tested in game: The patch author compared the same save in frozen adult Zora's Domain on this PC using the nightly-411 Vulkan renderer on a nightly-407 host (Windows 11, RTX 4070 SUPER, NVIDIA 621.14, native mesh shaders). The rocks around the pedestal changed from pink and green to blue-white with the surface detail intact. See the comparison in issue 203. The regression was rerun separately on this PR head.
Compared the rocks at the foot of the stairs in frozen Zora’s Domain using the same adult save and downward camera tilt on Windows 11 with an RTX 4070 SUPER and NVIDIA driver 621.14. Look at the rocks on either side of Link’s boots. On
mainthey have pink and green patches. On the PR they keep their snow shading with both native mesh shaders and the compute fallback.Main
a2dc538, native mesh shadersPR
5888b3a, native mesh shadersPR
5888b3a, compute mesh fallbackWith
RX_VK_MESH_SHADERS=compute, the renderer log confirmed that the game used the compute path. The snow kept its color in four additional frames sampled while panning the camera.WIP: fix(vk): map vector loads across the reserved register boundaryto fix(vk): map vector loads across the reserved register boundary@Beanstalk Please compare
main(a2dc538) and this PR (5888b3a) in frozen Zora’s Domain. We still need coverage on NVIDIA RTX on Linux, AMD RX 6000–9000 on Windows and Linux (Mesa RADV on Linux), and Steam Deck.Load adult Link in frozen Zora’s Domain. At the round pedestal by the stairs, tilt the camera down toward the snow-covered rocks on either side of Link, then pan slowly. Please capture the same view on each build and report the GPU, OS, driver, and mesh path used. The regression on
mainis pink and green patches on those rocks. On the PR they should keep their snow shading as the camera moves. The Windows RTX 4070 SUPER comparison shows the location and expected result. Reference screenshots@nachochee3e only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it or to this comment.This request was for5888b3a, and the PR has changed since (62dd3d9), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.Could a maintainer review the vector-load register mapping fix for #203 at
5888b3aand approve the fork workflows so CI can run? The regression test covers a 128-bit load starting at R204 that crosses the reserved boundary at R206. The in-game comparison on Windows shows the snow shading restored on both native mesh shaders and the compute fallback. Comparison screenshotsNine jobs are pending. The Python source-check job in run 48777 says approval is required to run workflows for this fork PR. Please also check the pending Guide screenshots and Third-party parts runs. CI run 48777 · Guide screenshots · Third-party parts
The fix is right for the reported global load, and the new test fails on main for exactly the reported reason — but the same boundary crossing is left in the local and shared vector loads.
The reported bug and the fix.
0x381/0x981(register- and uniform-addressLDG) at R204 with the reserved window starting at R206. The first pass only askedreg >= reserved_base, so R204 looked below the window,any_highstayed false, and the two upper destinations (R206–R207) never went through the register map. The new 2/4-register width makes a 128-bit load at R204 setany_high, so it gets oneREGMAP_nx2prefix for R206–R207 → extended 462–463. That is the reported mesh shader.Red on main, green here. I applied the PR to
a2dc538and compiledregmap_marker_test.cppagainst both headers. With main's header it printsincorrect register map for 128-bit LDG at R204/FAILED; the 32- and 64-bit controls pass. With the PR's header it printsok. The new case fails on main for the bug's reason, not incidentally.The gap (strongest finding).
load_destcovers only0x381/0x981, but0x983(LDL) and0x984(LDS) also write 1/2/4 destination registers, and this file already models them that way (writes_linkaround line 3376, and their size→words lowering). A 128-bit LDL/LDS at R204 with the same UR36 reserved base still takes the oldreg >= reserved_basetest:any_highstays false, no prefix is emitted, and the upper destinations are written as plain R206/R207 — the same reserved window. I lowered both through the PR's header:So "a vector load crossing the reserved boundary" is not fully closed. The title says
vector loads; either extend the width to0x983/0x984(the second loop'sspan_of(204)is already 4, so only the first-loop width is missing) or narrow the title/claim to global loads and file the local/shared case. It is not the reported mesh shader, but it is the same mechanism and the same corruption.Test. Only
0x381is exercised;0x981, which the fix also changes, has no test — add the uniform-address case. The 32/64-bit controls are good; a 64-bit load with an odd reserved base (e.g. 205) would be a second boundary. Add LDL/LDS if that scope is taken.Mapping. No existing mapping is widened unintentionally:
widthis 1 for every opcode other than0x381/0x981, which is exactly the old test, and the second loop still marks only numbers at or above the base. The pre-existing regmap test and both controls pass on the PR.x86-64 / ARM64. The change is pure integer/bit logic with no host conditional, so both hosts lower the same words. Only Windows x86-64 was run (LLVM-MinGW and MSVC); there is no ARM64 build. The Linux/AMD/Steam Deck in-game checks in Still to test remain open, and CI on
5888b3ais still pending (blocked on approval), per the commit status.Already solved? No:
mainstill has the oldreg >= reserved_basecheck, the new test fails there, and no other open or merged PR covers it. #203 is still open.No approval, no claim.
fix(vk): map vector loads across the reserved register boundaryto fix(vk): map global loads across the reserved register boundary@Beanstalk Please repeat the frozen Zora’s Domain comparison for #203 on
main(a2dc538) and the current PR head (62dd3d9). The previous request was tied to5888b3a. The new commit adds a regression test for the uniform-address global load. The renderer code is identical to the version already tested on Windows with an RTX 4070 SUPER.The outstanding configurations are NVIDIA RTX on Linux, AMD RX 6000–9000 on Windows and Linux (Mesa RADV on Linux), and Steam Deck. As Adult Link, stand at the round pedestal by the stairs in frozen Zora’s Domain. Look down at the snow-covered rocks beside Link and pan slowly. Please report whether the pink and green flashing seen on main clears on the PR, along with the GPU, OS, driver, and mesh path. Reference screenshots
@nachochee3e only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.@HumanBean: #203's pink/green rocks fix is ready for the fork CI and a review at
62dd3d9; the earlier ask was for5888b3a.a2dc538, correct on the PR with native mesh shaders and the compute fallback; the new regmap test fails on main and passes here, and the full Windows run had 844 passed, 58 failures all reproduced on main, 50 skipped.62dd3d9. Nine fork-CI checks are blocked pending approval; the Test Farm request is also waiting for a BigBean, separate from this ask.@review
Recommendation: Approve. The code is ready: only testing is left. The reported rock corruption is fixed in the Windows NVIDIA comparison, and the regression test exercises both global-load address forms. The affected Tier 1 configurations and head CI still need results before merge. Recommend approval; not approved on the forge.
Maps the upper destinations of global loads that cross the reserved register boundary, preventing the reported incorrect rock shading. The change adds a small amount of translator logic and invalidates the shader cache.
Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)
Checks: Still running: 9 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes. The PR reports pink and green rocks on main and correct snow shading on the same Windows RTX 4070 SUPER setup with the PR, using both native and compute mesh paths. Its game-free 128-bit cases fail on main and pass on the PR; the 32-bit and 64-bit controls pass on both.
Other systems: The translator is shared across GPUs and operating systems and can change other shaders with global loads crossing the boundary. Windows NVIDIA native and compute paths were tested; Linux NVIDIA, Windows and Linux AMD, and Steam Deck remain untested. Local and shared loads have the pre-existing boundary issue tracked in #2243.
Switches: None added, changed or removed.
Reviewed:
62dd3d97c4againsta2dc538590: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the PR template, both diffs, commit messages, the complete regression test and the changed translator logic and its register-map and load-lowering context. Skimmed the remaining translator file, test runner and register-map consumer. docs/review-checklist.md and ../Tooling/AGENTS.md were absent; linked screenshots and recorded runs were not accessible.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no code or tests were run. Nine head CI checks are pending, and the PR records the Windows comparison and game-free test results.
Overlaps and merge order: No overlapping PR identified in the supplied material; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@Beanstalk
Beanstalk test farm · ⛔ can't be tested as asked
Commit
62dd3d9· approved by llun (untrusted) · dashboardNot run: the farm can't test this as asked, so nothing is built or run:
⚠️ Note: The pan image is uploaded without an automatic comparison because movement can land differently between starts.
⚠️ Note: A large image difference can also reflect the intended fix, so the screenshot rule is not a direct test that the rocks are correct.
⚠️ Note: The farm plan does not run the game-free register-map regression or explicitly verify the native and compute mesh paths.
What it could test instead: The alternative plan compares main and the PR in adult Zora’s Domain and Hyrule Field on the affected NVIDIA, AMD, and Steam Deck configurations. Three starts per side capture stationary images, plus an unjudged image after a camera pan; crashes or large stationary-image differences fail the plan. It takes about 35 minutes per tester, but cannot establish that the specific pedestal rocks have recovered their snow shading.
A member of
BigBeanscan comment@Beanstalk <new words>to ask for something else, or@Beanstalk test it anywayto run the plan regardless.Tested in the game on another GPU: on main the patches are there, and on this PR they're gone.
mainat753fb5afagainstmainwith this PR's head62dd3d9merged. Both were packs over the same base, run through the job queue with no window.kokiri-startsave, switches to adult and teleports toZoraDomain_Adult. Link then walks out to the top of the stairs and the camera tilts down toward the round pedestal. After that he walks down to the foot of the building by the frozen lake. 11 screenshots were taken along the way, and Link's positions matched between the runs to within a few centimetres.In each picture below, main is on the left and the PR is on the right.
The round pedestal by the stairs. On main, the rocks at its base have neon green, cyan and purple patches, and there are magenta specks on the snow beside the stairs. On the PR, the rocks and snow keep their snow shading.
The foot of the building by the frozen lake. On main, the snow has purple and magenta patches with cyan in them. On the PR, the snow is plain.
The other 9 pairs show no other difference beyond Navi and particle noise. Neither run's log has an error, and both games closed cleanly.
This also matches a nightly-755 player report on #1045, whose video shows the same patches on an RTX 5060 Ti. Its log shows the shader
bc3f20d8b42b27c1in use.Still untested from the list in the description: NVIDIA on Linux, AMD on Windows and Linux, and Steam Deck.
Posted by an AI agent (Claude Code) for llun.