Skip to content

runtime: bind published typed buffer inputs with 32-bit components - #3386

Merged
JohnConnorNPC merged 8 commits into
R0Y00:mainfrom
Not-Saii:runtime/typed-buffer-srv
Nov 29, 2026
Merged

JohnConnorNPC merged 8 commits into
R0Y00:mainfrom
Not-Saii:runtime/typed-buffer-srv

Conversation

@Not-Saii

@Not-Saii Not-Saii commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Refs #3224

Behavior

In the #3224 census, SRV kind typed_buffer_srv is the largest gap between compiling a compute program and publishing its manifest. These are programs that read with buffer_load_format_x to _xyzw (MUBUF, element index only), which the direct compiler reads as a Buffer<uint4>.

  • Manifest (src/direct_compute_cache.cpp): format_compute_runtime_manifest writes srv <register> typed table <parameter> <byte> bytes <n>. n is 4 bytes per component of the widest load on that binding; required_bytes is already the maximum over the binding's loads.
  • Stand-in (src/startup_stubs/d3d12_compute_dispatch.inl): the dispatch path resolves the table entry with the existing indirect_table_buffer range rules and binds a UINT buffer view (R32_UINT to R32G32B32A32_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:
    • Hardware descriptor: FORMAT 20-22, 62-64, 72-74 or 75-77, stride equal to the element size, identity DST_SEL over the components read, unified FORMAT, structured bounds (OOB_SELECT 0), and no swizzle, index stride or ADD_TID.
    • Slot 18 typed buffer view token: read with token_view, so content tokens decode as in the other buffer readers, then checked with JB2WIN's typed_dword_channels / typed_dword_uint_format from the heap contract (native: read one-channel typed loads through a GPU-selected heap descriptor #3042).
    • All four words zero: a null buffer that reads zeros, as raw inputs already do.
  • Every other shape is refused before a dispatch is recorded, with one reason per check (listed in 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, and load_compute_translation returns 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 refuses typed_buffer_srv with view kind 1 is not bound for a natively translated program. The binding applies to runs with X2W_NATIVE_SHADERS_ONLY=0 and compile_dxil manifests. Binding the kind on the in-process route is a separate change.

Not in this PR:

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 publish srv 0 typed table 1 0 bytes 4n.
  • _warp / _hardware: for each width, a 32-bit FLOAT descriptor of 50 elements.
    • The 384 lanes store what they read, so the words past element 49 must be zero.
    • The 4-component case also reads through a slot 18 R32G32B32A32_FLOAT view token (new consumer mode dispatch-srv-token-typed).
    • Each width also reads through its UINT and SINT FORMATs, and through a descriptor based one element into the buffer (new consumer mode dispatch-records32-input-at-<bytes>); the words read shift by one element.
    • An all-zero descriptor reads zeros (new consumer mode dispatch-records32-input-null).
    • Refusal controls, each with the output untouched: an 8_8_8_8_UNORM FORMAT, a wrong stride, word 1 bit 30 or 31, word 3 INDEX_STRIDE or ADD_TID, OOB_SELECT 3, a legacy (RESOURCE_LEVEL 0) FORMAT, swapped X/Y DST_SEL, fewer channels than read, a base 4 bytes in (2 or more components), and an R8G8B8A8_UNORM token.
    • Before publication the dispatch reports no translation.
  • tests/native_compute_manifest_reasons.cpp: a typed_buffer_srv of 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 by srv 0 typed table 1 0 bytes 4, the indirect Dispatch is refused with requires fixed-table raw buffers.

Verification

Branch head 4cd38c90 = da4fe59c (review cases) + a merge of main e3f9a64f (d2acde2b) + a3854d64 (review fixes) + 0663f6ed (measurements) + a merge of main 8a30428a (4cd38c90). Measured at 0663f6ed and again at 4cd38c90. Windows 11 build 26300, MSVC x64 Debug, Windows SDK 10.0.26100 DXC, D3D12 debug layer enabled.

.\tools\dev.ps1
cmake --preset dev
cmake --build --preset dev --target compile_dxil d3d12_xs_shim startup_stream_consumer offscreen_check native_compute_manifest_reasons
ctest --preset dev --no-tests=error -V -R "^(startup_compute_typed_buffer_srv_(controls|warp|hardware)|native_compute_manifest_reasons|startup_slot67_indirect_dispatch_hardware)$"
  • _controls, native_compute_manifest_reasons (38 cases) and startup_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.
  • Mutations, each applied alone with the shim rebuilt, then reverted. Each fails its check:
    • Leyukaka's four from the first review (at da4fe59c): FirstElement → 0, the dropped whole-element check, each FORMAT row, and the dropped word 1 bits.
    • The new cases (on the runtime: bind published typed buffer outputs with 32-bit components #3397 tree, which shares these lines): word 3 mask 0xfff80000 → 0xff000000 fails 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_bytes from the indirect refusal fails startup_slot67_indirect_dispatch_hardware.
  • _warp, Microsoft Basic Render Driver: capability skip (77). WARP reports 4-lane waves and the direct module needs 32.
  • Negative control (at da4fe59c): with the stand-in's parse of the typed line disabled, _hardware fails at word 0 (expected 8b02a7f1, read c5c5c5c5).
  • Not covered by a test: a content token (X2W_D3D12_VIEW_CONTENT_TOKENS=1) through token_view.

AI-assisted.

🤖 Generated with Claude Code

Not-Saii and others added 3 commits November 28, 2026 19:51
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>
@Leyukaka

Copy link
Copy Markdown
Collaborator

Measured 4a2720e0 on the 878 untranslated requests of the 900 s census in #3224: compile_dxil <dxc dir> <cache> --jobs 8 gfx1013-direct-cs@0 --requests <request dir> <out dir>, built in a local integration of main f2972840 with this PR and 17 other open PRs (none of the others changes the manifest's SRV kinds). Baseline: the same requests on main d418f70e. Compile counts are unchanged (290 compiled, 588 refused); runtime manifests go from 124 to 146.

Of the 112 programs that stopped at SRV kind typed_buffer_srv:

Now Programs Dispatches
manifest published 22 163,511
UAV kind typed_buffer_uav 32 2,001,657
SRV kind comparison_texture_srv 2d 33 155,463
UAV kind indexed_atomic_uav 17 122,577
UAV kind unknown 4 18,843
UAV kind half_scalar_uav 4 14,141

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 Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_controls passes.
  • startup_compute_typed_buffer_srv_hardware passes 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.
  • _warp skips (77): WARP has no 32-lane wave.

Test gaps. Each mutation below still passes _hardware:

  1. The input view always starts at element 0. In dispatch-records32 the descriptor addresses the first byte of the placed input buffer, and the slot 18 token view has FirstElement 0. Mutation: src/startup_stubs/d3d12_compute_dispatch.inl:160 view.Buffer.FirstElement = range.offset / element -> 0. Add a dispatch whose descriptor base is 4 * channels bytes into the input buffer, and expect the words shifted by one element.
  2. The whole-element check has no case. Mutation: :155 drop range.offset % element ||. Add, for 2 or more channels, a descriptor base 4 bytes into the input buffer. It should be refused with a typed input range does not start at a whole element and leave the output untouched.
  3. Only the FLOAT codes are dispatched (22, 64, 74, 77). Mutation: :111 case 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.
  4. No case sets word 1 bit 30 or 31. Mutation: :145 drop (words[1] >> 30) ||. Add stride field 0x4000 | 4 * channels, which sets bit 30 and keeps the 14-bit stride equal to the element size. It should be refused with a 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>
Not-Saii added a commit to Not-Saii/Xbox2Windows that referenced this pull request Nov 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Not-Saii added a commit to Not-Saii/Xbox2Windows that referenced this pull request Nov 28, 2026
… 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>
@Not-Saii

Copy link
Copy Markdown
Contributor Author

@Leyukaka Thanks. All four gaps were real, and each now has a case that fails under its mutation. Fixed in da4fe59c, which changes only tests and docs.

  1. Nonzero FirstElement. New consumer mode dispatch-records32-input-at-<bytes> puts the input descriptor's base that many bytes into the buffer. Each width reads once with its base at 4 * channels and expects the words shifted by one element.
    Mutation view.Buffer.FirstElement = range.offset / element → 0: fails, 1 channels, base one element in: word 0 expected 8b06bba2, read 8b02a7f1.

  2. Whole-element check. For 2 or more channels, a base 4 bytes in must be refused with a typed input range does not start at a whole element, leaving the output untouched.
    Mutation that drops range.offset % element ||: fails, {'mode': 'dispatch-records32-input-at-4'}: word 0 expected c5c5c5c5, read 8b02a7f1 (the dispatch reads from element 0 instead of being refused).

  3. Integer FORMATs. Each width also reads through its UINT and SINT codes (20/21, 62/63, 72/73, 75/76) and expects the same words. I ran each row's mutation separately (keep only the FLOAT code); each fails at that width's UINT case:

    • row 1, case 22 only: 1 channels, FORMAT 20: word 0 expected 8b02a7f1, read c5c5c5c5;
    • row 2, case 64 only: 2 channels, FORMAT 62: ...;
    • row 3, case 74 only: 3 channels, FORMAT 72: ...;
    • row 4, case 77 only: 4 channels, FORMAT 75: ....

    All four read the sentinel, because the dispatch was refused.

  4. Word 1 bits 30/31. A stride field of 0x4000 | 4 * channels must be refused with a typed input descriptor is swizzled or not bounds-checked by record.
    Mutation that drops (words[1] >> 30) ||: fails, {'stride': 16388}: word 0 expected c5c5c5c5, read 8b02a7f1.

Each mutation was applied on its own, the shim rebuilt, and startup_compute_typed_buffer_srv_hardware run, then reverted. Without mutations, _controls and _hardware pass on da4fe59c: 1 to 4 components, the UINT/SINT FORMATs, the shifted base, the token, and 5/8/8/9 refusals. The setup was the NVIDIA GeForce RTX 4090, driver 32.0.16.1088, Windows 11 build 26300, Debug, with the debug layer enabled.

#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 FirstElement → 0, the dropped alignment check, rows 1, 2 and 4, and the bit 30/31 mutation all fail its _hardware check. The row 3 mutation is caught only by this PR's check: the RTX 4090 has no typed UAV store for R32G32B32, so no 3-component store reaches that row.

AI-assisted.

@Not-Saii
Not-Saii requested a review from Leyukaka November 28, 2026 20:28

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Nonzero FirstElement (:128): each width dispatches dispatch-records32-input-at-<4n> and expects the words shifted by one element.
  2. Whole-element check (:143): for 2 or more components, a base 4 bytes in is refused with a typed input range does not start at a whole element and the output stays untouched.
  3. Integer FORMATs (:28, :126-127): 20/21, 62/63, 72/73 and 75/76 are dispatched and expect the same words.
  4. Word 1 bit 30 (:136): stride field 0x4000 | 4n is refused.

A local run, release build of main 212d4b5f with da4fe59c and five other pending changes merged:

  • startup_compute_typed_buffer_srv_controls and _hardware pass; _warp skips (77).
  • The only failure among the merged changes' tests is startup_compute_dispatch_output_warp, the existing failure on main that #3394 fixes.
  • Dropping range.offset % element || (src/startup_stubs/d3d12_compute_dispatch.inl:155) makes startup_compute_typed_buffer_srv_hardware fail.

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.

@Leyukaka

Copy link
Copy Markdown
Collaborator

This branch conflicts with main 1990fead in src/direct_compute_cache.cpp and src/startup_stubs/d3d12_compute_dispatch.inl (one region each): main added an optional identity_dst_sel suffix to the srv N buf table line, in the writer and in the parser.

Resolution: keep main's buf table writer with the identity_dst_sel suffix and main's identity_dst_sel parser branch, then add this branch's typed table ... bytes branch after each.

#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 da4fe59c.

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Re-review of head da4fe59c against main 77d1ba4d (204 commits ahead of the merge-base). The binding logic reads correctly: FORMAT codes, stride, DST_SEL, the word3 0xfff80000 bound rule and NumElements = NUM_RECORDS all match the repo's decoder and indirect_table_buffer.

MUST

  1. Conflict with main. git merge-tree --write-tree --name-only origin/main da4fe59c exits 1 in src/direct_compute_cache.cpp and src/startup_stubs/d3d12_compute_dispatch.inl, one hunk each, against main's identity_dst_sel lines. The resolution posted at 12:06 is right: keep both branches. I also checked against main with runtime: bind four-channel and half4 texture UAVs on the native compute route #3398 merged, and the conflict is the same single hunk per file. runtime: bind four-channel and half4 texture UAVs on the native compute route #3398 adds nothing to it.

SHOULD

  1. No effect on the default launcher path. Since runtime: default to native shaders and Opus decoding #3449, the launchers set X2W_NATIVE_SHADERS_ONLY=1. load_compute_translation then returns at if (native_shaders_only()) { before it reads <key>.txt, so the new srv <i> typed table line is never parsed in a default run. translate_compute_natively still throws view kind 1 is not bound for a natively translated program for typed_buffer_srv, because its supported test has no typed branch. The change helps only -Translate or X2W_NATIVE_SHADERS_ONLY=0 runs with compile_dxil manifests. Please say so in the body and doc. A native-route binding (or a follow-up issue for one) is what would remove these refusals by default.
  2. Content tokens. typed_dword_input_view reads view_records()[words[1]] directly (grep -n 'view_records()\[words\[1\]\]' on the merged tree → if (known) record = view_records()[words[1]];). main's buffer readers use token_view(words, record, &created), which startup: opt-in content view tokens so view records can be freed #3377 added. With the opt-in X2W_D3D12_VIEW_CONTENT_TOKENS=1, word 1 carries view_content_bit (0x80000000u), so a valid typed slot-18 token is refused as "not a typed buffer view". That's safe, but the reason is wrong. Use token_view after the merge.
  3. Two claimed paths have no case. The null-descriptor branch (channels = 4; // the 16 zero bytes …): grep -cE 'null|indirect' tests/startup_compute_typed_buffer_srv_check.py → 0. The manifest guard (b.required_bytes <= 16 && % 4): grep -c typed_buffer_srv tests/native_compute_manifest_reasons.cpp → 0. A records32 null-input mode and one manifest-reasons row would pin them. The indirect-refusal gap is already listed on runtime: bind published typed buffer outputs with 32-bit components #3397.

NIT

  1. The doc's control counts (4, 6, 6 and 7) are stale. The check at the head runs 5/8/8/9.
  2. With the opt-in snapshot path, 12-byte elements refuse or bind depending on the ring slot. Reservations round to 512 bytes, and 512 % 12 = 8, so range.offset % element fails for about 2 in 3 slots. I reasoned this from the code and did not measure it.

AI-assisted.

Not-Saii and others added 4 commits November 29, 2026 16:05
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>
@Not-Saii

Copy link
Copy Markdown
Contributor Author

@Leyukaka @JohnConnorNPC Thanks. Head is now 4cd38c90.

Conflict. d2acde2b merges main with the resolution from 12:06: main's identity_dst_sel writer and parser branches are kept, and the typed table branch follows each. main then moved again, so 4cd38c90 merges 8a30428a too: the cube SRV reason rows and the dispatch-cube consumer modes go next to this branch's rows and modes. Both merges are clean against 8a30428a.

JohnConnorNPC's points:

  1. Default launcher path. Correct. The body and docs/experiments/compute-typed-buffer-inputs.md now say that this binding is on the manifest route only. With X2W_NATIVE_SHADERS_ONLY=1 (the default since runtime: default to native shaders and Opus decoding #3449), <key>.txt is not read, and translate_compute_natively still refuses typed_buffer_srv as view kind 1 is not bound. Binding the kind on the in-process route is a separate change; it would reuse the same Slot.typed_bytes and dispatch path.
  2. Content tokens. typed_dword_input_view now reads the token with token_view (a3854d64). No test runs with X2W_D3D12_VIEW_CONTENT_TOKENS=1, so that path is checked by reading only.
  3. Unpinned paths. A new consumer mode, dispatch-records32-input-null, gives each width an all-zero input descriptor, which must read zeros. With the all-zero branch dropped, the check fails at null input: word 0 expected 00000000, read c5c5c5c5. native_compute_manifest_reasons has two new SRV kind typed_buffer_srv rows, 20 bytes and 6 bytes.
  4. Counts. Fixed. The check now runs 8, 11, 11 and 12 refusals per width.
  5. Snapshot path, 12-byte elements. Not changed and not measured. A 3-component input on the opt-in snapshot path may be refused as a typed input range does not start at a whole element, but it is refused by name, not misread. Removing that refusal would mean aligning snapshot reservations to the element size, which I left out of this PR.

Leyukaka's gaps 2–4 from the #3397 review are in lines from this PR, so the cases are here:

  • Word 3: INDEX_STRIDE (bit 21) and ADD_TID (bit 23) must be refused. With the mask 0xfff80000u → 0xff000000u, the check fails at the INDEX_STRIDE case.
  • Word 1 bit 31: a stride field of 0x8000 | 4n must be refused. With (words[1] >> 30) → ((words[1] >> 30) & 1), the check fails at {'stride': 32772}.
  • Indirect: startup_slot67_indirect_dispatch_check.py replaces its manifest line with srv 0 typed table 1 0 bytes 4 and expects requires fixed-table raw buffers. With || slot.typed_bytes dropped, that check fails.

Each mutation was applied alone, the shim rebuilt and the check run, then reverted. Without mutations, on 4cd38c90 (main 8a30428a), these pass: startup_compute_typed_buffer_srv_controls / _hardware, native_compute_manifest_reasons (38 cases) and startup_slot67_indirect_dispatch_hardware. The setup was the NVIDIA GeForce RTX 4090, driver 32.0.16.1088, Windows 11 build 26300, Debug, with the debug layer enabled.

AI-assisted.

@Leyukaka Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4cd38c90 against main 8a30428a. Diff reading only, nothing run.

Since da4fe59c:

  • Merges (d2acde2b, 4cd38c90): main's identity_dst_sel writer and parser branches are kept and the typed table branch follows each (src/direct_compute_cache.cpp:969, src/startup_stubs/d3d12_compute_dispatch.inl:339). The cube rows and dispatch-cube modes sit next to the typed ones. git merge-tree origin/main 4cd38c90 exits 0.
  • Runtime (a3854d64): one change. typed_dword_input_view reads the token with token_view (d3d12_compute_dispatch.inl:175) instead of indexing view_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 with read_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). Two SRV kind typed_buffer_srv rows, 20 and 6 bytes (tests/native_compute_manifest_reasons.cpp:70, :74). Indirect refusal of an srv typed line (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) through token_view has no case, as the body says.
  • The pr test preset still includes none of startup_compute_typed_buffer_srv_*, native_compute_manifest_reasons or startup_slot67_indirect_dispatch_*, so the green CI builds these checks without running them. The mutation results are the author's.

Approve 4cd38c90.

@JohnConnorNPC
JohnConnorNPC merged commit 4932e06 into R0Y00:main Nov 29, 2026
5 checks passed
JohnConnorNPC pushed a commit that referenced this pull request Nov 29, 2026
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>
R0Y00 pushed a commit that referenced this pull request Nov 30, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants