Repository navigation
fix: lower signed 16-bit VOP3 add and subtract in VIctory - #331
Open
mauroalvare wants to merge 4 commits into
Open
mauroalvare wants to merge 4 commits into
mauroalvare wants to merge 4 commits into
Conversation
Lower v_add_nc_i16 and v_sub_nc_i16 using the existing half-register paths. Mask the result before the saturation selects so the preserved half of VDST stays intact on NVIDIA. Cover all source and destination half selections with and without clamp. The mask-before-select workaround was proposed by upipibi in review. Source: Marvisak/VIctory #2094 (48590903d4ce14cb3c1d2e9de12b86339ce8dd48) Co-authored-by: 给伊莉雅补魔 <98532177+geiyiliyabumo@users.noreply.github.com>
7 of 12 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Neptune decodes
v_add_nc_i16andv_sub_nc_i16, then rejects them as unsupported before producing DXIL.tools/lancer_victory.ps1builds the runtime whose GPU pipeline callsvictory_shader::emit::translateand this VALU lowering.Lower both instructions through the existing
half_srcandwrite_halfpaths with wrapping results by default and signed saturation withclamp. For clamped results, mask the in-range value before selecting the 16-bit saturation pattern. This keeps the other VDST half intact when NVIDIA folds the arithmetic. The code adapts the signed i16 part of VIctory #2094, with upipibi's mask-before-select workaround.Verification
Base
c4c93bdc413191a9dc909998d2d53080a3f0c880, fix319c35861246d4725dc306fb9702fc2d8be3ab9e.From
third_party/victoryon Windows:lower: Unsupportedat offset 40, naming the respective instruction.cargo test --locked --offline -j 2 -p victory-shader -- --nocapture --test-threads=1cargo test --locked --offline -j 2 -p victory-loader --test load_probecargo check --locked --offline -j 2 -p victorycargo xtask policycargo build --release --locked --offline -j 2 --manifest-path rust/Cargo.tomlcargo test --release --locked --offline -j 2 --manifest-path rust/Cargo.tomlpython -m pytest -q tests/test_rdna2_exec_int16.py -k 'v_add_nc_i16 or v_sub_nc_i16'python -m pytest -rspython -m ruff check --select W605,F,E9 PrototypeScarlett tests toolsThe full shader run also reported four optional compiler-dependent skips, one WARP pipeline skip, and one hardware wave test whose pipeline the device did not accept. The two focused tests had zero skips. Pytest used Python 3.13.15,
ANYXBOXX_REQUIRE_RUNTIME=1, and the existing native runtime and TomBox binaries.Oracle and test data
The shaders are assembled from repository helpers. Each expected dword combines the untouched half of a preset destination with the exact signed sum or difference, narrowed by wrapping or saturation. The interpreter fixtures in AnyXboxX #232 independently cover these rules. Section 6.5 of the AMD RDNA 2 ISA guide defines integer clamp. LLVM 20.1.8 selects these clamped opcodes for GFX10 signed saturation. Signed add · Signed subtract
Checklist
THIRD_PARTY.mdand the commit.AI assistance by Codex for the port, regression tests, and Windows validation.