Repository navigation
runtime: bind typed buffer views on the in-process compute route - #3460
Conversation
translate_compute_natively accepted neither typed_buffer_srv nor typed_buffer_uav, so since X2W_NATIVE_SHADERS_ONLY=1 became the launcher default the typed bindings from the manifest route never ran. Set typed_bytes on the slot for widths of 4 to 16 bytes, as the manifest parser does, and route typed stores to the UAV list. The typed SRV and UAV checks gain a native route. Refs R0Y00#3224 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Leyukaka
left a comment
There was a problem hiding this comment.
Read at 5682601 against main 5de0b11 (3 commits, 6 files). Diff reading only, nothing built or run.
What it fixes. With X2W_NATIVE_SHADERS_ONLY=1, load_compute_translation returns before it reads <key>.txt (d3d12_compute_dispatch.inl:280-283), so only translate_compute_natively can bind a compute program, and its binding loop threw view kind 1/8 is not bound for typed_buffer_srv / typed_buffer_uav. The change accepts both kinds there, so the default path now binds them. The manifest route is not touched.
Checked.
- The native route sets the same
Slot::typed_bytes(:566) that the manifest parser sets (:366,:392). Everything after that is the existing shared code: the indirect refusal (:839), the typed input view (:1022-1025) and the typed store contract (:1087-1088,:1160-1188). - The accepted widths are the ones
compile_dxilwrites atypedline for (direct_compute_cache.cpp:969-970,:1001-1002).array_count != 1is refused at:554, as the writer requires. - A
typed_buffer_uavof another width goes to the UAV list (:539-540), then failssupportedand throws the sameview kind 8message as before. - The new
nativeruns fail if the route is not taken:translated()requirestranslated nativelyand nonot translated natively. Aview kindrefusal is not inCAPABILITY_REFUSALS, so it cannot turn into a skip (77).
NITs, none blocking.
- The width test
required_bytes && <= 16 && % 4 == 0now exists in 5 places:direct_compute_cache.cpp:969-970and:1001-1002,d3d12_compute_dispatch.inl:364,:390and:537-538. A shared helper, likex2w::native_half_buffer_formatforbufhalf, would keep them from drifting. tests/startup_compute_typed_buffer_srv_check.py:132andtests/startup_compute_typed_buffer_uav_check.py:150: the new assert has 13 spaces beforeresult.stderr[-3000:]on a 151-column line. It looks like a lost line break. Valid Python.assert keys and not published(srv_check.py:179,uav_check.py:210): thenot publishedhalf cannot fail. The native branch never callspublish, and the runtime only reads<key>.txtand<key>.cs.cso(d3d12_compute_dispatch.inl:286,:450); nothing in it writes those or<key>.fail. The check that does guard the route is thetranslated nativelyassert.- The PR body still says it is stacked on #3397 and #3386 and that the diff includes their commits. Both are merged, and the diff against main is the 3 commits only.
Review of R0Y00#3460: one helper, x2w::typed_dword_view_bytes, replaces the five copies of the 4-to-16-byte test in compile_dxil's writer, the manifest parser and the in-process route. The native checks lose a cache assertion that could not fail (nothing on that route writes <key>.txt, .cs.cso or .fail); the translated-natively assertion is what guards the route. Also rewraps that assertion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. All four are fixed in 8f2e448:
Rebuilt (Debug) on the RTX 4090, driver 32.0.16.1088, Windows build 26300. AI-assisted (Claude Code). |
Leyukaka
left a comment
There was a problem hiding this comment.
Re-read at 8f2e448f (delta 56826014..8f2e448f, one commit). Diff reading only, nothing built or run.
The four points from my review of 56826014 are addressed:
- Width test: one helper,
x2w::typed_dword_view_bytes(src/gfx1013_compute_native.h:76), used atdirect_compute_cache.cpp:970,:1002andd3d12_compute_dispatch.inl:364,:390,:538. No other copy of the predicate is left insrc. - Assert line break:
native_okis computed on its own line (srv_check.py:132-133,uav_check.py:150-151), same logic. not published: theif native:cache block is removed from both checks, anddocs/experiments/compute-typed-buffer-inputs.md:146no longer claims it. Thetranslated nativelyassert still guards the route.- PR body: no longer says it is stacked on #3397 and #3386.
No new issue found in the delta.
Refs #3224
What
Since #3449 the launchers set
X2W_NATIVE_SHADERS_ONLY=1, soload_compute_translationnever reads<key>.txt, and thesrv/uav <i> typedbindings from #3386 and #3397 did not run in a default run (pointed out in review). The in-process route,translate_compute_natively, refused both kinds withview kind 1/8 is not bound for a natively translated program.This change makes
translate_compute_nativelyaccepttyped_buffer_srvandtyped_buffer_uavwhenrequired_bytesis 4, 8, 12 or 16. That is the testcompile_dxilapplies before it writes atypedline, now one helper (x2w::typed_dword_view_bytes) shared by the writer, the manifest parser and this route. A typed store goes to the UAV list, and the slot'styped_bytesis set as the manifest parser sets it. From there the existing dispatch path does the binding: UINT views, tokens, and every named refusal.No shader or root-signature change: both routes compile the same
translate_compute(request, 0, true)module (Buffer<uint4>,RWBuffer<uint[n]>), and the root signature has no per-kind ranges. A typed view selected from the resource heap is still refused, because its root parameter is above 15.Test
tests/startup_compute_typed_buffer_{srv,uav}_check.pytake a newnativeargument. It setsX2W_NATIVE_SHADERSandX2W_NATIVE_SHADERS_ONLY=1, skips publication, and runs the same cases and refusal controls. On top of that it requirestranslated natively(and nonot translated natively) on every translated Dispatch.Results at 087b17c, Debug, Windows build 26300, NVIDIA GeForce RTX 4090 driver 32.0.16.1088, debug layer enabled:
_native_hardware, inputs: passed (26.6 s). 1 to 4 components read 50 elements and then zeros, plus the 4-component token, with 8/11/11/12 refusal controls._native_hardware, outputs: passed (21.5 s). 1, 2 and 4 components plus the tokens; the 3-component store is refused (no R32G32B32 typed UAV), with 7/8/8/9 refusal controls._hardwarechecks, both_controlstests andstartup_compute_dispatch_native_hardware: passed (no regression)._warptests: capability skip (77). WARP runs 4-lane waves.After the review fixes (8f2e448, Debug rebuild): the same 11 tests give 7 passed and 4 WARP skips (77), and
native_compute_manifest_reasons/_requestspassed.Negative control: I reverted
d3d12_compute_dispatch.inlto 4932e06. Both native hardware checks then fail at word 0 with the sentinelc5c5c5c5, and the log showsnot translated natively: view kind 1 is not bound for a natively translated program(kind 8 for outputs), thenDispatch(3, 2, 2) refused: no translation.This covers source-built fixtures only. It does not show that any title program dispatches correctly.
AI-assisted (Claude Code).
🤖 Generated with Claude Code