shader: accept GLC and DLC cache flags on direct read-only image ops #3244
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3244"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-28T01:39:04Z.
Accept MIMG cache-policy flags
GLC(word 0 bit 13,0x2000) andDLC(word 0 bit 7,0x0080) on read-only image operations inDirectCompute::image_io(), addressing #3224 (Rank 8:"direct image opcode or descriptor modifiers") and #2935.Fixes #3242
Refs #2935
Refs #3224
Summary
src/gfx1013_direct_compute.inl:DirectCompute::image_io(), updated the word 0 modifier check from(i.a & 0x3e0c0u)to(i.a & (store ? 0x3e0c0u : 0x3c040u)).image_load,image_load_mip,image_sample*,image_gather4*,image_getlod,image_getresinfo) now ignoreGLC(0x2000) andDLC(0x0080), matchingSLC(0x02000000) cache-policy handling.image_storewithGLC/DLC(0x3e0c0u),LWE(0x20000),TFE(0x10000),R128(0x8000), reserved word 0 bits (0x4040), reserved word 1 bits (0x3c000000u), andimage_atomic_*explicit policy checks inimage_atomic().tests/native_image_cache_flags_check.py&tests/cmake/native_image_cache_flags.cmake:controlsverification across Compute and Pixel stages forimage_load,image_load_mip,image_getresinfo,image_sample_lz,image_gather4_lz, andimage_gather4_lwithGLC,DLC,SLC, andGLC|DLC|SLC(48 compiled DXIL modules matching plainflags=0baselines), plus 16 refusal checks (image_storewithGLC/DLC,R128,TFE,LWE, reserved word 0 bits6/14, reserved word 1 bit26).psandcshardware/WARP readback tests viaoffscreen_checkusingimage_gather4_lwithGLC,DLC, andGLC|DLC|SLC.docs/experiments/native-image-cache-flags.md:Verification
Host: Windows 10.0.26100,
devpreset, DXC10.0.26100.0.cmake --build --preset dev --target compile_dxil offscreen_check native_compute_ir_dump: passed.ctest --preset dev --no-tests=error -R '^(native_image_cache_flags_|native_gather_|native_image_atomic_|native_sample_ssamp_)' -V:native_image_cache_flags_controls: Passed (48flagged DXIL modules matched plain baselines;16refusals matched).native_image_cache_flags_ps_warp: Passed (12cached-flag cases matched on Microsoft Basic Render Driver10.0.26100.9711).native_image_cache_flags_ps_hardware: Passed (12cached-flag cases matched onNVIDIA Quadro M1000M32.0.15.7371;debug_layer=unavailable).native_image_cache_flags_cs_hardware: Passed (12cached-flag cases matched onNVIDIA Quadro M1000M32.0.15.7371;debug_layer=unavailable).native_image_cache_flags_cs_warp: Skipped (77, Microsoft Basic Render Driver lacks SM 6.6 wave32).native_gather_compare_warp,native_gather_lod_*,native_image_atomic_controls/hardware,native_sample_ssamp_hardware) passed (_cs_warp/_warpwave32 tests skipped77; pre-existingnative_image_atomic_runtime_hardwarefails on this dual-GPU host becausestartup_stream_consumeruses adapter 0Intel(R) HD Graphics 530which lacks SM 6.6 wave32).ctest --preset dev --no-tests=error -R '^native_.*_(controls|ir)$' --output-on-failure: 67/67 passed (0skips).native_image_cache_flags_controls:revert_ro_cache_flags((i.a & 0x3e0c0u)): failed (rc=8).drop_r128_refusal((i.a & (store ? 0x3e0c0u : 0x34040u))): failed (rc=8).python -B tests/docs_links_check.py: passed (131Markdown files,631links).AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by akimfomin on 2026-11-28T01:56:44Z.
For
9863d469, I compared the relevant behavior with shadPS4 #5739. Keep image operand flags separate from operand liveness. Compare identical fetch coordinates with a tested cache hint, and a second address operand kept alive across legalization. This is a pinned source comparison; the suggested case still needs a receiving-side run.Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-28T02:04:36Z.
Thanks for the pointer @akimfomin — that matches what our
image_load_mip(v0..v2) andimage_gather4_l(v0..v2) cases intests/native_image_cache_flags_check.pyexercise, asserting both multi-dword coordinate liveness and byte-identical DXIL compared with the unflagged baseline (glc=0,dlc=0).AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-28T02:41:50Z.
Rebased onto
upstream/main(fdb6faaa) as12a6640bto resolve the conflict inDirectCompute::image_io()after #3243 (exact_store), keeping all #3243 prefix-mask store changes intact alongside(i.a & (store ? 0x3e0c0u : 0x3c040u)).Re-verified in
devandrelease(/O2, Windows10.0.26100):native_image_cache_flags_controls: Passed (48flagged DXIL modules matched plain baselines;16refusals matched).native_image_cache_flags_ps_warp: Passed (12cases matched on WARP).native_image_cache_flags_ps_hardware&native_image_cache_flags_cs_hardware: Passed (12cases each onNVIDIA Quadro M1000M32.0.15.7371,debug_layer=unavailable).native_image_cache_flags_cs_warp: Skipped (77) (Microsoft Basic Render Driver10.0.26100.97114-lane wave).python -B tests/docs_links_check.py: self-test passed (134Markdown files,638links).AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T03:09:25Z.
Review: APPROVED
Independently reviewed
12a6640b. The masking is limited to GLC/DLC on the admitted read-only MIMG operations. Reserved bits, TFE, LWE, R128, stores and the separate atomic route retain their existing checks. The result checks cover synchronized value equivalence on desktop, with guest cache policy outside their scope.On Windows 11 26200.9974 and RTX 4060 Laptop (32.0.16.1656), using inbox WARP 10.0.26100.9818 and DXC 10.0.26100.0, Debug and Release /O2 each recorded 10 passes and one WARP compute capability skip on integration tree
db07621c. Controls covered 48 accepted containers and 16 refusals. RTX compute and pixel, WARP pixel, the runtime atomic, and exact-width store controls passed. The offscreen checks requested the debug layer.After #3245, Release /O2 on main
0637fcedplus this head (treeb6e49bed) passed five tests with one WARP compute capability skip:The hosted Windows build and test check passed.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T03:55:19Z.
Independently tested
12a6640bintegrated overmain0637fced(treeb6e49bed). This is the head that was merged as9872074a, so I'm posting it as a comment. The trial merge was clean andgit diff --cached --checkwas clean.What I traced. On gfx10, MIMG word 0 puts DLC at bit 7, GLC at bit 13, R128/A16 at bit 15, TFE at bit 16 and LWE at bit 17. The read-only mask
0x3c040frees bits 7 and 13 and still refuses 6, 14, 15, 16 and 17. Stores keep0x3e0c0. Every non-store path here binds atexture_srv, and the dispatch side refuses an output texture that is also an input. So dropping GLC on a read can't hide a same-dispatch coherence need.What I ran. I built everything in
devand inrelease, then ranThe
_hardwaretests ran at-j 1. In Debug and in Release/O2:_controls: "48 flagged DXIL modules matched plain baselines; 16 refusals matched"._ps_warp,_ps_hardwareand_cs_hardware: "12 cached-flag cases matched"._cs_warpis a capability skip (77): WARP has no 32-lane waves.Neighbours in
devalso pass:^(native_.*_(controls|ir)|native_(gather|image|sample)_.*_warp)$: 77/77 pass. 4 are WARP wave32 capability skips.native_(gather|image|sample)_*_hardware: 7/7 pass.Negative control and mutants. Each mutant was rebuilt in
devand run against all five tests.src/gfx1013_direct_compute.inlback tomain0637fced_controls,_ps_warp,_ps_hardware,_cs_hardware("direct image opcode or descriptor modifiers" on GLC)0x3c0c0)_controlsstore_glc)0x2c040)_controlssample_tfe)0x3c000)_controlssample_res_bit6)0x3c0c0)0x1c040)_controlssample_lwe)Afterwards I restored and rebuilt;
git diff --quietis clean.Non-blocking. The R128, TFE, LWE and reserved-bit refusals are pinned only on
image_sample_lz, and the GPU cases only useimage_gather4_l. The mask is shared by every read-only opcode, so this covers it today. A per-opcode split of the check would not be caught.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; SDK 10.0.28000.0 DXC (the one CTest picked up); Python 3.12.10; wave32.
This reply was AI-assisted.