Skip to content

shader: bind a single directly indexed heap flag as a descriptor table - #3442

Merged
JohnConnorNPC merged 2 commits into
R0Y00:mainfrom
Leyukaka:compute-single-heap-table
Nov 29, 2026
Merged

JohnConnorNPC merged 2 commits into
R0Y00:mainfrom
Leyukaka:compute-single-heap-table

Conversation

@Leyukaka

Copy link
Copy Markdown
Collaborator

Replaces #3221. Branch compute-single-heap-table (66c3aec, 214ebfa), based on main 212d4b5. git merge-tree with main 184b15d is clean. The first commit is @tedin7's commit from #3221 (3114bb15 there, 66c3aec0 here), cherry-picked with the same changes and tedin7 as author. The second answers the open review items there.

What changes

  • src/gfx1013_compute_native.cpp (tedin7): the directly indexed heaps were bound as descriptor tables only when both root flags were set (0xc00) and exactly two user SGPRs were left. Each flag now binds its heap on its own: 0x400 binds the resource heap at next, 0x800 binds the sampler heap there, and 0xc00 binds both, resource heap first. The heaps bind only when next + heap_count == user. In any other case the heap stays unbound and the load is refused with "direct descriptor address outside bound table", as before.
  • tests/native_wave_request_check.py (tedin7): the heap-slot stride program also runs with RootFlags(CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED) and 11 user SGPRs. The same words with 12 user SGPRs must be refused and write no .cso.
  • tests/native_sampler_heap_check.py (tedin7): a sampler-only root (SAMPLER_HEAP_DIRECTLY_INDEXED, 6 user SGPRs) runs the sampler fixture.
  • tests/native_sampler_heap_check.py (this PR): a sampler-only root with 5 user SGPRs (user == next, no SGPR left for the heap) must be refused with "direct descriptor address outside bound table" and write no .cso. This is the case for == changed to >=, which the native: bind a single directly indexed heap flag as a descriptor table #3221 cases do not catch (by reading; that mutation was not run). The check is placed before the first fixture call, so an adapter that later skips with 77 still evaluates it (by reading).
  • docs/experiments/native-sampler-heap.md (this PR): describes the 0x400, 0x800 and 0xc00 forms and the next + heap_count == user rule, removes the line saying 0x800-only roots are not covered, and adds the reproduction command.

Evidence

Tests covering the change: native_wave_request_hardware (CMakeLists.txt), and native_sampler_heap_warp / native_sampler_heap_hardware (tests/cmake/native_sampler_heap.cmake).

ctest --test-dir out/build/release --no-tests=error -R '^native_(sampler_heap_(hardware|warp)|wave_request_hardware)$' -V

Release build of the branch head (base 212d4b5), one run: 2 passed, 1 skipped.

  • native_wave_request_hardware: Passed.
  • native_sampler_heap_hardware: Passed.
  • native_sampler_heap_warp: Skipped, exit 77.

Not covered

  • Not built on a merge with 184b15d. After 212d4b5, main changed src/gfx1013_compute_native.cpp; the merge is textually clean.
  • The position of a lone heap at next is inferred from tools/startup/gfx2hlsl.py Stage.setup_entry, not from a documented ABI. The fixtures read where the translator binds, so the GPU runs check D3D12 behaviour, not the guest layout.
  • The 12-SGPR refusal in tests/native_wave_request_check.py runs after the GPU fixture, so it is not reached when the fixture returns 77 first.
  • The runtime path has not been checked for the refused programs counted in direct compute: untranslated compute shaders of a start-up run ranked by dispatches, with first refusals on main #3224.

CI

On main 184b15d the pr CTest preset filter matches none of the three tests, so Build and test on Windows does not run them.

@JohnConnorNPC
JohnConnorNPC merged commit c3259f2 into R0Y00:main Nov 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants