Repository navigation
runtime: bind published typed buffer inputs with 32-bit components - #3386
Conversation
format_compute_runtime_manifest writes `srv <i> typed table <param> <byte> bytes <n>` for a typed_buffer_srv (buffer_load_format_*, read as Buffer<uint4>), n being the widest load. The stand-in resolves the title's hardware descriptor or slot 18 typed buffer view token as a buffer range and binds a UINT view of its 32-bit components; every other shape is refused with a named reason. 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>
|
Measured Of the 112 programs that stopped at
No other program changed manifest state. Whether the 22 bind at Dispatch (the 32-bit FORMAT check) is not measured here; that needs a run. |
Leyukaka
left a comment
There was a problem hiding this comment.
Reviewed 4a2720e0.
Run on a release build of main f2972840 with this PR and 17 other open PRs merged locally, Windows Sandbox, network off, vGPU:
startup_compute_typed_buffer_srv_controlspasses.startup_compute_typed_buffer_srv_hardwarepasses on the hardware backend (the Sandbox's only GPU is the NVIDIA GeForce RTX 5080 vGPU). It covers 50 elements and then zeros for 1 to 4 components, the slot 18 token, and 4/6/6/7 refusals._warpskips (77): WARP has no 32-lane wave.
Test gaps. Each mutation below still passes _hardware:
- The input view always starts at element 0. In
dispatch-records32the descriptor addresses the first byte of the placed input buffer, and the slot 18 token view hasFirstElement0. Mutation:src/startup_stubs/d3d12_compute_dispatch.inl:160view.Buffer.FirstElement = range.offset / element->0. Add a dispatch whose descriptor base is4 * channelsbytes into the input buffer, and expect the words shifted by one element. - The whole-element check has no case. Mutation:
:155droprange.offset % element ||. Add, for 2 or more channels, a descriptor base 4 bytes into the input buffer. It should be refused witha typed input range does not start at a whole elementand leave the output untouched. - Only the FLOAT codes are dispatched (22, 64, 74, 77). Mutation:
:111case 20: case 21: case 22: return 1;->case 22: return 1;(the same holds for the 62/72/75 rows). Add dispatches with FORMAT 20 (UINT) and 21 (SINT), expecting the same raw words. - No case sets word 1 bit 30 or 31. Mutation:
:145drop(words[1] >> 30) ||. Add stride field0x4000 | 4 * channels, which sets bit 30 and keeps the 14-bit stride equal to the element size. It should be refused witha typed input descriptor is swizzled or not bounds-checked by record.
Request changes for the test gaps above.
…bits Review of R0Y00#3386: four mutations of the typed input view still passed. The hardware check now also reads each width through its UINT and SINT FORMATs and through a descriptor based one element into the buffer (new consumer mode dispatch-records32-input-at-<bytes>), and refuses a base 4 bytes in (2 or more components) and a stride field with bit 30. Refs R0Y00#3224 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… bits The gaps the R0Y00#3386 review found in the typed input check exist for the typed outputs too. Each stored width now also writes through its UINT and SINT FORMATs and through a descriptor 8 bytes into the output buffer (shifted for 1 and 2 components, refused as not element-aligned for 3 and 4), and a stride field with word 1 bit 30 is refused. Refs R0Y00#3224 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Leyukaka Thanks. All four gaps were real, and each now has a case that fails under its mutation. Fixed in
Each mutation was applied on its own, the shim rebuilt, and #3397 (typed outputs, stacked on this PR) had the same four gaps, so I added the matching cases there: UINT/SINT stores, a base 8 bytes into the output (shifted for 1 and 2 components, refused as not element-aligned for 3 and 4), and word 1 bit 30. Under the same procedure, the output AI-assisted. |
KelboLive
left a comment
There was a problem hiding this comment.
LGTM — clean input-side of typed buffer route.
Adds typed_dword_format_channels and typed_dword_input_view for published srv typed inputs. Manifest formatter emits srv <reg> typed table <param> <byte> bytes <n> lines; dispatch stub resolves table entries, binds UINT views of 32-bit components, and refuses invalid descriptors with precise reasons. Follows the same patterns as #3397 (typed outputs). Test fixture covers 1–4 components with comprehensive refusal controls.
Ready to land.
KelboLive
left a comment
There was a problem hiding this comment.
LGTM — clean input-side of typed buffer route.
Adds typed_dword_format_channels and typed_dword_input_view for published srv typed inputs. Manifest formatter emits srv <reg> typed table <param> <byte> bytes <n> lines; dispatch stub resolves table entries, binds UINT views of 32-bit components, and refuses invalid descriptors with precise reasons. Follows the same patterns as #3397 (typed outputs). Test fixture covers 1–4 components with comprehensive refusal controls.
Ready to land.
Leyukaka
left a comment
There was a problem hiding this comment.
Reviewed da4fe59c. It changes only tests and docs since 4a2720e0. The four test gaps from that review are covered in tests/startup_compute_typed_buffer_srv_check.py:
- Nonzero
FirstElement(:128): each width dispatchesdispatch-records32-input-at-<4n>and expects the words shifted by one element. - Whole-element check (
:143): for 2 or more components, a base 4 bytes in is refused witha typed input range does not start at a whole elementand the output stays untouched. - Integer FORMATs (
:28,:126-127): 20/21, 62/63, 72/73 and 75/76 are dispatched and expect the same words. - Word 1 bit 30 (
:136): stride field0x4000 | 4nis refused.
A local run, release build of main 212d4b5f with da4fe59c and five other pending changes merged:
startup_compute_typed_buffer_srv_controlsand_hardwarepass;_warpskips (77).- The only failure among the merged changes' tests is
startup_compute_dispatch_output_warp, the existing failure onmainthat #3394 fixes. - Dropping
range.offset % element ||(src/startup_stubs/d3d12_compute_dispatch.inl:155) makesstartup_compute_typed_buffer_srv_hardwarefail.
Not covered: PR CI builds the change, but the pr test preset includes none of startup_compute_typed_buffer_srv_*, so CI does not run these checks.
#3397 is stacked on this PR, so this one should merge first.
Approve da4fe59c.
|
This branch conflicts with Resolution: keep main's #3397 is stacked on this head and conflicts in the same two files, so it needs the same merge afterwards. Nothing else is open from my review; the approval is on |
|
Re-review of head MUST
SHOULD
NIT
AI-assisted. |
main added an optional identity_dst_sel suffix to the srv buf table line in the manifest writer and the stand-in parser. Keep both, with the typed table branch after each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… cases The typed input reader took a slot-18 token's record by id, so a content token (X2W_D3D12_VIEW_CONTENT_TOKENS=1) was refused as not a typed buffer view. It now uses token_view, as the other buffer readers do. Tests for checks that no case reached: - word 1 bit 31, and word 3 INDEX_STRIDE and ADD_TID, are refused; - an all-zero input descriptor reads zeros (consumer mode dispatch-records32-input-null); - typed_buffer_srv wider than 16 bytes or not whole dwords gets no manifest; - an indirect Dispatch with an srv typed line is refused. The doc states that this binding is on the manifest route only, which a default run (X2W_NATIVE_SHADERS_ONLY=1 since R0Y00#3449) does not take. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main added cube SRV manifest reasons and dispatch-cube consumer modes next to this branch's typed rows and records32 modes. Keep both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Leyukaka @JohnConnorNPC Thanks. Head is now Conflict. JohnConnorNPC's points:
Leyukaka's gaps 2–4 from the #3397 review are in lines from this PR, so the cases are here:
Each mutation was applied alone, the shim rebuilt and the check run, then reverted. Without mutations, on AI-assisted. |
Leyukaka
left a comment
There was a problem hiding this comment.
Reviewed 4cd38c90 against main 8a30428a. Diff reading only, nothing run.
Since da4fe59c:
- Merges (
d2acde2b,4cd38c90):main'sidentity_dst_selwriter and parser branches are kept and thetyped tablebranch follows each (src/direct_compute_cache.cpp:969,src/startup_stubs/d3d12_compute_dispatch.inl:339). The cube rows anddispatch-cubemodes sit next to the typed ones.git merge-tree origin/main 4cd38c90exits 0. - Runtime (
a3854d64): one change.typed_dword_input_viewreads the token withtoken_view(d3d12_compute_dispatch.inl:175) instead of indexingview_records()itself. For an id token this is the same lookup under the same lock. For a content token, words 4-7 are present because the caller reads the entry withread_buffer_words(:855). - Tests, in
tests/startup_compute_typed_buffer_srv_check.py: all-zero descriptor reads zeros (:130), word 1 bit 31 (:141), INDEX_STRIDE (:142), ADD_TID (:143). TwoSRV kind typed_buffer_srvrows, 20 and 6 bytes (tests/native_compute_manifest_reasons.cpp:70,:74). Indirect refusal of ansrv typedline (tests/startup_slot67_indirect_dispatch_check.py:209). - Doc: manifest route only (
docs/experiments/compute-typed-buffer-inputs.md:35); control counts 8, 11, 11 and 12 (:65) match the script (8 base, 3 more for 2 or more components, 1 token case for 4).
JohnConnorNPC's points 1 to 5 are addressed by the above. Point 6 (12-byte elements on the snapshot path) is unchanged: such an input is refused by name, not misread.
Not covered:
- A content token (
X2W_D3D12_VIEW_CONTENT_TOKENS=1) throughtoken_viewhas no case, as the body says. - The
prtest preset still includes none ofstartup_compute_typed_buffer_srv_*,native_compute_manifest_reasonsorstartup_slot67_indirect_dispatch_*, so the green CI builds these checks without running them. The mutation results are the author's.
Approve 4cd38c90.
format_compute_runtime_manifest writes `uav <i> typed table <param> <byte> bytes <n>` for a typed_buffer_uav (buffer_store_format_*, an RWBuffer<uint4>). The stand-in binds it as a UINT typed UAV: a hardware descriptor through the output path of the #3302 D16 stores, with the FORMAT checks of the #3386 typed inputs (now shared) and an exact component width; a slot 19 token through native_buffer_store_view, the native route's typed-store contract. Typed UAV store support is checked by one helper for both half and 32-bit typed outputs. Refs #3224 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* compute: publish comparison_texture_srv and smpc manifests Refs #3224, #2935. In the refreshed #3224 census after #3386 and #3397 landed, SRV kind comparison_texture_srv 2d was the largest remaining unclaimed compiled, no runtime manifest item (33 shaders / 52,008 dispatches). The dispatch reader and the graphics manifest already supported comparison textures and smpc lines; only format_compute_runtime_manifest refused both. - src/direct_compute_cache.cpp: accept comparison_texture_srv alongside texture_srv for a single view of dimension 1D, 2D, 3D or 2D array, emitting the same srv tex line; a cube comparison stays a different kind (cube_comparison_srv) and stays refused by name. A comparison sampler is published as smpc, never smpl: the comparison wins over the LOD limits, as in format_graphics_runtime_manifest and the dispatch reader. The obsolete comparison sampler refusal is gone. - tests/native_compute_manifest_reasons.cpp: publish comparison_texture_srv for all four dimensions, keep the cube-comparison and array refusals, add comparison_texture_srv cube/array refusals, and publish a mixed smp 0, smpl 1, smpc 2 order plus a lone smpc 0. - tests/startup_compute_comparison_srv_check.py: end-to-end coverage for the sampled program (plain + comparison samples of one 2D texture). No-argument controls run on Linux; compile mode publishes through compile_dxil --requests and checks the manifest lines; warp/hardware modes dispatch the published program without X2W_NATIVE_SHADERS and match every volume word against the CPU model, with a wrong-view control (tex3d rewrite refused) and a cube control (DXIL published, no manifest, no translation). Registered in tests/cmake/startup_compute_comparison_srv.cmake and tests/checks/python-linux/comparison-texture-manifest.txt. - Docs: new docs/experiments/compute-comparison-texture-manifest.md, and the stale comparison-sampler refusal notes in docs/experiments.md, docs/experiments/native-compile-dxil-refusals.md and docs/experiments/startup-compute-comparison-sampler.md updated. Linux verification (origin/main 77d63db): form_coverage_check.py, docs_links_check.py and bidi_controls_check.py pass, py_compile passes, git diff --check is clean, the new check's pure-Python controls pass, and native_compute_manifest_reasons passes 0 of 45 manifest reasons wrong against a verbatim extract of the formatter (the full C++ build needs Windows). 5/5 spot-mutations killed on throwaway copies: revert the comparison_texture_srv branch, emit smp instead of smpc, admit dimension 3, let smpl win over smpc, drop the array_count guard. Windows verification (compile_dxil, native CTest, GPU readback) is pending. * test: expect cube comparison shader to compile in comparison SRV controls compile_dxil --requests compiles the cube comparison shader to .cs.cso (requests=1 compiled=1 refused=0) and emits no_manifest for it, so the controls check wrongly expected requests=1 compiled=0 refused=1. Refs #3224, #2935 * compute: publish comparison_texture_srv only for 2D and 2D array The direct translator refuses a compare op unless the dimension is 1, 3 or 5, and dimension 3 is the cube kind, so only tex2d and tex2da can reach the comparison branch of format_compute_runtime_manifest. Restrict it to those two and refuse 1D/3D comparisons by name, like the cube. Refs #3224, #2935 --------- Co-authored-by: Ammar Abdelfattah <241957358+Ammmae0x@users.noreply.github.com>
Refs #3224
Behavior
In the #3224 census,
SRV kind typed_buffer_srvis the largest gap between compiling a compute program and publishing its manifest. These are programs that read withbuffer_load_format_xto_xyzw(MUBUF, element index only), which the direct compiler reads as aBuffer<uint4>.src/direct_compute_cache.cpp):format_compute_runtime_manifestwritessrv <register> typed table <parameter> <byte> bytes <n>.nis 4 bytes per component of the widest load on that binding;required_bytesis already the maximum over the binding's loads.src/startup_stubs/d3d12_compute_dispatch.inl): the dispatch path resolves the table entry with the existingindirect_table_bufferrange rules and binds a UINT buffer view (R32_UINTtoR32G32B32A32_UINT) over it. A UINT view returns the same bits as the guest format unit only for 32-bit UINT, SINT and FLOAT components, so only those are bound:token_view, so content tokens decode as in the other buffer readers, then checked with JB2WIN'styped_dword_channels/typed_dword_uint_formatfrom the heap contract (native: read one-channel typed loads through a GPU-selected heap descriptor #3042).docs/experiments/compute-typed-buffer-inputs.md). A typed input on an indirect Dispatch is refused.Manifest route only. Since #3449 the launchers set
X2W_NATIVE_SHADERS_ONLY=1, andload_compute_translationreturns before it reads<key>.txt. A default run therefore does not use this binding: the in-process route (translate_compute_natively) is unchanged and still refusestyped_buffer_srvwithview kind 1 is not bound for a natively translated program. The binding applies to runs withX2W_NATIVE_SHADERS_ONLY=0andcompile_dxilmanifests. Binding the kind on the in-process route is a separate change.Not in this PR:
packed_d16_x_uav(compute: publish packed_d16_x_uav runtime manifest (Part of #3224) #3389) is merged; this branch mergesmainafter it.Tests
tests/startup_compute_typed_buffer_srv_check.py(tests/cmake/startup_compute_typed_buffer_srv.cmake) uses the published route:compile_dxil --requests→<key>.txt→ slot 14 Dispatch on the stand-in._controls(no GPU): source-built programs for 1 to 4 components publishsrv 0 typed table 1 0 bytes 4n._warp/_hardware: for each width, a 32-bit FLOAT descriptor of 50 elements.R32G32B32A32_FLOATview token (new consumer modedispatch-srv-token-typed).dispatch-records32-input-at-<bytes>); the words read shift by one element.dispatch-records32-input-null).no translation.tests/native_compute_manifest_reasons.cpp: atyped_buffer_srvof 20 bytes or of 6 bytes gets no manifest (SRV kind typed_buffer_srv).tests/startup_slot67_indirect_dispatch_check.py: with its manifest line replaced bysrv 0 typed table 1 0 bytes 4, the indirect Dispatch is refused withrequires fixed-table raw buffers.Verification
Branch head
4cd38c90=da4fe59c(review cases) + a merge ofmaine3f9a64f(d2acde2b) +a3854d64(review fixes) +0663f6ed(measurements) + a merge ofmain8a30428a(4cd38c90). Measured at0663f6edand again at4cd38c90. Windows 11 build 26300, MSVC x64 Debug, Windows SDK 10.0.26100 DXC, D3D12 debug layer enabled._controls,native_compute_manifest_reasons(38 cases) andstartup_slot67_indirect_dispatch_hardware: passed._hardware, NVIDIA GeForce RTX 4090, driver 32.0.16.1088: passed. 1, 2, 3 and 4 components read 50 elements and then zeros, the UINT and SINT FORMATs read the same words, a base one element in shifts them, an all-zero descriptor reads zeros, the token reads the same elements, and 8, 11, 11 and 12 refusal controls passed. No debug layer errors.da4fe59c):FirstElement→ 0, the dropped whole-element check, each FORMAT row, and the dropped word 1 bits.0xfff80000→0xff000000fails at INDEX_STRIDE;(words[1] >> 30)→((words[1] >> 30) & 1)fails at bit 31; dropping the all-zero branch fails the null input (expected 00000000, read c5c5c5c5); dropping|| slot.typed_bytesfrom the indirect refusal failsstartup_slot67_indirect_dispatch_hardware._warp, Microsoft Basic Render Driver: capability skip (77). WARP reports 4-lane waves and the direct module needs 32.da4fe59c): with the stand-in's parse of thetypedline disabled,_hardwarefails at word 0 (expected 8b02a7f1, read c5c5c5c5).X2W_D3D12_VIEW_CONTENT_TOKENS=1) throughtoken_view.AI-assisted.
🤖 Generated with Claude Code