runtime: bind typed buffer views on the in-process compute route #3460
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3460"
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 Not-Saii on 2026-11-29T14:40:04Z.
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
087b17ca, 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 (
8f2e448f, Debug rebuild): the same 11 tests give 7 passed and 4 WARP skips (77), andnative_compute_manifest_reasons/_requestspassed.Negative control: I reverted
d3d12_compute_dispatch.inlto4932e061. 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
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T15:03:26Z.
Review: APPROVED
Read at
56826014against main5de0b114(3 commits, 6 files). Diff reading only, nothing built or run.What it fixes. With
X2W_NATIVE_SHADERS_ONLY=1,load_compute_translationreturns before it reads<key>.txt(d3d12_compute_dispatch.inl:280-283), so onlytranslate_compute_nativelycan bind a compute program, and its binding loop threwview kind 1/8 is not boundfortyped_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.
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).compile_dxilwrites atypedline for (direct_compute_cache.cpp:969-970,:1001-1002).array_count != 1is refused at:554, as the writer requires.typed_buffer_uavof another width goes to the UAV list (:539-540), then failssupportedand throws the sameview kind 8message as before.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.
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.Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-29T15:17:53Z.
Thanks. All four are fixed in
8f2e448f:x2w::typed_dword_view_bytesinsrc/gfx1013_compute_native.h, now replaces the five copies of the 4-to-16-byte test: the twocompile_dxilwriter branches, the two manifest parser lines and the in-process route.\continuation had been lost inside a heredoc.<key>.txt,.cs.csoor.fail. The docs no longer describe it.Rebuilt (Debug) on the RTX 4090, driver 32.0.16.1088, Windows build 26300.
startup_compute_typed_buffer_(srv|uav)_(native_)?(hardware|controls)andstartup_compute_dispatch_native_hardwarepassed. The four_warptests are capability skips (77).native_compute_manifest_reasonsand_requestspassed, which covers the writer refusals the helper now decides.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T15:36:28Z.
Review: APPROVED
Re-read at
8f2e448f(delta56826014..8f2e448f, one commit). Diff reading only, nothing built or run.The four points from my review of
56826014are addressed: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.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.No new issue found in the delta.