Repository navigation
Description
Part of #2935 (item "Samplers": only constant sampler words are accepted, and there is no sampler-heap path). Related: #1143 (the Python translator's default-sampler shortcut for register-offset sampler-heap loads).
Problem. In slot 67 compute requests whose root sets both heap-indexing flags (0xc00), the entry SGPR after the resource heap holds the sampler heap base. Programs copy it into an even SGPR pair with a zero high word and load a sampler with s_load_dwordx4 (or two with s_load_dwordx8) at a 16-byte aligned immediate offset, then sample with image_sample_lz / image_sample_l. The native translator marks only the resource heap SGPR (src/gfx1013_compute_native.cpp, translate_program), so such a load is refused ("direct descriptor address outside bound table"), and sampler_index accepts constant sampler words only ("nonconstant sampler").
On a local start-up capture (counts only, compile_dxil at 36d2cbeb): 1,830 of 2,689 compute requests sample or gather, and 993 load at least one sampler from memory. On main this is never the first refusal yet. With the GPU-selected heap chain of #3023 applied locally (#3034, #3042, #3063, contract forced by an uncommitted switch), 130 requests stop first at such a sampler-heap load.
Plan.
- Translator (this issue's first PR, target
main): mark the sampler-heap entry SGPR; accepts_load_dwordx4/x8through it at a 16-byte aligned immediate offset; read the sampler asSamplerDescriptorHeap[offset / 16](createHandleFromHeapwith the sampler-heap flag, module flag0x80000000, root flagSAMPLER_HEAP_DIRECTLY_INDEXED) for explicit-LOD, non-comparison samples. Everything else through the sampler heap (SGPR offsets, scalar buffer loads, comparison, gather, bias, gradients, implicit LOD) is refused with a named reason. No manifest is published for such a program, and the in-process route keeps refusing it, so nothing reaches a run yet. - Runtime (follow-up): bind a mirrored sampler heap with index parity for natively translated compute, as the draw path already does for heap-indexed roots.
Test. Source-built .c67 requests (DXC root signature with both heap flags) dispatched on hardware with a shader-visible sampler heap: the result changes with the address mode stored in heap entry 67 and not with neighbouring entries; two samplers from one dwordx8 load; the sampler's LOD clamp applies to image_sample_l. Compile refusals for the unsupported shapes. _warp skips (wave32), like the other native execution tests.
I'm taking it; a PR follows. Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3080.
AI-assisted.
Activity
JB2WIN commentedon Nov 27, 2026
Stage 1 (translator) is in #3140: fixed-index samplers from the directly indexed sampler heap become
SamplerDescriptorHeap[index]forimage_sample_l/image_sample_lz; everything else through the sampler heap is refused with a named reason. No manifest is published for such a program and the in-process route refuses it, so nothing reaches a run yet.Stage 2 (runtime) has to bind a sampler heap for natively translated compute with index parity (entry n = title byte offset 16·n),
dynamic_sampler()decoding, and entry 2047 as the fallback (the translator never reads 2047).AI-assisted.
native: read fixed-index samplers from the directly indexed sampler h…
JB2WIN commentedon Nov 28, 2026
Taking stage 2 (runtime sampler-heap binding for natively translated compute), on
main. I will build on #3154 where the two touchtranslate_compute_nativelyand keep the change separate from #3199.AI-assisted.
coordination: claim native/sampler-heap-runtime (R0Y00#3076 stage 2: …
JB2WIN commentedon Nov 28, 2026
Impact check for stage 2a (runtime binding of the sampler heap on the published route), before building it.
I ran
compile_dxil --jobs 8 gfx1013-direct-cs@0 --requests(main86beae95) on a copy of my 2,689 slot 67 compute requests: 488 compile, 206 publish a manifest, and 282 compile without one. None of the 282 has aheap_samplerbinding, and none of the 2,201 refusals is sampler related. Not-Saii's 84 in #3224 show none either.So stage 2a would unblock 0 programs here. I'm pausing it. The design stays in my notes, and I'll pick it up if a capture shows programs that read the sampler heap on this route.
AI-assisted.