Skip to content

compute: publish packed_d16_x_uav runtime manifest (Part of #3224) - #3389

Open
SimSalabimse wants to merge 3 commits into
R0Y00:mainfrom
SimSalabimse:compute-packed-d16-x-uav-manifest
Open

SimSalabimse wants to merge 3 commits into
R0Y00:mainfrom
SimSalabimse:compute-packed-d16-x-uav-manifest

Conversation

@SimSalabimse

@SimSalabimse SimSalabimse commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Part of #3224 (claim: #3224 (comment)).

In a 900 s start-up on the Windows test PC, runtime from main aec2e08, 23 shaders and 86,436 untranslated dispatches (5.7% of that run's untranslated compute dispatches) were refused with unsupported startup runtime manifest bindings: UAV kind unknown for this binding. The shader compiled, and the published route had no manifest line for it.

Change

The manifest token is uav <register> packed_d16_x table <parameter> <byte>.

  • A one-component D16 buffer_store_format, including the MTBUF form, stays packed_d16_x_uav. The store stays value & 65535 then bufferStore.i32. Two- and four-component D16 stores stay half_buffer_uav and still publish bufhalf.
  • format_compute_runtime_manifest writes uav N packed_d16_x table R B for one register and a two-byte payload. view_kind_name names packed_d16_x_uav and indexed_raw_srv, with the static assert that keeps the last name aligned with the enum. That names change is not on main.
  • load_compute_translation reads the line. The placed view uses native_buffer_store_view: R16_FLOAT and R16_UINT bind as R16_UINT, and R32_UINT stays R32_UINT with a 4-byte element. A descriptor that matches none of those refuses with a half buffer store requires matching format, stride and structured bounds.
  • tests/startup_compute_half_buffer_uav_check.py expects uav 0 packed_d16_x table 1 32 for the one-channel stride-2 case, including both MTBUF forms. Wider D16 stores still expect bufhalf.
  • tests/startup_compute_packed_d16_x_uav_check.py expects the same line. The R16_FLOAT view checks the halfwords. The R32_UINT view checks the zero-extended dwords. A wrong stride and a swizzle flag still refuse and leave the buffer untouched.

Tests

Linux: the python-linux check step (tools/run_checks_parallel.py --from-dir tests/checks/python-linux plus the workflow's script list) passes all 260 checks. docs_links_check.py and startup_compute_store_d16_x_check.py also pass. tests/native_compute_manifest_reasons.cpp compiles with g++ and clang++ -std=c++17 -Wall -Wextra -Werror -Werror=narrowing.

Windows test PC (RTX 4070 Ti) at head 32406a35, preset dev: build exit 0, then

ctest --preset dev --no-tests=error -j 1 -R 'native_compute_manifest_reasons|startup_compute_half_buffer_uav.*|native_compile_dxil.*|.*packed_d16.*|.*store_d16_x.*'

35/35 passed, ctest exit 0 (startup_compute_half_buffer_uav_warp and startup_compute_packed_d16_x_uav_warp skipped, as on WARP elsewhere). startup_compute_half_buffer_uav_controls and startup_compute_half_buffer_uav_hardware pass at this head.

AI-assisted (Cursor)

@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.

APPROVED -- passes AGENTS.md rules.

Checked against hard rules:

  • No game files, dumps, DLLs, EXEs, torrents, distribution links, or credentials
  • Neutral wording ("a retail title on the Windows test PC")
  • Source-built fixture: hand-crafted gfx1013 buffer_store_format_d16_x via program_words()
  • All changes in tracked paths (src/, tests/, docs/)
  • New tests only; existing half_buffer_uav path preserved
  • One behavior: manifest publication for packed_d16_x_uav

Code review:

  • view_kind_name adds packed_d16_x_uav and indexed_raw_srv
  • Manifest emission guarded on ComputeViewKind::packed_d16_x_uav && array_count == 1 && required_bytes == 2
  • One-component D16 stored through half_buffer_uav path; packed_d16_x_uav only emits bufd16x when binding matches
  • New refusal function validates element alignment, format (R16_FLOAT/R16_UINT), stride, swizzle-flag rejection
  • Test: positive control (reference halfwords), three negative controls (R32_UINT, bad stride, swizzle flag)

@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, well-tested.

Adds packed_d16_x_uav and indexed_raw_srv to the view_kind_name table, publishes bufd16x manifest for one-component D16 stores, and adds packed_d16_x_view_refusal with proper format/stride/swizzle validation. Dispatch stubs handle the new manifest line; native runtime validates format support. Test fixture covers positive path, three negative controls, and reference-only checks.

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, well-tested.

Adds packed_d16_x_uav and indexed_raw_srv to the view_kind_name table, publishes bufd16x manifest for one-component D16 stores, and adds packed_d16_x_view_refusal with proper format/stride/swizzle validation. Dispatch stubs handle the new manifest line; native runtime validates format support. Test fixture covers positive path, three negative controls, and reference-only checks.

Ready to land.

@Leyukaka

Copy link
Copy Markdown
Collaborator

Head 82984b0.

By its diff (not built here), this makes startup_compute_half_buffer_uav_controls pass by undoing the #3091 store classification. On main 0614f68 that test fails in CI (run 46194701708) with no_manifest ... unsupported startup runtime manifest bindings: UAV kind unknown for the 1-channel store.

  • src/gfx1013_direct_compute.inl:750-752 drops packed_x. A one-component D16 store is half_buffer_uav again and publishes uav 0 bufhalf table 1 32 bytes 2 through the existing branch (direct_compute_cache.cpp:979-982). That is the line the test asserts.

  • The only producer of packed_d16_x_uav on main is gfx1013_direct_compute.inl:743-745, and this PR removes it. Nothing else produces that kind, so the following are unreachable and no test publishes or reads a bufd16x line:

    • the bufd16x emit (direct_compute_cache.cpp:983-986);
    • its reader (d3d12_compute_dispatch.inl:271-275);
    • the token check (:873-879);
    • packed_d16_x_view_refusal (:100-138);
    • the placed-buffer branch (:923, :951, :975-986).

    The three negative descriptors in the new fixture are refused by the existing half-buffer check.

  • Compared with main, the store goes back from and 65535 + bufferStore.i32 to legacyF16ToF32 + bufferStore.f32. On the native-module route, main accepts an R16_FLOAT, R16_UINT or R32_UINT view for it (native_buffer_store_view.h:64-69). The half-buffer check accepts R16_FLOAT only (:70-73).

  • The Windows CI job on this PR (run 46178085395) ran the pr preset, 73 tests. Neither the half-buffer tests nor the new packed_d16_x_uav tests were in it.

  • The view_kind_name change (direct_compute_cache.cpp:897) is the same line as compute: name the packed D16 and indexed raw view kinds in manifest reasons #3395.

Measurements, local:

  • On main 0614f68, startup_compute_half_buffer_uav_controls and startup_compute_half_buffer_uav_hardware fail.
  • A change that keeps the shader: compile native mesh interfaces and prewarm compute requests #3091 classification makes both pass: 7/7 of native_compute_manifest_reasons|startup_compute_half_buffer_uav.*|native_compile_dxil.*. The change:
    • writes uav N packed_d16_x table R B from format_compute_runtime_manifest;
    • parses it in load_compute_translation;
    • binds it as R16_UINT;
    • changes the test's stride-2 expectation to that line.
  • The set is 882 captured compute requests, run with compile_dxil gfx1013-direct-cs@0 --requests.

At 82984b0 this fixes the CI failure as a revert of the #3091 classification. Either describe it as that and drop the unreachable bufd16x code, or keep the packed classification and publish its line, updating the half-buffer test's 1-channel expectation (including the MTBUF cases added by #3353).

cursoragent and others added 3 commits November 29, 2026 00:22
A one-component D16 buffer_store_format compiles as packed_d16_x_uav but
the published route had no manifest line, so dispatch refused the kind as
unknown. Emit bufd16x, name the kind, and keep the view on
native_buffer_store_view, refusing an element that is not one R16_UINT
halfword.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
A one-component buffer_store_format was classified as packed_d16_x_uav, so
publishing bufd16x replaced the existing bufhalf line. That store stays a
half_buffer_uav. bufd16x is emitted only for a packed_d16_x_uav binding.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
A one-component D16 store stays packed_d16_x_uav and keeps the integer
store. format_compute_runtime_manifest writes
`uav N packed_d16_x table R B`. The reader binds R16_FLOAT and R16_UINT
as R16_UINT and leaves R32_UINT as R32_UINT. The one-channel half-buffer
fixture, including both MTBUF forms, expects that line.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
@cursor
cursor Bot force-pushed the compute-packed-d16-x-uav-manifest branch from 82984b0 to 32406a3 Compare November 29, 2026 00:34
@SimSalabimse

Copy link
Copy Markdown
Contributor Author

@Leyukaka Took option 2, and rebased onto current main (head 32406a35).

  • The one-component store stays packed_d16_x_uav with the integer store (and 65535, then bufferStore.i32). The manifest line is uav N packed_d16_x table R B, with no bytes field, and bufd16x is gone.
  • load_compute_translation reads it. The placed view accepts R16_FLOAT, R16_UINT and R32_UINT the same way native_buffer_store_view does: the two R16 formats bind as R16_UINT, and R32_UINT stays R32_UINT. A descriptor that matches none of those still refuses with the half-buffer shape reason, so the existing one-channel negatives stay.
  • The half-buffer fixture's stride-2 line, including both MTBUF forms, is now that packed line.
  • view_kind_name still names packed_d16_x_uav and indexed_raw_srv with the same static assert, since that names change isn't on main. src/gfx1013_direct_compute.inl matches main again.

Linux: python-linux passed 260/260.
Windows test PC: build exit 0, and native_compute_manifest_reasons|startup_compute_half_buffer_uav.*|native_compile_dxil.*|.*packed_d16.*|.*store_d16_x.* passed 35/35 at 32406a35 (two WARP runs skipped), ctest exit 0. That includes startup_compute_half_buffer_uav_controls and _hardware.

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.

Verdict: APPROVE (diff-only, head 32406a3)


Head 32406a3. Re-read by its diff (not built here).

The packed route is now consistent end to end:

  • gfx1013_direct_compute.inl is unchanged from main, so a one-component D16 store (MUBUF, and MTBUF via the #3353 rewrite to buffer_store_format 0x84) stays packed_d16_x_uav.
  • direct_compute_cache.cpp:985 emits uav N packed_d16_x table R B, d3d12_compute_dispatch.inl parses the same token, and the placed view goes through packed_d16_x_view_refusal (:99) and native_buffer_store_view.
  • startup_compute_half_buffer_uav_check.py expects that line for stride 2, and requires that no bufhalf ... bytes 2 line is present, in all three forms (MUBUF, MTBUF indexed, MTBUF first element). The dispatch half of that fixture sends its one-channel negatives (stride, swizzle, format, dst_sel, OOB_SELECT) through packed_d16_x_view_refusal; the range negative is still refused earlier by the placed-range check. startup_compute_packed_d16_x_uav_{warp,hardware} adds the R32_UINT view. native_compute_manifest_reasons checks both the published line and the refusal for required_bytes 4.

Coverage: CI run 46207060926 ran the pr preset (73 tests). It does not include native_compute_manifest_reasons, startup_compute_half_buffer_uav_* or startup_compute_packed_d16_x_uav_{controls,warp,hardware}. Only the Linux reference half ran. The Windows result rests on the author's 35/35 run, and the dispatch checks run on hardware only (the author reports the two WARP runs skipped, so the dispatch checks ran on hardware only).

Not covered by any test in the diff:

  • the view-token branch (:875-880, and packed_d16_x at :910). No fixture uses a token output with the packed line;
  • word3_flags (:121). Only bit 28 and the stride-field swizzle bit are exercised, so word3_flags = 0 would pass;
  • unified && (:110-117). No descriptor clears bit 24;
  • b.array_count == 1 in the emit (direct_compute_cache.cpp:985). There is no array case for this kind.

Merge: git merge-tree against main 212d4b5 is clean, and so is a merge with #3395 at 1eca8d5, whose view_kind_name hunk is identical.

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