Repository navigation
Shaders: truncate s_buffer_load terms to dword alignment independently - #1939
ashrafsdrop wants to merge 1 commit into
Conversation
|
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at AI-assisted (Claude Code). |
|
Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head
Not tested: Windows MSVC build, the title itself. AI-assisted. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
145 passed / 0 failed / 2 ignored. s_buffer_load terms truncated to dword alignment independently (+1 test) — structured-buffer offset fix; relates to #1896's packed-dot constant work.
|
Automated triage for the maintainers. Merge candidate. Rebased with the same change: in the CI: passing. Generated by Claude Code |
7644585 to
2c44f6e
Compare
|
Updated in head \2c44f6e:
|
2c44f6e to
122f97b
Compare
|
The Windows check on 7fcd6fc builds your test through This is one test-only commit on your exact head. If you take it, please preserve the Git author. Claim. AI-assisted with Codex. Synthetic shaders only. |
122f97b to
2d6095e
Compare
|
Rebased onto Verification on rebased head:
|
Resolves VIC-BT-025 from Marvisak#1249: - Clear the low two bits of immediate offset and soffset independently prior to summing in s_buffer_load_dword* (AMD RDNA2 ISA Guide, Scalar Memory Operations). - Add end-to-end hardware/WARP execution test s_buffer_load_truncates_terms_independently verifying soffset=3 + offset:3 reads dword 0 and soffset=3 + offset:7 reads dword 1.
2d6095e to
2f17ca4
Compare
2f17ca4 to
f7a44b7
Compare
…s to dword alignment independently # Conflicts: # crates/victory-shader/src/emit/valu_tests.rs
…s to dword alignment independently # Conflicts: # crates/victory-shader/src/emit/valu_tests.rs
fuzeofficlal
left a comment
There was a problem hiding this comment.
Truncating imm_offset and soffset independently (emit/lower.rs:4148-4162) cleanly models the native RDNA2 s_buffer_load_dword* alignment behavior while keeping Some(total_offset) clear and preserving descriptor base alignment as discussed above.
Minor non-blocking notes:
- In
lower.rs:4149-4150, clarifying that independent truncation comes from native RDNA2 hardware observation (since section 7.2.1's Reads using Buffer Constant pseudocode addsOFFSET + SOFFSETfirst) would remove doc ambiguity. - A follow-up could also add
cbufferLoadLegacy(root CBV) andNULLsoffsettest coverage alongside the raw table SRV test, and runrustfmtonvalu_tests.rs:2289.
Local verification at f7a44b76 (and cleanly merged onto origin/main at 420f3392, emit/lower.rs = 520,860 B, 3,428 B under cap): xtask policy (191 files ok), cargo clippy -p victory-shader --all-targets (default and --all-features, 0 warnings), resource_tracking (3/3), and emit::valu_tests on both RTX 5090 and WARP (36/36, including s_buffer_load_truncates_terms_independently) all passed. Approving.
|
Thanks for the thorough verification and approval @fuzeofficlal! Appreciate the pointer on Section 7.2.1 vs hardware divergence. We'll leave this branch locked for merge to preserve approvals, and I'll open a follow-up addressing the doc note alongside the |
Resolves VIC-BT-025 from #1249:
Summary
s_buffer_load_dword*address components are in bytes with their two LSBs ignored independently before summing ((soffset & !3) + (offset & !3)).crates/victory-shader/src/emit/lower.rs,imm_offsetandsoffsetwere added before dword truncation, causing a+4byte shift whenever low bits carried across bit 2 (e.g.soffset = 3andoffset: 3resolving to byte offset6 >> 2 = 1instead of0).imm_offset((*offset as u32) & !3) andsoffset(so & !3) independently, leaving descriptorbaseandextraunchanged.Tests
emit::valu_tests::s_buffer_load_truncates_terms_independently, executed on both hardware GPU and WARP (s_buffer_load_dwordwithsoffset = 3/7andoffset: 3/7, asserting(3 & !3) + (3 & !3) = 0reads dword0and(3 & !3) + (7 & !3) = 4reads dword1).Verification
cargo test -p victory-shader: 247 passed, 0 failed, 3 ignored.cargo clippy -p victory-shader --all-targets --all-features -- -D warnings: clean.cargo run -p xtask -- policy: 182 files ok.