Shaders: model v_permlane16_b32 in whole-wave sections #98
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/98"
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?
Imported from Marvisak/VIctory. Originally posted by tedin7 on 2026-11-24T00:28:00Z.
What
Why
Tested
Linux x86_64 only, synthetic code words (assembled with llvm-mc gfx1030), no game files:
Not run: Windows runtime, any GPU, the HLSL diff tests.
Not touched: console_lanes in lower.rs does not list v_permlane* (it lists ds_swizzle, permute, v_mbcnt, v_readlane, DPP). Left alone to keep this to one change.
upstream-sync referenced this pull request2026-11-24 06:53:02 +00:00
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T00:36:35Z.
Tested
f468457stacked on #39 on Arch Linux x86_64, rustc 1.98.1: pass.cargo test --workspace: 155 passed, 0 failed, 3 ignored; merge with #39 clean.#[test]for the whole-wavev_permlane16_b32section modelling, included in that run.AI-assisted (DeepSeek V4.1 Flash coding agent).
Imported from Marvisak/VIctory. Originally posted by lordon1a on 2026-11-24T00:51:51Z.
Verified
f468457a1on Windows 11 (x86_64-pc-windows-gnullvm,rustc 1.100.0, applied cleanly tomain@4c0bb89): pass.cargo xtask policy: 151 files okcargo test -p victory-shader -- --skip v_med3_f32_matches_rdna2_with_nan: 69 passed, 0 failed.AI-assisted.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T09:37:28Z.
Review: APPROVED
Tested
f468457on Windows 11, RTX 5070, MSVC: the workspace passes (170 outsidevictory-shader;victory-shader --libsingle-threaded: 58; older base).victory translate <title exe> --validate --pipelinesgives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines.v_permlane16_b32picks within the lane's own row (l & !15) andv_permlanex16_b32from the other row of its half. Both pick with nibblel & 15of{src2, src1}, which is the RDNA2 definition.exec == allis the right fix and also tightens the existingpermlanex16arm. With inactive lanes, what a lane reads depends on FI and BOUND_CTRL, so leaving itUnknowninstead of guessing is correct.NoneintoActive(AddU).No issues found.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-24T17:44:46Z.
Measured on real data. I merged this PR onto main
ffe310eand ranvictory translate --validate --listovershaders.rpffrom a retail 1.0.2.1 dump, then compared the result with main program by program. This is part of the offline benchmark in #1247.29 compute programs that translate and validate on main stop translating with this PR. All 29 now fail with:
That reason covers 5 programs on main and 51 with this PR. The PR gains no programs on this data.
The unit tests pass, as the earlier comments say. The failure shows up only on the title's own code: the new modelling makes the whole-wave simulation refuse sections that it accepted before. Shader names and code are not included, per the asset policy. I can check a revised version against the same data.
upstream-sync referenced this pull request2026-11-24 19:03:41 +00:00
Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-24T23:05:40Z.
Follow-up on main's new head
70564ae, with the same method (victory translate --validate --listonshaders.rpf1.0.2.1, dxil.dll 1.8.2502, compared program by program). Merged onto70564ae, this PR stops 44 compute programs that validate there from translating. That is up from 29 onffe310e. All 44 now fail with:It gains no programs. As noted on #1247, the losses disappear in
integ/nextonly where this change was hand-merged with #439'semit/wave.rs. On top of #223, #233 and #320 alone, the losses remain. Offline counts only; no program names or data.Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-25T00:24:49Z.
For the maintainers, alongside the triage above: the head it reviewed (
f468457) is the head I measured offline, and it loses programs on the title's shaders. Merged onto70564aeand compared program by program (victory translate --validate --list,shaders.rpf1.0.2.1, dxil.dll 1.8.2502), 44 compute programs that validate on70564aestop translating. Onffe310eit was 29. They all fail with "a whole-wave section step the simulation does not follow", and the PR gains no programs.The triage's behaviour note is the likely cause:
v_permlanex16_b32now gives an unknown result when EXEC is not full. Sections the simulation followed before therefore become unknown and are refused. The unit test only covers the full-EXEC case, so it passes. Keeping the previousv_permlanex16_b32behaviour for partial EXEC, and addingv_permlane16_b32only alongside it, may keep the new opcode without the losses. That's a guess from the note; I haven't tested it. Details are in the comments above and in #1247.Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-25T00:30:21Z.
Tested the guess above: it holds. On
70564ae+ this PR, I changed one line inemit/wave.rs, so that the full-EXEC condition applies only to the newly modelledv_permlane16_b32andv_permlanex16_b32keeps main's behaviour:Result, program by program over
shaders.rpf(1.0.2.1, dxil.dll 1.8.2502):70564ae70564ae+ this PR as is70564ae+ this PR + the line abovepermlane16_reads_the_lanes_own_rowstill passes, as do the otherwavetests, on an RX 7900 XTX.The PR's reasoning, that
fi/bound_ctrldecide what an inactive lane reads, may well be right for both opcodes. If so, the stricter rule forv_permlanex16_b32is a separate change from addingv_permlane16_b32, and it costs 44 programs on this title. It might be better split out, perhaps decoding the opsel bits instead of refusing outright. Offline counts only; no program names or data.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:24:22Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/wave.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.