Repository navigation
Recompiler: an image_load after an image_store of the same image reads the store - #2156
Conversation
…s the store image_load read through the image's SRV (tw0) while image_store and the image atomics write its UAV (tw0 + 1). Within one dispatch the SRV need not see the UAV's writes, so a program that stores a texel and loads it back read the old value; RDNA2 reads its own writes. On an RTX 3070 the new test reads the old value on 64 of 64 lanes with XCL_DIRECT_DXIL=1 (the HLSL path happens to see the write on this driver). Each image store or atomic now records, per invocation, which image (tw0 + 1) it wrote through each T# SGPR the program stores with; a later image_load of that same image reads through the UAV. Every other load stays on the SRV. Cube images and mip loads keep the SRV, since a UAV view is a single mip. Both paths; the test runner now creates the SRV a UAV test texture needs, as the runtime does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent native Windows AMD check of exact PR head Tested
Regression run Paired guarded seven-second launches of the same owned title with isolated data and DXIL caches, no input. The Both launches reached their first frame but logged zero draws and zero dispatches. They are short startup regressions, not evidence that the title uses the image read-after-write path. The focused GPU fixture above exercises that path. I did not run the full workspace suite or a longer title session. AI-assisted checkout, testing, smoke monitoring, log verification, and report drafting with OpenAI Codex (GPT-6). No game data was uploaded. |
Brings main to full parity with upstream/main (cdb0891), including: - World rendering & gameplay: xcl-dev#1991, xcl-dev#1988, xcl-dev#1984, xcl-dev#2028, xcl-dev#2078 - Memory / VRAM / PSO: xcl-dev#1985, xcl-dev#2157, xcl-dev#2178, xcl-dev#2195, xcl-dev#2176, xcl-dev#1996, xcl-dev#1914 - Direct DXIL & shaders: xcl-dev#2120, xcl-dev#2174, xcl-dev#2194, xcl-dev#2207, xcl-dev#1951, xcl-dev#1973, xcl-dev#2156, xcl-dev#2064 - Preserves local Linux/Wine customizations: docs/linux.md, scripts/linux/*, in-process Wine XAsync (xgameruntime/api.rs), loader watchdog bypass, and Wine MEM_WRITE_WATCH bypass on coherent UMA windows (gpu/uma.rs). Assisted-by: Antigravity (Gemini 4)
image_loadreads an image through its SRV (tw0), whileimage_storeand the image atomics write its UAV (tw0 + 1). Within one dispatch the SRV need not see the UAV's writes, so a program that stores a texel and loads it back can read the old value. RDNA2 reads its own writes. On an RTX 3070 the new test reads the old value on all 64 lanes withXCL_DIRECT_DXIL=1. The HLSL path happens to see the write on this driver, but D3D12 doesn't promise it.What is in it
recomp/emit.rs:image_write_srsrcslists the T# SGPRs a program stores or does image atomics through (at most 16). Each such store or atomic records, per invocation, which image it wrote (xcl_iw{srsrc} = tw0 + 1). A laterimage_loadof the same image reads through the UAV. Every other load, and cube and mip loads (a UAV view is a single mip), stays on the SRV.dxil/lower_image.rs,dxil/lower.rs,dxil/kernel.rs: the same on the direct DXIL path, with 16 per-lane variables (VAR_IMG_WRITE) and a typed UAV load.recomp/runner.rs: the test runner now always creates the SRV of a test texture, as the runtime does. A UAV test texture had none, so its loads read 0.recomp/tests.rs:gpu_image_load_reads_a_store_of_the_same_dispatch: an 8x8 R32_UINT image set to 0xEEEEEEEE. Each lane stores 1000 + lane to its texel, loads the same texel, runss_barrier, then loads lane ^ 1's texel.image_load_of_a_stored_image_reads_through_the_uav: a codegen test that needs no GPU.Tested
main6020a33.mainwith the new test (and the runner SRV fix): it fails withXCL_DIRECT_DXIL=1on all 64 lanes, reading 0xEEEEEEEE. It passes withXCL_DIRECT_DXIL=0.gpu_suite (--skip gpu_sparse_vram): 135 passed withXCL_DIRECT_DXIL=0. With1, 134 passed and 1 failed:gpu_image_get_resinfo_1d_array, which fails onmaintoo (Direct DXIL: image_get_resinfo of a 1D array gives the layers in y #2046).Regression run
Run by luckyteagirl on an AMD Radeon RX 6800M (comment),
mainand this head, pasted unedited:Not tested
ec356bc: Intel Arc A770 (JJAutoCompare, comment) and AMD RX 6800M (luckyteagirl, comment).s_barrier.s_barrieris translated as a group-memory-only barrier (emit.rs:1264,dxil/lower.rs:1005), which doesn't order UAV writes between lanes. This PR covers a lane reading an image it stored to itself. The neighbour read in the test passes on this NVIDIA driver, but D3D12 doesn't guarantee it. That would be a separate change to the barrier.AI use
🤖 Generated with Claude Code