Repository navigation
Port upstream #368: lower buffer_gl0_inv and buffer_gl1_inv as no-ops - #36
Merged
DesertGamer merged 1 commit intoNov 25, 2026
Merged
Conversation
buffer_gl0_inv and buffer_gl1_inv name a buffer but read no descriptor, so resource tracking refused them before lowering. Skip descriptor tracking for _inv buffer instructions and lower the pair to nothing, as the existing scalar cache instructions already are. Add a synthetic full-pipeline test. (cherry picked from commit f47ebd8)
2 of 23 tasks
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.
What this changes
This ports Marvisak/VIctory#368 by quaternion. It is cherry-picked with
-x, so the commit keeps their authorship.buffer_gl0_invandbuffer_gl1_inv(MUBUF 0x71 / 0x72) are cache-invalidation hints. They use the MUBUF encoding, but they name no descriptor that is read.resource::trackstill treats theirsrsrcfield as a descriptor, so a shader containing one is refused before lowering:D3D12 already keeps UAV writes coherent across waves and dispatches, and the surrounding
s_waitcnt/s_barrierare lowered. So upstream treats these two instructions likes_gl1_inv/s_dcache_inv: no descriptor tracking, and no DXIL.VIPort has the upstream merge of #368 in its history, but the change is not in the tree. It was lost in a later merge.
The change:
resource.rsskips descriptor tracking for_invbuffer instructions.emit/lower.rsreturns early forbuffer_gl0_inv/buffer_gl1_inv.buffer_cache_invalidations_lower_as_no_ops.In this tree, the
resource.rshalf alone makes the test pass. With only the lowering half removed, the test still passes. The early return inbuffer()keeps those names away from the load/store path, which would otherwise refuse them by name.Checked
docs/asset-policy.mdbuild.rs, git hook,.cargoconfig, CI change or script (or an issue explains why)cargo test --workspacepasses (onlyviport-shader --libon Linux, see below)cargo clippy --workspace --all-targets --locked -- -D warningspasses (forviport-shader, with CI: clear the clippy errors that keep main red since a3e7f17 #21 merged in locally)rustfmt; I did not reformat lines I did not changeWhat I ran
On Linux, Rust 1.98.1:
echo "0x00,0x00,0xc4,0xe1,0x00,0x00,0x00,0x00" | llvm-mc --disassemble -triple=amdgcn -mcpu=gfx1030printsbuffer_gl0_inv, the test's first word.cargo test -p viport-shader --lib --locked: 191 passed, 0 failed, 3 ignored.resource.rsas onmain,emit::lower::tests::buffer_cache_invalidations_lower_as_no_opsfails with the error above.cargo clippy -p viport-shader --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings: clean with CI: clear the clippy errors that keep main red since a3e7f17 #21 merged in.Not run: on a GPU. No DXIL is emitted for these two instructions, so the translated program is the one it would be without them.
Overlaps
#27 moves the
lower.rsunit tests intoemit/lower_tests.rs. If it lands first, the one new test moves with them, and I will rebase. No other open PR touchesresource.rs.🤖 Generated with Claude Code