Direct DXIL: write every dword of an unaligned multi-dword format store #1922
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1922
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1922/head"
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?
@emirduran707 on GitHub · 2026-11-24 23:15 UTC · original
emirduran707:dxil-format-store-unaligned-dwords→main· +67 −28 · 2 files · 1 commits · merged 2026-11-25 01:34 UTCIn the Direct DXIL translator,
st_bytesstores the lownbytes (up to 16) of four dwords forbuffer_store_format_*/tbuffer_store_format_*. When the address was not dword aligned (ornwas not a multiple of 4) it took the partial path, which only ever wroter[0], so an 8-, 12- or 16-byte format store at such an address dropped bytes 4..n. The partial path now stores each dwordkwith4k < natb + 4k, with the same shift and mask as before, and spills into the next dword when it crosses one. (#312 fixes the same gap in the HLSL recompiler'sst_bytes,recomp/emit.rs; this is the Direct DXIL path.)What is in it
crates/xcl/src/gpu/dxil/lower_mem.rs: the partial path ofst_bytesloops over the four dwords instead of writing only the first.crates/xcl/src/gpu/dxil/core_tests.rs: GPU testgpu_direct_unaligned_multi_dword_format_store: lane 0 does abuffer_store_format_xyzw(32_32_32_32_FLOAT, 16 bytes) at byte offset 2 and the test checks the bytes around and inside the store.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on4a6b414(rebased ontomainde36462): 1003 passed, 2 failed, 45 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpu;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record)gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3) fail identically on unmodifiedmainde36462on this GPU (seeds 722 and 1599).XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::testson 6e61d29 (before the rebase): 123 passed, 0 failed, 17 ignoredgpu_direct_unaligned_multi_dword_format_storebefore the change failed: only the first dword landed (bytes00 00 80 3fat 0x102), bytes 0x106..0x112 kept the0xDEADBEEFfill; passes afterRegression run
main:
this PR:
Not tested
AI use
mainde36462(a conflict incrates/xcl/src/gpu/dxil/core_tests.rs; both tests kept) and reran the suite and smoke runs above.@upipibi on GitHub · 2026-11-24 23:20 UTC · original
NVIDIA counterpart to the Radeon run: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
6e61d29onmain689f2db.gpu_direct_unaligned_multi_dword_format_storeand the tests matchingformat_store: 2 passed, 0 failed, with and withoutXCL_DIRECT_DXIL=1.AI-assisted (Claude Code). Synthetic tests only.
@WebIdentity1 on GitHub · 2026-11-24 23:35 UTC · original
Tested the two paths listed as untested here: 8- and 12-byte stores, including MTBUF. The test-only patch below adds 16 synthetic GPU readback cases: MUBUF/MTBUF × 8/12 bytes × offsets 0/1/2/3. It compares the entire 512-byte buffer with a bytewise expected result. MTBUF uses a deliberately different descriptor format to check that the instruction format wins.
On RTX 3090, driver 591.74, Ryzen 7 7800X3D, Windows 10 19045, Rust 1.98.1 MSVC, debug:
689f2dbplus both test functions: 0 passed / 1 failed / 0 ignored, no skips. All 12 unaligned cases mismatched; all four aligned controls matched.6e61d294c825a4d34156dea7c5f8eb0f35afa3c4plus the new test: 1 passed / 0 failed / 0 ignored, no skips. All 16 cases matched.Command:
cargo test --locked -p xcl --lib gpu_direct_short_multi_dword_format_stores -- --test-threads=1 --show-output, withXCL_ADAPTER=3090. Each tree was rebuilt; 310-file source manifests matched before/after, with onlylower_mem.rsdiffering between the pair.This supports the existing fix; no additional production change is proposed. Not tested: full suite for this overlay, retail smoke/gameplay, AMD, or performance. The patch is available to fold into this PR.
Test-only patch
AI use: Codex with GPT-6 Astra wrote the additional test, ran the Windows checks, and drafted this report.
@raylitebull on GitHub · 2026-11-25 01:08 UTC · original
Both AMD and NVIDIA verification look good on
6e61d29. This is currentlyDIRTYwith merge conflicts againstmain— please rebase ontomainand letBuild and test (Windows, no GPU)run cleanly so we can merge.@DavidM1911 on GitHub · 2026-11-25 02:33 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@DavidM1911 on GitHub · 2026-11-26 00:42 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin