Recompiler: use typed R8 views for single-byte compute stores #2926
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!2926
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2926"
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?
@Kalmarv on GitHub · 2026-11-27 00:14 UTC · original
Kalmarv:batman/typed-r8-store→main· +125 −5 · 9 files · 1 commits · draftPart of #2688. A single-byte formatted store currently updates its containing dword with an atomic AND and OR. A typed byte store can update the addressed byte directly.
What is in it
XCL_BYTE_STORE_CSto its hexadecimal hash with four heap-backed windows and direct DXIL compute. Each window has 32 R8_UINT views of up to 128 MiB. Wider stores retain the existing lowering. The adapter's typed-store support and the translation cache key are checked.Tested
Regression run
Both 60-second smoke arms reached the 26,503-shader startup preparation and timed out before the first frame. A 480-second paired retry is queued on the same main and PR revisions.
Not tested
AI use
@andrewDoing on GitHub · 2026-11-27 00:58 UTC · original
PR #2926,
a0e4c943d2+ local test and descriptor setup in xcl-2926-byte-boundary. The production shader translator and descriptor geometry are unchanged. The fixture explicitly chooses raw/typed modes and binds the production helper's views. This tests a single window and one descriptor boundary, with no game, timing, or launch-gate coverage.NVIDIA GeForce RTX 5070 (12227 MiB, 616.92), Windows SDK 10.0.26100.0, DXC/DXIL 1.8.2502.11. XCL_ADAPTER=5070. Fresh isolated CARGO_TARGET_DIR set to the worktree's target. CARGO_PROFILE_TEST_DEBUG=0, CARGO_PROFILE_DEV_DEBUG=0, CARGO_INCREMENTAL=0, CARGO_NET_OFFLINE=true, XCL_TEST_BYTE_BOUNDARY=1, XCL_DXIL_CACHE=/target/byte-cache. SDK x64 prepended to PATH; vcvars64.bat from VS2017 BuildTools used before Cargo.
cargo test --locked -p xcl --lib gpu::dxil::core_tests::probe_byte_descriptor_boundary -- --exact --nocapture
32 distinct active lane stores using BUFFER_STORE_FORMAT_X with 8_UNORM, alternating between adjacent 128 MiB typed R8 views, all four byte positions covered. Each lowering matched all 134217856 bytes of the CPU oracle, including unchanged neighbors. Test elapsed 0.85 s; 1 passed, 0 failed, 1346 filtered. See xcl-pr2926-byte-boundary.log and the local fixture changes in xcl-2926-byte-boundary.
@retrope13 on GitHub · 2026-11-27 01:31 UTC · original
Verified PR #2926 (
a0e4c943) on Windows 11 (NVIDIA Ada Lovelace + Intel UHD Graphics targeted checks) and reviewed the full diff. The default workspace suite passes cleanly (1,447 passed, 0 failed), and the code audit caught one reproducible unit-test crash whenXCL_BYTE_STORE_CSis exported in the shell environment.Environment
26300.9818)32.0.16.2140)32.0.101.7092)rustc 1.100.0(stable-x86_64-pc-windows-msvc), VS 2022 Build Tools17.14.45, Windows SDK10.0.26100.0(DXC / DXIL1.9.2602.17)Test Results (
a0e4c943)cargo test --locked -p xcl --lib -- typed_byte_store_adds_a_byte_view_and_keeps_the_raw_fallback --nocaptureXCL_ADAPTER=NVIDIA)0.03s, validated & disassembled with DXC/DXIL1.9.2602.17)cargo test --locked -p xcl --lib -- gpu_direct_unaligned_multi_dword_format_store --nocaptureXCL_ADAPTER=NVIDIA)0.39s)cargo test --locked -p xcl --lib -- gpu_direct_unaligned_multi_dword_format_store --nocaptureXCL_ADAPTER=Intel)0.10s; capability-skipped:no GPU / DXC / wave64)cargo test --locked -p xcl --test console_heap_contract -- --nocapture0.03seach)cargo build --workspace --locked && cargo test --workspace --locked --no-fail-fast -- --test-threads=4XCL_ADAPTER=NVIDIA, default env)SKIPPEDlines: 21no wave64, 3 per-lane f16 form refused, 3 no D3D12 debug layer, 1 cannot disable driver cache, 1no heap windows)cargo test --locked -p xcl --lib -- window_views_do_not_hold_global_during_device_calls --nocaptureXCL_BYTE_STORE_CS=1234Code Review Findings
Test crash when
XCL_BYTE_STORE_CSis set in the shell (crates/xcl/src/hle/d3d12x/console_heap.rs:886-926):window_views_do_not_hold_global_during_device_callsspawns a child test process inheriting the parent environment (console_heap.rs:889-892), and its mockID3D12Devicevtable (console_heap.rs:909-912) only fillsvt[1](AddRef),vt[2](Release), andvt[19](CreateUnorderedAccessView), leavingCheckFeatureSupport(vt[13]) null.XCL_BYTE_STORE_CS=1234causesset_window_views(&dev, &[window])(count == 4) to enterif bytes_enabled(console_heap.rs:247) and calldevice.CheckFeatureSupport(...)through the null vtable entry, crashing the child process (panicked at console_heap.rs:894:13). (And even if stubbed to return supported,CALLSwould increase from4to132at line 926.).env_remove("XCL_BYTE_STORE_CS")on the spawnedCommandatconsole_heap.rs:891so the test is hermetic when developers test withXCL_BYTE_STORE_CSexported.Minor defensive note (non-blocking) —
shared_heapcap check (crates/xcl/src/hle/d3d12x/console_heap.rs:176-178):next > captriggers when reserving the 128 byte-window descriptor slots,shared_heapreturnsfalsewithout settingGLOBAL_FAILED = true(unlike theCreateDescriptorHeapfailure path at line 166). On real hardwarecapis far larger than148, so this is purely defensive.Everything else audited cleanly:
crates/xcl/src/gpu/dxil/ops.rs:560:0x4000matchesshader.rs:342'sIsGloballyCoherentbit for heap raw UAVs.crates/xcl/src/gpu/dxil/lower_mem.rs:517-536:st_bytesproperly guardswin < mems.len() && n == 1, computesBYTE_HEAP_BASE + ((win << 5) | (a >> 27))withnonuniform = true, masksoffset((1 << 27) - 1) andvalue(& 255), and preservesst_bytes_rawfor wider or out-of-range stores.crates/xcl/src/gpu/recomp/pso.rs:161-185, 304, 613:BYTE_WINDOWS(0x200) is cleanly gated toStage::Compute,HEAP_WINDOWS | 4, direct DXIL (non-per-lane), and!byte_views_unavailable(), isolated in bothShaderKey(RAM) andtranslated::file(disk), and stripped before HLSL fallback.Not Tested
XCL_BYTE_STORE_CSactively matching a shader hash (no retail game files or captures on this machine).#[ignore]tests in the workspace suite.(AI disclosure: diff review, test execution commands, and report formatting were assisted by Antigravity / Gemini 4; all tests were executed locally on the hardware listed above.)
@andrewDoing on GitHub · 2026-11-27 02:01 UTC · original
Follow-up to my boundary report: I tested 32 simultaneous lanes writing distinct bytes of only eight shared words, distributed across the 128 MiB descriptor boundary. This covers shared-word writes as well as the earlier one-writer-per-word case.
On
a0e4c943d224950518485c70f280e05855f1d55bplus a local test-only fixture, both raw and typed paths matched the CPU reference across all 134,217,856 bytes, including the untouched neighbors. The test passed once with no reported skips. It explicitly selected both paths; automatic path selection, GTA VI execution, and performance remain untested.AI use: OpenAI Codex with GPT-6.2 Astra wrote and ran the fixture; Codex coordinated and prepared this follow-up.
@ettehn on GitHub · 2026-11-27 02:13 UTC · original
I checked the automatic hash selection and translated-disk-cache split on
a0e4c943with a local test-only fixture, Windows 11 and SDK DXC/DXIL 1.8.2502.11. Seven fresh child processes called the productionconsole_to_dxil_inentry point for the same syntheticBUFFER_STORE_FORMAT_Xprogram (9bca5a67805f87ea) using one scratch cache. NoBYTE_WINDOWSflag was supplied by the test.XCL_BYTE_STORE_CSemitted one typedbufferStore.i32. With the switch unset or a different hash, it emitted zero.259(three windows),260(four raw windows) and772(four with the byte-view flag). All seven outputs validated.This checks translation and cache routing. I did not dispatch this fixture or launch a retail title. OpenAI Codex (6.2sol) assisted with verification.
@SzczepanGrela on GitHub · 2026-11-27 03:33 UTC · original
RX 9070 / RADV / Wine functional comparison, including native wave64: main/raw, head/raw and head/typed match the independent CPU reference byte-for-byte in every tested case. This adds AMD execution coverage; no timing or FPS conclusion.
Tested
a0e4c943d224950518485c70f280e05855f1d55band main8b957bec6f82495aec940944c6bf47faa02db590, separate source copies with test-only capture/helper access. Production translator and typed-view geometry unchanged; original assertions preserved.26.3.1-arch3.5; Ryzen 7 7700, CachyOS7.3.0-5-cachyos. Windows GNU release executables under GE-Proton11-12 / Wine 11.0 Staging, native D3D12 through vkd3d-proton8293130ebe370b1+(local asserts-disabled build). Rust1.97.1, DXC/DXIL1.9.2602.17. Adapter LUID00000000:000003efand R8_UINT buffer/typed-UAV-store support checked.cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run --message-format=json-render-diagnostics.gpu_direct_unaligned_multi_dword_format_store typed_byte_store_adds_a_byte_view_and_keeps_the_raw_fallback --nocapture --test-threads=1, then--test-threads=4: main 1 passed, 0 failed each; head 2 passed, 0 failed each. The full 512-byte original GPU readback was additionally checked, including unchanged neighbors.workflow_byte_store_boundary_matrix --nocapture --test-threads=1: main/raw, head/raw and head/typed, three fresh processes per mode. 1 passed, 0 failed in all nine runs; 0 ignored, 0 skipped throughout.Each matrix run has ten dispatches: five cases in physical wave32 and native wave64. The single backing buffer is 134,217,856 bytes, spanning the first two 128 MiB R8 views. Mode selection is explicit in KernelOptions; the head's typed descriptors come from the production
set_byte_window_viewshelper through a test-only accessor. Four heap windows are configured, but only window 0 is backed/exercised.Across the matrix: 90 GPU dispatches, including 45 native wave64, and 12,079,607,040 readback bytes. Complete readbacks were saved losslessly compressed, decompressed and independently compared with Python-generated inputs, f32 packing, EXEC masks and untouched bytes. Zero differences. Payloads match across all three modes and repetitions; raw shader containers also remain byte-identical. Saved DXIL verifies the requested wave sizes, one added typed store, and retained atomic fallback.
Inherited
XCL_*variables were cleared,XCL_NETWORK=0, RX 9070 selected,XCL_REQUIRE_GPU=wave64; separate enabled caches per process.XCL_BYTE_STORE_CSwas unset.Not tested
Automatic hash/launch selection, the shared-heap allocation/setup path, windows 1 through 3, globally coherent console-compute dispatch, native Windows, other GPUs, full suite, retail workload,
scripts/smoke.ps1, or performance. This is explicit kernel-ABI path/descriptor testing, not full runtime integration.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) wrote the owned test-only fixture, ran the comparisons, independently verified all captured bytes/IR/source provenance and drafted this report. Publication authorized by the account owner.
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.