Skip to content

runtime: bind four-channel and half4 texture UAVs on the native compute route - #3398

Merged
JohnConnorNPC merged 3 commits into
R0Y00:mainfrom
Leyukaka:native-compute-bindings
Nov 29, 2026
Merged

JohnConnorNPC merged 3 commits into
R0Y00:mainfrom
Leyukaka:native-compute-bindings

Conversation

@Leyukaka

Copy link
Copy Markdown
Collaborator

Change

Takes over #3049 (sydney-0o, co-author), which carried #2975 and #2993, onto current main. Relative to main:

Refs #3049, #2975, #2993, #2974.

Verification

Windows Sandbox, network off, release build of 11e1a06d on main 8ecd30fe (the head dfd8cb2c has the same tree; only the commit message changed). Adapters: NVIDIA GeForce RTX 5080, driver 32.0.16.2101 (shader model 6.6, wave32), and WARP 10.0.26100.9818 (no wave32).

ctest --test-dir out/build/release --no-tests=error -V -R "^(native_compute_manifest_reasons|startup_compute_dispatch_(texture|array|array_d16|two_mips|(texture_)?native)_(warp|hardware)|startup_compute_dispatch_(warp|hardware)|startup_gfx2hlsl_image_store_3d1d|startup_manifest_retry)$"

15 pass and 2 skip (77): on WARP startup_compute_dispatch_native_warp and startup_compute_dispatch_texture_native_warp exit 77 after checking the named capability refusal.

Mutants, each applied alone, rebuilt and run with the same suite:

  • manifest case 0: tex = "tex1d" → "tex2d": native_compute_manifest_reasons, startup_compute_dispatch_texture_native_hardware and _warp fail.
  • manifest case 2: tex = "tex3d" → "tex2d": the same three fail.
  • in-process case 0 (1D UAV) dropped: startup_compute_dispatch_native_hardware and _warp fail.
  • native srv_dimension assignment dropped: startup_compute_dispatch_native_hardware fails.
  • texture_input accepting any SRV dimension: not caught.

Evidence and follow-up

Fixtures are source-built with the same generators as the existing dispatch checks. Not covered: a refusal case for a non-2D texture SRV on the in-process route; in-process fixtures for four-channel float 2D and half4 1D, 2D-array and 3D; manifest lines for half4_texture_uav at dimensions 0 and 2; the copy_token path for descriptor increments above 32 bytes, which is not exercised if both adapters report 32 (not logged). The matched original-program comparison asked for in #3049 (same cache and inputs, with and without this branch) is next.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • No application files, dumps, distribution links or secrets included.

@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 1D, 2D, 2D-array, and 3D four-channel float / half4 texture UAV support to the native compute dispatch path. Manifest formatter emits tex1d/tex2d/tex3d/tex2da lines; dispatch stub resolves dimensions, validates UAV shape, and checks format support. New adapter capability helpers (wave32, shader model 6.6) with descriptive refusal messages. Test fixture covers table views with volume inputs, sampler/zero-WSize controls, and texture outputs (line, array, packed D16). Docs updated throughout.

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 extension of the native compute dispatch path with proper capability checks.

Binds 1D, 2D, 2D-array, and 3D four-channel float and half4 texture UAVs in the in-process route. Manifest formatter now emits tex1d/tex2d/tex3d/tex2da with a switch over image_dimension. Capability checks (adapter_32_lane_waves, adapter_reports_shader_model_below_6_6) are factored out with better refusal messages for published PSO failures.

Table views fixture exercises volume with texture input, sampler control, and zero-WSize control. Texture outputs cover 1D float, 2D-array float, and packed D16 stores. Consumer supports packed guest tables with descriptor increment. Documentation updated accurately.

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 — expands native compute to bind 2D texture inputs and four-channel float / packed half4 texture outputs (1D, 2D, 2D-array, 3D).

Manifest formatter now uses a switch for UAV dimension names instead of the inline ternary. Runtime reader handles tex1d/tex2d/tex2da/tex3d float channels 4. In-process path binds 2D texture SRV inputs, four-channel and exact-width float UAV outputs with proper dimension mapping, and checks shader model 6.6 + wave32 via extracted helper functions. Pipeline creation failure appends adapter capability notes.

New test fixture covers table views (volume with texture input, sampler control, zero WSize), texture outputs (1D float, 2D-array float, packed D16), and capability refusals. Manifest reasons test verifies all dimension/channel combinations.

Documentation updated for the expanded binding set and new fixture.

@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 — expands native compute to bind 2D texture inputs and four-channel float / packed half4 texture outputs (1D, 2D, 2D-array, 3D).

Manifest formatter now uses a switch for UAV dimension names instead of the inline ternary. Runtime reader handles tex1d/tex2d/tex2da/tex3d float channels 4. In-process path binds 2D texture SRV inputs, four-channel and exact-width float UAV outputs with proper dimension mapping, and checks shader model 6.6 + wave32 via extracted helper functions. Pipeline creation failure appends adapter capability notes.

New test fixture covers table views (volume with texture input, sampler control, zero WSize), texture outputs (1D float, 2D-array float, packed D16), and capability refusals. Manifest reasons test verifies all dimension/channel combinations.

Documentation updated for the expanded binding set and new fixture.

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

Windows check of head dfd8cb2 (dev and release, --regex 'compute_dispatch_(native|texture)|native_compute_manifest_reasons|startup_stream_consumer'): 4 of 10 selected tests failed. Two of them (startup_compute_dispatch_native_warp and _hardware) also fail on current main without this PR, so they are not caused by it. The two texture_native failures remain.

  • startup_compute_dispatch_texture_native_warp and startup_compute_dispatch_texture_native_hardware: AssertionError: ('volume', 64) from tests/startup_compute_dispatch_texture_check.py line 612.
  • startup_compute_dispatch_native_warp and startup_compute_dispatch_native_hardware: AssertionError: word=0 got=c5c5c5c5 expected=00000400 (288 words differ) in tests/startup_compute_dispatch_native_check.py.
  • native_compute_manifest_reasons passed.

Please check these three on a fresh build of the head. We did not compare against main for this report.

AI-assisted; commands listed were executed locally.

…te route

Takes over R0Y00#3049, which carried R0Y00#2975 and R0Y00#2993, onto current main.

- In-process route: four-channel float texture UAVs in 1D, 2D and 2D-array and packed half4
  texture UAVs in 1D, 2D, 2D-array and 3D, next to main's exact-width channels (R0Y00#3243); exact-width
  kinds outside 2D, 2D-array and 3D are refused instead of bound as 2D; native 2D texture inputs
  set srv_dimension (R0Y00#3306); an adapter below shader model 6.6 is refused by name.
- C++ manifest: texture_uav and half4_texture_uav at dimension 0 publish tex1d, half4_texture_uav
  at dimension 2 publishes tex3d; other dimensions keep R0Y00#3268's refusal.
- On the published route a PSO failure stays the reason, with the adapter's wave32 or shader model
  shortfall beside it.
- Fixtures use the adapter's descriptor increment, accept revision.txt in the cache, and cover the
  zero-W, 1D, 2D-array and half4 cases.

Co-authored-by: sydney-0o <215686885+sydney-0o@users.noreply.github.com>
@Leyukaka
Leyukaka force-pushed the native-compute-bindings branch from dfd8cb2 to 1bb1c85 Compare November 29, 2026 08:53
@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Re-review of head 59f60121 against main 77d1ba4d. git merge-tree --write-tree origin/main 59f60121 exits 0, and none of the 53 main commits since the merge-base touches the runtime files. The source diff reads correctly against the repo's ComputeViewKind enum. Kind 3 is texture_uav. main binds it natively only at dimension 2, and that is why "view kind 3 is not bound for a natively translated program" shows up in start-up runs. The 0/1/2/5 → TEXTURE1D/2D/3D/2DARRAY switch fixes that. The formatter keeps the #3268 reason (default: return refuse(view_shape("UAV", b));). Exact-width kinds at dimension 0 are now refused instead of being bound as 2D, which matches the published writer.

MUST

  1. The Windows report at dfd8cb2c is still unanswered. startup_compute_dispatch_texture_native_{warp,hardware} failed there with AssertionError: ('volume', 64), raised by assert got == expected in store_3d1d after Dispatch(2, 1, 1) translated. That code is unchanged at the head: per file, git diff 8ecd30fe dfd8cb2c -- tests/startup_compute_dispatch_texture_check.py | git patch-id equals git diff 740ffdf1 1bb1c859 -- <same file> | git patch-id. On that WARP the pipeline was created, so the capability skip did not fire and 64 words were wrong. Could you run ctest -R '^startup_compute_dispatch_texture_native_(warp|hardware)$' -V on the head and post the result? If you can't reproduce it, please name the adapter or WARP difference. If the WARP build in that report has 32-lane waves, it would explain why the skip didn't fire, but it would not explain the wrong words.

SHOULD

  1. The new test does not cover the default launcher path. Since runtime: default to native shaders and Opus decoding #3449 (1990fead), run.sh and run.ps1 set X2W_NATIVE_SHADERS and X2W_NATIVE_SHADERS_ONLY=1 by default, and load_compute_translation returns early at if (native_shaders_only()) {. So the default path never runs the published-route wave and shader-model notes this PR adds. store_3d1d also clears the variable (env.pop('X2W_NATIVE_SHADERS', None)), so texture_native tests the published route. The default route is the new switch in translate_compute_natively, and only startup_compute_dispatch_native_* covers it. In the same report, that test failed on main too (word=0 got=c5c5c5c5). Could you say whether startup_compute_dispatch_native_hardware passes on current main plus this head? A short note in the body on which route each new test exercises would help as well.

NIT

  1. adapter_reports_shader_model_below_6_6() returns false when CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL) fails. A runtime that does not know 6.6 returns E_INVALIDARG, so the named refusal is skipped and a generic PSO failure follows. This is harmless, but the comment could say so.
  2. Exact-width outputs at dimension 0 are now refused on the in-process route, and no case pins that refusal. The body mentions the change, but no mutant covers it.

Merge order for this group: #2975 and #2993 are closed in favour of this PR. This PR carries #3049 as well. #3386, then #3397, merge cleanly after it once they resolve their own main conflict (identity_dst_sel). Adding this PR first leaves that conflict at 1 hunk per file, the same count as on main alone.

AI-assisted.

@Leyukaka

Copy link
Copy Markdown
Collaborator Author

Re: re-review of 59f60121.

1 and 2: run on the head plus current main. 59f60121 merged with main c04e0dd6 (no conflict), dev preset with -DX2W_WITH_OPUS=OFF, one command per test:

ctest --test-dir out/build/dev --no-tests=error -R '^<test>$' -V
test result output
startup_compute_dispatch_native_hardware Passed native table views: volume words match, and the sampler and zero WSize controls leave them untouched; native texture-line: all 128 output values match; native texture-array: all 6144 ...; native texture-store: all 1024 ...
startup_compute_dispatch_native_warp Skipped (77) SKIP on warp (not translated natively: the adapter has no 32-lane waves)
startup_compute_dispatch_texture_native_hardware Passed line: 128 mip-one words match; volume: 6144 ...; volume-nsa: 6144 ...
startup_compute_dispatch_texture_native_warp Skipped (77) line, volume, volume-nsa: native DXIL and manifest verified; dispatch skipped (adapter has no 32-lane waves)
  • startup_compute_dispatch_native_hardware passes on main c04e0dd6 plus this head, on a hardware adapter. The word=0 got=c5c5c5c5 failure does not reproduce there.
  • ('volume', 64) does not reproduce on the hardware adapter: texture_native_hardware matches all 6144 volume words.
  • Both _warp legs are capability skips, not passes. The WARP here is the inbox one and reports no 32-lane waves, so the pipeline is never created. This run is no evidence for a WARP that has 32-lane waves, which is the configuration where the report shows the pipeline created and 64 words wrong. I can't reproduce that case here.

2: route per test (paths at 59f60121):

  • startup_compute_dispatch_native_* (tests/startup_compute_dispatch_native_check.py): in-process route. Each case sets X2W_NATIVE_SHADERS (:98, :173, :249, :303, :349). The new cases table_views (:247) and texture_outputs (:301) assert translated natively: ... (:273, :334) and that nothing is published to the cache (:284-286, :339-341). These are the cases that reach the new dimension switch in translate_compute_natively (src/startup_stubs/d3d12_compute_dispatch.inl:316). X2W_NATIVE_SHADERS_ONLY=1 is set only in scalar_window_case (:98) and the final read-write dispatch (:416), not in the two new cases, so they match the launcher default in the translation route but not in that variable.
  • startup_compute_dispatch_texture_native_* (tests/startup_compute_dispatch_texture_check.py, registered at CMakeLists.txt:4971): offline/published route, as you read it. store_3d1d removes X2W_NATIVE_SHADERS (:241), runs compile_dxil ... --requests (:270), checks the uav 0 tex1d|tex3d float table 1 64 channels 4 manifest line (:275-277), and the stand-in then loads <key>.txt and .cs.cso through load_compute_translation (d3d12_compute_dispatch.inl:143). It covers the formatter's tex1d/tex3d lines and the PSO-failure capability notes (:280-286), and does not run under X2W_NATIVE_SHADERS_ONLY.

I can add this route note to the PR body if that is the form you want.

Not addressed in this reply: NIT 3 and 4.

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Re-review of head 59f60121 after the 13:18 reply (read only, on Linux; no build or run here). git merge-tree --write-tree origin/main(17b662a2) 59f60121 exits 0. Main's two newer commits in d3d12_compute_dispatch.inl and direct_compute_cache.cpp (d13a3353, 297f260e) add the separate packed_d16_x kind and don't touch the texture-UAV dimension switch. CI is green at head.

Resolved

  • MUST 1 (the unanswered ('volume', 64) report): you posted a fresh run of this head merged with c04e0dd6. startup_compute_dispatch_texture_native_hardware matches all 6144 volume words, and startup_compute_dispatch_native_hardware passes too. The report at dfd8cb2c also had startup_compute_dispatch_native_* failing on main without this PR (word=0 got=c5c5c5c5, output untouched). So that environment failed outside this change as well, and the hardware result doesn't reproduce on a fresh build.
  • SHOULD (route per test): answered. texture_native covers the published route through load_compute_translation. The new table_views and texture_outputs cases in startup_compute_dispatch_native_check.py reach the dimension switch in translate_compute_natively on the in-process route. Adding the route note to the body would help, but it doesn't block.

Still open, not blocking

  • Nobody has run the case of a WARP that has 32-lane waves, where the pipeline is created and 64 volume words differ. Both _warp legs here are capability skips (77), not passes. If a report from that configuration comes in, it needs its own issue.
  • NIT 3 and 4 from earlier (the SM 6.6 query fails open; the exact-width dim0 refusal is unpinned).

0 MUST, mergeable, no change request. Merging.

AI-assisted.

@JohnConnorNPC
JohnConnorNPC merged commit dc93625 into R0Y00:main Nov 29, 2026
5 checks passed
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