shader: accept cache policies on read-only graphics scalar loads (Part of #3814) #3835
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3835
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3833"
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?
@timbot103 on GitHub · 2026-12-02 08:02 UTC · original
timbot103:shader/graphics-smem-addressing→main· +214 −2 · 5 files · 2 commits · merged 2026-12-03 01:50 UTCAccepts GFX10 read-only scalar load cache policy bits (
DLCbit 14,GLCbit 16, or both) in direct graphics (s_load_dword*opcodes 0..4 ands_buffer_load_dword*opcodes 8..12) while enforcing ISA alignment/range checks and keeping reserved bits, negative immediates, specialSOFFSETregisters, non-load opcodes, and direct compute cache policies fail-closed (Part of #3816"unsupported scalar memory addressing").Part of #3816. Refs #3642, #3643, #3705.
(Opened as Draft per #3516 until an active review slot frees; will reconcile the optional
--startup-pixel-wordsroot SRV argument cleanly if #3830 lands first.)Summary
src/gfx1013_compute_native.cpp(decode,Encoding::Smem):DLC(1 << 14) andGLC(1 << 16) ondirect && graphicsread-only SMEM load opcodes ((i.op & ~8u) <= 4).0x2a000u: bits 13, 15, 17) in graphics mode, enforcesi.dst + count <= limitfor direct graphics too, and validates DWORD-aligned immediates ((i.b & 3u) == 0), aligned/in-rangesbase, and aligneddst(dst % min(count, 4) == 0) on flagged loads.21..24), specialSOFFSETregisters (VCC,M0,EXEC), non-load SMEM opcodes, and direct compute cache policies.tests/native_graphics_smem_addressing_check.py+tests/cmake/native_graphics_smem_addressing.cmake+docs/experiments/native-graphics-smem-addressing.md+README.md:native_graphics_smem_addressing_controls(runs in theprCTest preset): verifies identical DXIL IR with and withoutDLC/GLC/DLC|GLCacross all 10 load opcodes, 36 pixel refusal controls, and compute refusal controls.native_graphics_smem_addressing_warp&native_graphics_smem_addressing_hardware: draws all 10 load opcodes on WARP and RTX 5080 (160 pixels verified per backend + swapped-channel mismatch control).tests/offscreen_check.cpp,tests/startup_flat_param.cpp,tests/desktop_gpu.h:--startup-pixel-wordsbound att0.Verification
Host: Windows 11 (
10.0.26200.9974), MSVC C++20/W4(zero warnings on edited lines), inbox WARP (10.0.26100.9818), NVIDIA GeForce RTX 5080 (32.0.16.2140; D3D12 debug layer unavailable). Baseorigin/mainf365f125.ctest --preset pr --no-tests=error -R "^native_graphics_smem_addressing_controls$": 1/1 passed.dev) & Release (release): 28/28 passed (2 unrelated LLVM-15 skips, 0 failures) in both configs, plusoffscreen_check --self-testpassed in both configs.tests/bidi_controls_check.py,tests/docs_links_check.py,git diff --check origin/main..HEAD: all clean.@lukaslw-lab on GitHub · 2026-12-02 08:07 UTC · original · approved these changes
Reviewed
374011e6(draft) by reading the diff; not built or run.Verdict: approve. DLC and GLC only change caching. On a load that the read-only binding proof already covers, dropping them gives the same value. No MUST.
--startup-pixel-wordsargument as comma-separated hex words, and this PR adds it as a file path at the same position (offscreen_check.cpp:1552). Two meanings for one CLI slot will conflict whichever merges second. Taking #3830's form (or the reverse) keeps one contract forstartup_flat_param.unsupported scalar memory addressingstages: aps86census onf365f125would show how many of them were only DLC/GLC (follow-up is fine).cache_policyis accepted only fordirect && graphics(gfx1013_compute_native.cpp:230). Compute keeps the refusal, and so do the non-load opcodes ((i.op & ~8u) > 4).dst + count > limit(a load into VCC). Neither changes a load that translated before.sbaseis aligned and in range for buffer loads, andsdstis aligned tomin(count, 4), as the ISA requires.Tests:
_controls(identical IR with and without DLC/GLC on all 10 opcodes, 36 pixel and the compute refusals) is in theprfilter._warp/_hardwareran only locally.@lukaslw-lab on GitHub · 2026-12-02 10:34 UTC · original
Census follow-up for the SHOULD in my review:
f365f125+ this PR alone, same capture and method as #3816 (6,436 distinct pixel stages). Counts only. None lost, no validation failures.f365f125f365f125+ #3835The 116
unsupported scalar memory addressingstages do not move, so on this capture they are not DLC/GLC loads. 3 stages (2 from DPP8, 1 from the wave-mask wall) now stop earlier at the newunsupported scalar memory destination rangecheck. They were refused before too, so this is not a loss. The check is thedirect && dst + count > limittest that now also applies to graphics.e143824cinto shader/graphics-smem-addressing c302aa9b181f672d8eb2to67375f335b@lukaslw-lab on GitHub · 2026-12-02 20:27 UTC · original · approved these changes
Re-review on
67375f33(rebased on5770f14e; the test now passes the root SRV words inline instead of a file).Verdict: approve.
Census, same capture and method as before (6,436 distinct pixel stages), main
5770f14evs this head:unsupported scalar memory destination range(2 from DPP8, 1 fromgraphics branch on a wave mask)Same as the earlier head. The only change since my review is the test harness:
check_startup_flat_paramnow takessrv_words/srv_countfrom main, and the fixture data shrank to 64 words with the offsets adjusted to match.AI-assisted.
67862ee4into r2/3833 e9d799c1f9@timbot103 on GitHub · 2026-12-02 23:20 UTC · original
Merged
main(67862ee4) into this branch. The reviewed commit is unchanged, and no follow-up fix was needed. It keeps this PR's graphics SMEM cache-policy checks and main's named NULL register.Tests, Windows 11 26200 with RTX 5080 and WARP. The filter was
native_pixel_|native_graphics_|native_direct_containerplus this PR's own tests. There were 0 failures and 0 skips, with 15 WARP and 12 RTX 5080 tests per configuration. A full Debug build of every target, including the C++17native_compute_pack_refusal_check, succeeded.@timbot103 on GitHub · 2026-12-03 01:14 UTC · original
Marked Ready for review now that the previous batch (#3834, #3840, #3841, #3846, #3849) has merged. This keeps us within 5 non-draft PRs per #3516. The branch merges cleanly into current main, and CI is green at this head.
@R0Y00 on GitHub · 2026-12-03 01:50 UTC · original · approved these changes
Independent MSVC Debug on
e9d799c1, Windows 11 build 26300.ctest --preset dev --no-tests=error -j 1 -R '^native_graphics_smem_addressing_(controls|warp|hardware)$'passed 3/3, zero skips. WARP and RTX 4060 Laptop (616.56), debug layer enabled, each matched 10 draws of 16 pixels and rejected the swapped-channel reference. IR is unchanged with DLC/GLC on the supported loads. Temporarily allowing cache flags in compute failed the compute refusal control. The restored binary passed.