fix(shader): preserve uniform MUFU source modifiers #2865
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2865
Loading…
Reference in a new issue
No description provided.
Delete branch "futondestroyer/Longshot:codex/mufu-uniform-modifiers-wip"
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
Preserve absolute value and negation on Ampere
MUFUwith a uniform-register source. The C++ lowerer previously emitted the same source forMUFU.RCP -UR4andMUFU.RCP UR4. Use the existing Maxwell modifier fields for operations that lower to one word, and apply the modifiers before converting turns to radians for SIN and COS. The one-word reciprocal still accepts high destination registers.Start at
gpu/vk/eden/shader_recompiler/frontend/ampere/lower_to_maxwell.handtests/test_lower_mufu_uniform_modifiers.py. Gummi reported the missing modifier. Mesa's Ampere encoderTesting
Tested: Windows with an RTX 4070 and NVIDIA driver 621.01. The exact renderer pack at
eb2bff03, based on9b342b46, loaded through renderer ABI 56. With shaders compiled on demand, the disposable Kokiri Forest checkpoint stayed in play for 240 presents and quit cleanly. The authored checks isolate the shader bug.The authored regression failed on
9b342b46and passed oneb2bff03with Clang and GCC. It covers reciprocal, absolute value, negative zero, predicated sine before scaling, and a reciprocal targeting R251. The test rejects the superseded multiword lowering of the high-register reciprocal. Independent source review verified both exact maps and found no remaining issues.The matched
tests/run_all.py --strict --jobs 4 --timeout 1200runs on the previous base53ab0cebfinished with 815 passes, 47 failures and 47 skips on main. The patch had 816 passes, the same 47 failures and the same 47 skips. The additional pass istests/test_lower_mufu_uniform_modifiers.py.Shared failures in
tests/:test_auto_handheld.py,test_bug_report.py,test_builder_channel.py,test_control_picture.py,test_coverage_run.py,test_crash_record.py,test_crt_options.py,test_dev_ab.py,test_dev_build.py,test_dev_migrate.py,test_dev_packs.py,test_dev_update.py,test_framegen_hdr.py,test_framegen_resources.py,test_fs_path_utf8.py,test_image_view_retry.py,test_input_background.py,test_keyboard_menu_option.py,test_keyboard_option.py,test_lifter.py,test_linux_pressure.py,test_loaded_modules_drop.py,test_log_batch.py,test_log_levels.py,test_menu_keys.py,test_mods_list.py,test_oot_menu_mouse.py,test_oot_state_tap.py,test_option_ids.py,test_parity_gates.py,test_perf_send.py,test_present_source_crop.py,test_program_cache_cleanup.py,test_program_cache_one_variant.py,test_program_cache_store_record.py,test_run_all_mingw.py,test_screensaver.py,test_switch_table.py,test_temporal_present_bandwidth.py,test_text_keyboard_policy.py,test_upscaler_round_trip.py,test_vcore_video_acquire.py,test_video_catchup.py,test_video_hold_early.py,test_video_input_limit.py,test_windows_display_startup.py,test_windows_on_linux.py.Review follow-up
efdb748cmakes the standalone fixture useCXXas its default. Clang and GCC each pass when selected throughCXX, and an intentionally missing compiler distinguishes the new behavior from the former Clang fallback. Explicit--cxxstill wins, and the PATH fallback works whenCXXis unset. Ruff passed. The compiler-selection commit changes only the fixture. The gameplay run above remains pinned to its original renderer pack.The follow-up integrates cleanly with official main
55773e36at tree3a371799. The fixture reproduced the missing negate on exact main with both compilers and passed on that integration tree. The integration intoc18c0011previously kept the shader inputs byte-identical and passed the async ASTC upload, ASTC chunking, and draw-stream visibility checks.The affected Windows checks on the published base had 131 passes, 7 failures and 9 skips. The patch had 144 passes, the same 7 failures, and the same 9 skips. The two timing-sensitive outliers on the intermediate full MUFU run both passed a serial retry.
On integration base
3b18a4a9, the authored regression again failed on main and passed on prospective head8b735a50with Clang and GCC. The eviction-retirement and SIEVE/size-class fixtures passed on main and this integration.test_vram_compact.pyreports the same existingtexture_frame()source-pattern mismatch on both.Historical CI on
eb2bff03failed Rust, Guide, Website, and both Linux game-free shards. All 34 failing Linux fixtures matched the first diagnostics on the sibling shader and Builder PRs. The shared Windows main comparison reproduced all 54 Builder-head failures on28cb22b9. That comparison is Windows evidence. The newer sibling Linux run passed Rust after the upstream lint fix. Exact pinned-main CI was still pending at this update.Still to test:
Measurements
Correctness fix. For
RCP -UR4withUR4 = -2.0, main feedsc0000000to MUFU and the fix feeds40000000. For a negated zero source, main feeds00000000and the fix feeds80000000.Risks
Changed behavior is scoped to Ampere MUFU's uniform source form. The C++ frontend's shader stamp includes the affected source, which refreshes generated shader caches with the normal preparation path. The test covers operand words and guards with authored instructions. Hardware precision and broader scene coverage depend on the device and game run.
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.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Windows, GeForce RTX 4070, NVIDIA driver 621.01, renderer ABI 56. Exact pack
eb2bff03on base9b342b46entered Kokiri Forest, rendered 240 presents in play with on-demand shaders, and quit cleanly.WIP: fix(shader): preserve uniform MUFU source modifiersto fix(shader): preserve uniform MUFU source modifiersRecommendation: Approve. The authored regression demonstrates the lost uniform-source modifiers and the fix preserves them in the reviewed lowering paths. Rendering coverage is still needed on affected Tier 1 systems, and the head CI checks are pending. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
Preserves absolute-value and negation modifiers on uniform sources to Ampere MUFU instructions, including applying them before sine and cosine scaling. Non-trigonometric operations remain single-word; modified trigonometric sources require additional lowering instructions.
Should fix (1): not blocking, but worth doing before merging.
tests/test_lower_mufu_uniform_modifiers.py:104: The standalone test ignores the CXX environment variable when choosing its compiler. (more on the line) Do: Use CXX as the first default when set, while retaining the explicit --cxx override and compiler fallback.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/eden/shader_recompiler/frontend/ampere/lower_to_maxwell.h:2763: The changed shader lowering has not yet been exercised on the remaining affected Tier 1 systems. (more on the line) Do: Run the Kokiri Forest rendering smoke on AMD RX 6000–9000 on Windows and Linux, Steam Deck, and NVIDIA on Linux; report the hardware, driver and results.@fixcan do L1.Checks: Failing on this head, which is behind its base, where it passes:
CI / Third-party parts and guide screenshots (pull_request).@rebase(or@fix) brings it up to date and runs it again; not held against it. Cancelled on this head (no result):PR description / Title and description (pull_request_target). Still running: 7 checks.More: does it help, other systems, switches, what was read
Does it help: Yes for the authored cases: the PR reports RCP -UR4 changing from input c0000000 to 40000000 and negated zero from 00000000 to 80000000. Its regression reportedly fails on base
9b342b46and passes oneb2bff03with Clang and GCC; broader game rendering remains to be tested.Other systems: The lowering feeds the Maxwell shader translator on all Vulkan devices, so the change can affect NVIDIA, AMD and Steam Deck rendering on Windows and Linux. The reported RTX 4070 Windows smoke ran 240 presents; AMD, Steam Deck and NVIDIA Linux coverage is not reported.
Switches: None added, changed or removed.
Reviewed:
eb2bff032cagainst9b342b464c: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the full diff, both commit messages, the new test, the changed MUFU block, its operand and register-mapping helpers, and the Maxwell MUFU translator. Skimmed the rest of the large lowerer and the test runner; docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No code or tests were run for this review. The PR reports a Windows RTX 4070 game smoke and base-versus-head authored regression runs; the listed head CI checks are still running.
Overlaps and merge order: Not established from the offline checkout.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as futondestroyer took it out of WIP. Nothing was run; a maintainer decides.
@ -2759,0 +2760,4 @@u64 modifiers = 0;if (uniform) {const bool absolute = insn.Bits(62, 1);const bool negate = insn.Bits(63, 1);L2 (should fix): The changed shader lowering has not yet been exercised on the remaining affected Tier 1 systems.
When: Shaders using these uniform MUFU forms can produce different translated operations on AMD and Linux devices, but the reported game smoke covers only NVIDIA on Windows.
Do: Run the Kokiri Forest rendering smoke on AMD RX 6000–9000 on Windows and Linux, Steam Deck, and NVIDIA on Linux; report the hardware, driver and results.
@ -0,0 +101,4 @@def main():parser = argparse.ArgumentParser(description=__doc__)parser.add_argument("--cxx", default=shutil.which("clang++") or "g++")L1 (should fix): The standalone test ignores the CXX environment variable when choosing its compiler.
When: On a machine with both compilers, running the test with CXX=g++ still selects clang++ if it is on PATH, so the requested GCC check actually tests Clang.
Do: Use CXX as the first default when set, while retaining the explicit --cxx override and compiler fallback.
Addressed BeanBot’s compiler selection finding in
efdb748c. The standalone fixture honorsCXX, with the explicit--cxxoverride and the original fallback preserved.Clang and GCC passed on the follow-up and on the clean integration with
55773e36. Both reproduced the lost modifier on that exact main baseline. The isolated compiler-choice check reproduced the former ignoredCXX, and Ruff passed. The reviewed shader change is byte-identical toeb2bff03, so the existing Windows RTX 4070 receipt remains pinned to that renderer pack. The remaining Tier 1 runs are listed under Still to test.@review
Recommendation: Approve. The code is ready: only testing is left. The fixture now honors CXX, and the shader fix preserves the tested uniform-source modifiers. The remaining Tier 1 rendering runs and successful head CI are still needed before merge. Recommend approval; not approved on the forge.
The change preserves absolute value and negation for uniform MUFU sources, including before sine and cosine scaling. It adds a focused regression fixture and keeps the one-word reciprocal lowering for high destination registers.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/eden/shader_recompiler/frontend/ampere/lower_to_maxwell.h:2763: The changed shader lowering has not yet been exercised on the remaining affected Tier 1 systems. When: Shaders using these uniform MUFU forms can produce different translated operations on AMD and Linux devices, but the reported game smoke covers only NVIDIA on Windows. Do: Run the Kokiri Forest rendering smoke on AMD RX 6000–9000 on Windows and Linux, Steam Deck, and NVIDIA on Linux; report the hardware, driver and results.Since the last review (on
eb2bff032c)Resolved: L1 (The standalone test ignores the CXX environment variable when choosing its compiler.)
Still open: L2 (The changed shader lowering has not yet been exercised on the remaining affected Tier 1 sy…)
Checks: Cancelled on this head (no result):
CI / What the change needs (pull_request),CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request),CI / Third-party parts and guide screenshots (pull_request),CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request),CI / Host C for Windows (llvm-mingw, compile only) (pull_request),CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request),CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request),CI / Game-free checks (run_all.py, part 1/2) (pull_request),CI / Game-free checks (run_all.py, part 2/2) (pull_request),CI / Website build and checks (pull_request).Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for the authored cases: the reported regression fails on the base and passes with the fix under Clang and GCC. For RCP -UR4 with UR4 = -2.0, the reported MUFU input changes from c0000000 to 40000000; broader hardware behavior remains to be checked.
Other systems: The lowerer can affect shader output across GPU vendors and operating systems. A Windows RTX 4070 gameplay smoke is reported; AMD Windows and Linux, NVIDIA Linux, and Steam Deck runs remain outstanding.
Switches: None.
Reviewed:
efdb748cebagainst9b342b464c: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the full regression fixture, both diffs, and the changed lowering and its materialization and register-mapping context. Skimmed standards and the test runner's compiler selection. The full lowerer was not read; the adjacent Tooling AGENTS.md was unavailable.; nothing run (a code review).Checked and fine:
Testing: No commands or tests from the project were run. The reported Windows gameplay smoke and compiler runs were considered as evidence; the remaining Tier 1 runs are listed in the pull request.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by futondestroyer. Nothing was run; a maintainer decides.