Skip to content

runtime: bind cube texture SRVs for published native compute - #3351

Open
JB2WIN wants to merge 1 commit into
R0Y00:mainfrom
JB2WIN:native/compute-cube-srv
Open

JB2WIN wants to merge 1 commit into
R0Y00:mainfrom
JB2WIN:native/compute-cube-srv

Conversation

@JB2WIN

@JB2WIN JB2WIN commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Refs #3224. Follows #3306 (1D, 2D-array and 3D texture SRVs).

The direct translator declares a cube sample or gather as a TextureCubeArray (DXIL resource kind 9, layer = face >> 3). The published compute manifest had no line for it, so these programs got no <key>.txt.

  • Writer: cube_sample_srv with one descriptor and the cube dimension publishes srv N texcubearr table R B. texcube keeps its draw meaning (TextureCube).
  • Runtime: texcubearr needs a recorded TEXTURECUBE view that fits its texture (six slices). The view is rebuilt as a one-cube TEXTURECUBEARRAY with the same mips and format. Named refusals: no recorded view description, view not cube, view does not fit.
  • The catch-all reader refusal now reads "... 1D/2D/2D-array/3D/cube texture".

Impact, local 2,689-request cohort, measured on the #3306 head with only the writer swapped back: 382 -> 413 manifests (+31), every new one has a texcubearr line, the other 382 are byte-identical.

Tests:

  • native_compute_manifest_reasons: the published line, and the cube kinds that stay refused.
  • startup_compute_dispatch_cube_{controls,warp,hardware}: 2x2 R32_FLOAT cube, 24 distinct texels, lanes over all six faces at texel centres, readback checked against the D3D face mapping (not the translator's own table). Debug layer on, no message. Controls: TEXTURE2DARRAY view, no view description, 12-slice cube view, manifest rewritten to tex2da, tex2d or texcube; each refuses by name and leaves the output untouched.
  • WARP can't build [WaveSize(32)] pipelines, so the WARP run uses an equivalent HLSL program; the hardware run uses the translated DXIL.
  • With the src/ changes reverted, native_compute_manifest_reasons and the three cube tests fail.
  • 181/181 of startup_compute|native_compile_dxil|direct_compute|compute_manifest pass on the rebased branch.

Limits:

  • No run tells the TEXTURECUBEARRAY rewrite apart from binding the TEXTURECUBE view directly (same words, no debug-layer message on WARP or RTX). The rewrite follows the declared kind.
  • Gather on a cube is published the same way but not run by the fixture.
  • Faces >= 8 (cube arrays in the program) and title TEXTURECUBEARRAY views stay out (the latter refused as "not cube").
  • MSAA resources are not excluded; the same gap exists for the other dimensions since runtime: bind 1D, 2D-array and 3D texture SRVs for published native compute #3306 and wants its own change.
  • gfx2hlsl compute still refuses cube; the in-process route is unchanged. No output revision bump (the line was never published before).

Ran on RTX 3080 (32.0.16.2124) and WARP, DXC 1.8.2502.11, Windows 26200.

AI-assisted.

🤖 Generated with Claude Code

The direct translator declares a cube sample or gather as a TextureCubeArray (DXIL resource kind 9), which
format_compute_runtime_manifest refused ("SRV kind cube_sample_srv cube"). A cube_sample_srv of one cube
is now published as `srv N texcubearr table R B` (`texcube` keeps its draw meaning). The compute reader
takes the name; the stand-in Dispatch binds the title's described TEXTURECUBE view of a six-slice texture
as a one-cube TEXTURECUBEARRAY (same mips and format, First2DArrayFace 0, NumCubes 1), or refuses with a
name: no recorded view description, view is not cube (a TEXTURE2DARRAY or TEXTURECUBEARRAY view), or view
does not fit its texture. Cube arrays, image_load on a cube, cube comparison and descriptor arrays stay
refused at publication; gfx2hlsl.py and the in-process route are unchanged. No native output revision bump
(the line was never published before). The reader catch-all refusal now reads
"... 1D/2D/2D-array/3D/cube texture". Gather on a cube is published the same way but not run by the fixture.

Tests: native_compute_manifest_reasons (published line plus three refusals), and the new
startup_compute_dispatch_cube_{controls,warp,hardware}: a synthetic 24-lane cube-sampling program is
published with compile_dxil --requests and dispatched through startup_stream_consumer (dispatch-cube*)
against a CPU reference from the D3D face mapping (6 faces x 2x2 texels); controls are a TEXTURE2DARRAY
view, no description, a twelve-slice texture, and the manifest line rewritten to tex2da, tex2d or texcube.
WARP cannot create the translator's [WaveSize(32)] shader, so on WARP the test swaps in an HLSL equivalent
and covers the manifest, reader and view only; hardware runs the translated DXIL.

Experiment (not kept): with the TEXTURECUBEARRAY rewrite removed (the title's TEXTURECUBE desc bound as is
against the kind 9 declaration), the positive case on WARP and on the hardware adapter with the D3D12 debug
layer enabled produced no debug-layer message of any severity, all 320 words equal to the reference, no
refusal and no crash. The rewrite is therefore not observable there; it follows the declared DXIL kind.

Impact (local 2,689-request cohort, same build, writer swapped back): 382 -> 413 manifests, each of
the 31 new ones with a texcubearr line, the other 382 byte-identical. 181/181 of the startup_compute,
native_compile_dxil, direct_compute and compute_manifest tests pass (RTX 3080 and WARP); with the src
changes reverted the four new tests fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor

Independent verification at 12568d8acb5a4c7a90a04e5b2e28adae022f93a2. Debug and Release each passed 5/5 for ^(startup_compute_dispatch_cube_.*|native_compute_manifest_reasons(_requests)?)$ on RTX 4070 (driver 32.0.16.2124) and app-local WARP 1.0.22 (Windows 26300.10075, DXC 1.9.2602.17). The stock WARP fixture in that count uses the HLSL replacement.

I also ran the original native blob on app-local WARP, which passed the separate forced-wave32 probe. In a scratch runner I left the published <key>.cs.cso in place instead of calling hlsl_program. The stand-in logged one translated Dispatch(3, 2, 2), but all 288 output slots kept their sentinels in both builds. The first expected word was 0x42c80000, actual 0xc5c5c5c5.

With one fixture-only change, prepend s_mov_b32 exec_lo, 0x00ffffff before the original guest words. That mask covers exactly the 24 guest threads. Still using the native blob, all 288 samples across the six faces matched in both builds. The six view and manifest refusal controls preserved the output and the debug layer reported no errors. This is consistent with the partial-wave entry EXEC behavior tracked in #3160. It verifies the cube-binding path on this WARP build when guest EXEC is explicit and leaves the original fixture failure visible.

cmake --build --preset <dev-or-release> --target compile_dxil startup_stream_consumer d3d12_xs_shim offscreen_check native_compute_manifest_reasons
ctest --preset <dev-or-release> --no-tests=error -j 1 -V -R '^(startup_compute_dispatch_cube_.*|native_compute_manifest_reasons(_requests)?)$'

I used Codex for the scratch runner and ran the verification locally.

@JB2WIN
JB2WIN force-pushed the native/compute-cube-srv branch from 12568d8 to 58694f5 Compare November 28, 2026 14:10
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.

2 participants