Repository navigation
runtime: bind the title's sampler heap for published native compute - #3540
Conversation
Refs R0Y00#3076 (stage 2a). A native compute program that reads the directly indexed sampler heap (SamplerDescriptorHeap[i], fixed index) now gets a published runtime manifest and runs through the stand-in's Dispatch path with the title's sampler heap bound. - format_compute_runtime_manifest writes the one heap_sampler binding as the last line before `native`: `smpidx <bytes>`. Any other shape keeps the reason "sampler heap" and publishes nothing. - load_compute_translation reads `smpidx` once (whole 16-byte entries, at most 16 * 2047) and refuses anything else with a named reason. - create_translated_root takes extra root flags; a translation with smpidx gets SAMPLER_HEAP_DIRECTLY_INDEXED. - record_translated_dispatch refuses "no sampler heap is set on the list", "sampler heap creation failed" and "the sampler heap is smaller than the program reads" before any descriptor is taken, and otherwise binds the draw path's snapshot of the title heap (entry n = title byte 16 * n) before the root. Out of scope: the in-process route (R0Y00#3154), dynamic_sampler, create_sampler_snapshot_heap and decode_statics (R0Y00#3199). Tests: native_compute_manifest_sampler_heap (CPU), native_sampler_heap_check.py (the published manifests are exact), startup_compute_dispatch_sampler_heap_{warp, hardware} (new stand-in consumer mode sampler-heap: entry 67 of a title heap is sampled, decoys in slot 67 change the output, refusals and the 68-entry boundary). AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the five stage 2a reasons, plus the output UAV element-limit reason from main, to COMPUTE_DISPATCH_REASONS so startup_triage_run_check.py covers them. AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The Linux Python job failed in AI-assisted. |
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed 37a6b269 by reading the diff; not built or run.
Verdict: approve. The writer and the reader agree on the one shape they accept: a single heap_sampler binding of whole 16-byte entries below entry 2047 (src/direct_compute_cache.cpp:948-959, d3d12_compute_dispatch.inl:433-437). Every other shape keeps the old reasons. The heaps are bound before SetComputeRootSignature, and every new refusal comes before a view descriptor is taken. No MUST.
- SHOULD
"sampler heap creation failed"(d3d12_compute_dispatch.inl:1309) is the only new reason missing fromCOMPUTE_DISPATCH_REASONS.startup_triage_run_check.pydoes not catch it, because itsreason_startpattern only collects literals that start with a/an/the/no/…. Sotriage_run.pywould report this refusal asother (text omitted), the case that check exists to prevent. Rewording it to "the sampler heap could not be created" and listing it fixes both. - SHOULD At
:268the PR returns "the device does not take a directly indexed sampler heap" for anycreate_translated_rootfailure whensmpidxis set. Serialisation or root creation can also fail for other reasons (parameter count, static samplers), and this text would hide those. Checking the resource binding tier first, or keeping "root signature creation failed" for other HRESULTs, would make the reason reliable. - Checked:
prepare_draw_sampler_heapsetssampler_snapshoton everytruereturn, so the->countdereference at:1310is safe. A program withoutsmpidxkeeps the bound sampler heap. #3542 adds the same #3471 reason line, andgit merge-treeof the two heads merges cleanly.
Tests: native_compute_manifest_sampler_heap proves the writer text and its refusals. startup_compute_dispatch_sampler_heap_hardware proves the dispatch, the decoys and each size refusal, and the smpidx-removed control shows the root flag matters. The _warp variant exits 77 after the reader checks. Neither test is in the pr preset filter, so CI ran only the Linux triage check; the dispatch evidence is the author's RTX 3080 run.
Reword "sampler heap creation failed" to "the sampler heap could not be created" and list it in COMPUTE_DISPATCH_REASONS, so triage_run.py counts it under its own name instead of "other (text omitted)". Name the missing directly indexed sampler heap capability only when the root failed on an adapter that reports shader model below 6.6; any other root creation failure keeps "root signature creation failed". The decision is compute_root_refusal(), checked without a device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mpler heap root compute_root_refusal now takes whether the root serialised. A serialisation failure is always "root signature creation failed"; the directly indexed sampler heap text needs a serialised root with the flag that CreateRootSignature refused on an adapter below shader model 6.6 or resource binding tier 3. That is an inference from reported capabilities, not proof. The check covers all eight combinations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two compute root refusal texts moved into translated_sampler_bindings.h, which the allowlist check did not read. Scan that function too, so a new or misspelt reason there fails the check. Query the adapter only when the root took the sampler heap flag and serialized, and spell "serializ..." as the rest of the code does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, both addressed in 170d676, 376dc82 and 8d5163e.
Targeted ctest: 16 run, 14 passed, 2 WARP skips. AI-assisted. |
…tion (#3626) install_compute_translation copied every field of a loaded candidate except sampler_heap_bytes (#3540's `smpidx`). The root keeps its SAMPLER_HEAP_DIRECTLY_INDEXED flag, but the dispatch then sees a zero span, binds only the view heap and sets that root without a sampler heap: a debug-layer error, and the program reads no samplers. Co-authored-by: lukaslw-lab <291379150+lukaslw-lab@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Change
#3076 stage 2a. A native compute program that reads samplers from the directly indexed sampler heap at a fixed index (stage 1,
SamplerDescriptorHeap[i]) now gets a published runtime manifest, and the stand-in's Dispatch binds the title's sampler heap for it. Until nowcompile_dxil --requestspublished no manifest for such a program.format_compute_runtime_manifest): the singleheap_samplerbinding is taken out of the view bookkeeping before the sort, stride and contiguity loops, and written assmpidx <bytes>after the static sampler lines. Exactly one binding, with rootcompute_sampler_heap, register 0 and a span of whole 16-byte entries up to 16*2047. Any other shape keeps the reasonsampler heap.load_compute_translation):smpidxis accepted once, with whole 16-byte entries below the fallback entry 2047. Otherwise the reason isa sampler heap span that is not 16-byte entries below the fallback.create_translated_rootgets a trailingextra_flagsparameter, and a translation withsmpidxaddsD3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED. Graphics callers are unchanged.prepare_draw_sampler_heap, keeping the list's fallback setting). It is bound with the view heap before the root signature. Refusals, all before a descriptor is taken:no sampler heap is set on the list,sampler heap creation failed,the sampler heap has no readable entries,the sampler heap is smaller than the program reads.Refs #3076, #3023. The in-process route is unchanged.
dynamic_sampler,create_sampler_snapshot_heapanddecode_staticsare not touched (#3199).Verification
Build on
2ff74a6a, Windows 11, NVIDIA GeForce RTX 3080.New
startup_compute_dispatch_sampler_heap_hardware, a stand-in dispatch through a title sampler heap in title memory with the debug layer on and no error:no sampler heap is set on the list;the sampler heap is smaller than the program reads;smpidxremoved from the.txtgivespipeline creation failed, which shows the root flag matters;smpidx 0,20,32768,-16and a secondsmpidx._warpruns the manifest and reader parts, then exits 77 (no 32-lane waves).New CPU test
native_compute_manifest_sampler_heap(24 checks): the exact text,smplplussmpidx, the binding placed first, between or last amongt0and a stride SRV with the same text, and nullopt for two bindings, a wrong root, or a bad span.native_sampler_heap_check.py: the "no.txt" assertion becomes the exact published manifest (SAMPLEsmpidx 1088, TWOsmpidx 1104, MIXEDsmpl 0 …thensmpidx 1088). This is the intended behaviour change.ctest -R "startup_compute|native_sampler|startup_sampler|direct_compute|native_compute": baseline 228 tests with 0 failures; after 231 with 0 failures. The skips are the same WARP cases plus the new one.Mutations, each rebuilt and run on hardware:
smpidx: the hardware test, the CPU test andnative_sampler_heap_hardwarefail;Evidence and follow-up
All fixtures are source-built (the stage 1 program and its CPU model, the stand-in's own heap). No game data.
Not covered by a test: the wrapper-only sampler heap path (a heap without title memory, refused as empty if no shadow heap is readable),
ExecuteIndirect, a draw and a sampler-heap dispatch alternating on one list, andsampler heap creation failed. The 1.0 root with the flag is verified on the RTX 3080 only. No revision bump: manifests published before keep their meaning, and only programs that had no manifest get one.On
mainthis publishes no extra local capture program, because those stop earlier, at the resource heap. It is groundwork for #3023 stage 3, wheregather through the sampler heapfollows next.Checklist
docs/experiments/native-sampler-heap.md)AI-assisted.
🤖 Generated with Claude Code