native: raw buffer loads through heap view tokens (#3023 stage 3, translator) #3631
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3631"
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 JB2WIN on 2026-11-30T18:17:34Z.
What
Raw buffer loads from the directly indexed resource heap at a GPU-selected offset, through the same view tokens as #3544 (stage 3 of #3023, translator side).
s_load_dwordx4/s_load_dwordx8(SMEM op 2/3) that reads a buffer V# through a heap token, followed by MUBUF loads, becomesResourceDescriptorHeap[baseraw + id]when the token names a raw buffer view (dimension table code0x20). Otherwise it reads the null raw view (reads zero) and counts one miss per wave with an active lane, as the texture route does.baseraw,nullraw).NativeComputeShader::heap_token_word_count(0/5/7) replaces the bool. Manifest:udsrc K heaptok baseraw|nullraw.native_compute_output_revision2 → 3 (doc: Revision).Why
The texture route (#3544) leaves buffer reads through the same tokens refused. The census shows them as the next block of heap refusals.
How
s_add_u32high word must be the constant 0 at translation time (no carry map, no runtime carry check; same heap-relative model as the heap_offset path).0x20dims entries.How tested
native_heap_token_texture_check.py): 130 assertions. They include loop, mixed loop, the mixed case (eligible texture plus ineligible buffer), a 25/26-stride word budget, mask/high-word/dims/slot mutations, and EXEC none/half from #3544.native_heap_token_texture.cpp, RTX 3080): 83 assertions;rawbuf,rawbuf_waterfall,sbufmodes. They fail with the src reverted.compile_dxilcompiled gives byte-identical output (revision line aside). Census on a local request set (counts only, no shader data in the repo): compiled 831 → 844, heap refusals 1323 → 1308.native_direct_mesh, fails the same way on main (077bff3a).Risks / open
HeapViewContract::nonegate unchanged. The EXEC-gated miss count is shared with the texture route (heap_token_slot); no rig mode exercises it on a raw buffer load.X2W_D3D12_VIEW_CONTENT_TOKENS=1, buffer views are content tokens, which this route treats as misses (null view). PR 2 must refuse or decode them.Depends on #3544 (this branch contains it; review the last commits). Refs #3023, #3224.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 [email protected]
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T18:46:52Z.
Review: APPROVED
Reviewed
f4cc6a0eby reading the diff (the seven commits on top of #3544cf0f40be); not built or run.Verdict: approve. The buffer route is opt-out by construction: candidates are judged per load, ineligible ones keep today's path, the word-budget retry translates without the route, and dispatch still refuses every
heaptokline, so nothing changes at runtime until PR 2. No MUST.tests/native_compute_manifest_reasons.cpp, inherited from #3544). After the rebase,native_heap_token_texture_controlsneeds no GPU but is not in theprpreset filter, so CI still would not run the 130 rig assertions. Adding_controlsto the filter makes the eligibility rules (loop, mixed, word budget, mutations) a CI check.gfx1013_direct_compute.inl:1240,== 0x20at:1303; docnative-heap-token-textures.md:97). #3619 (mesh, translator only) reads typed R32_UINT buffers through the same tokens with kind16. The codes do not clash, but with one code per id, a title buffer that compute reads raw and a mesh program reads typed would miss in one of the two routes. Both buffer codes are single bits, so testing(dims & 0x20) != 0here (and& 16in #3619) lets PR 2 mark one id as both. The doc line should also list16, so PR 2 writes one table for both translators. I'll change #3619 to match.gfx1013_compute_native.cpp:2000), but the code takes onlybuffer_load_dword(:2070). x2/x3/x4 loads drop out as ineligible. That is safe, but the comment overstates it.HeapTokenWordBudgettext matchesrefuse()for texture-only programs (rethrown unchanged); the retry cannot recurse (buffers_allowed=false); a cached oldheap_token_wordsvalue failsdecodeand is retranslated, not trusted (direct_compute_cache.cpp:380,:542); the s_add high-word-0 assumption is judged identically in the pre-pass and the lowering; the window's byte count is the title V#'s own num_records times stride, so A1 holds if PR 2 builds the view from the same descriptor.Tests:
_controlsproves the per-load eligibility, the retry and the manifest words;_hardware(RTX 3080, author) provesrawbuf/sbufreads and fails with the src reverted. CI ran neither (see above), and_warpskips (77).Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T07:13:29Z.
Friendly note: this is approved, but it currently conflicts with
mainafter the recent merges; it should be ready again once rebased together with #3544 underneath it.Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-12-02T18:58:04Z.
@Leyukaka merged the updated #3544 (with
main46d465d9) in06b0e709.heap_token_word_count(0, 5 or 7) now goes through main's cache visitor, the round-trip fixture andvalidate_shader.Local, RTX 3080:
ctest -R 'heap_token|manifest|direct_cache|native_compute|startup_compute|triage_run'gives 256/265. The 9 failures are the same onesmain46d465d9has without these branches.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-12-02T19:37:48Z.
@Leyukaka main moved again, including #3500, which adds its image field words at the same places as the heap token words. Merged in
f7a54aaa(#3544) and26d1c531(this PR). The b0 words are now root constants, stride words, image field words, then heap token words, in the translator, the manifest and the cache visitor. Both branches merge cleanly intomain23986134.Local, RTX 3080:
ctest -R 'heap_token|image_fields|manifest|direct_cache|native_compute|startup_compute|triage_run'gives 259/268 on both. The 9 failures are the same onesmainhas on its own.If it conflicts again by the time you check, feel free to resolve it yourselves. We're fine with that, as you offered.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T19:45:37Z.
Review: COMMENTED
Reviewed the raw-buffer delta from #3544
f7a54aaato26d1c531. Independent MSVC Debug on Windows 11 build 26300 passed the heap-token controls, RTX 4060 Laptop hardware readback, manifest reasons and frontend cache round-trip (4 passes). The WARP heap-token fixture skipped with code 77 at the wave32 capability gate. The new manifest bindings still refuse live use until the runtime supplies them. This is ready for the dependency to land first. After #3544 merges, please refresh this branch and verify that the remaining diff is the buffer work.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T20:28:25Z.
Review: APPROVED
#3544 is now in main. I reviewed
1b193f4dagainst75759370; the remaining runtime integration still refuses the heap-token buffer manifest until the follow-up supplies the raw views and dimension table. The raw-buffer lowering, cache and fixture files are unchanged from the previously tested head. Independent MSVC Debugctest --preset dev --no-tests=error -j 1 -V -R '^(native_heap_token_texture_(controls|warp|hardware)|native_compute_manifest_reasons|native_direct_cache_controls)$'gave four passes and one capability skip on Windows 11 build 26300. The translator rig held 130 assertions and the RTX 4060 Laptop (32.0.16.1656) run held 83. WARP reported wave size 4 and skipped the wave32 fixture with exit 77. The export census also passed all 476 cases and caught six mutations.