compute: store prefix-mask images at their exact width in direct compute #3245

Manually merged
github merged 1 commit from github-bot/gh-3243 into gh-pr/3243/base 2026-11-28 02:34:22 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-28 01:34 UTC · original
Leyukaka:image-store-exact-width → main · +252 −28 · 8 files · 1 commits · merged 2026-11-28 02:30 UTC

Part of #1545 (claimed there) and #2935. Target branch main.

Change. Direct compute lowers non-D16 image_store with a prefix dmask (0x1, 0x3 or 0x7; 2D, 2D array and 3D) as a typed UAV store of float, float2 or float3, with every component written. The D16 path already does the same for masks 1 and 3. Following your note in #1545, sparse masks stay refused unless the unwritten components and the cross-lane behaviour are proven. Here the bound texture has no unwritten component, so there is no read-modify-write and no race between invocations.

  • src/gfx1013_compute_native.h, src/gfx1013_direct_compute.inl: float*_texture_uav binding kinds. image_io accepts the three prefix masks and keeps refusing non-prefix masks (0x2, 0x9, 0xd, ...) with the existing message.
  • src/direct_compute_cache.cpp: the runtime manifest carries the width as uav <i> <tex2d|tex2da|tex3d> float table <p> <o> channels <1|2|3>.
  • src/startup_stubs/d3d12_compute_dispatch.inl: before the dispatch, the runtime refuses the binding with "an exact-width image store requires a matching output texture channel count" unless the view format and the resource format both have exactly that many channels (R*, RG* or R11G11B10_FLOAT). Without typed UAV store support for that format, it refuses with "an exact-width image store requires typed UAV store support". The UAV view uses the texture's own format. Width-4 outputs keep their existing format list.

Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on main 7364e6a9 plus this commit.

  • New native_image_store_exact_width_{warp,hardware}_{r,rg,rgb,array,volume,rgba,sparse} read back R32_FLOAT (0x1), R32G32_FLOAT (0x3) and R11G11B10_FLOAT (0x7) in 2D, a 2D array and 3D, with sentinel texels, through both the native route (manifest removed) and the published manifest.
  • An R8G8B8A8_UNORM texture bound to a 0x7 store is refused at run time with the channel-count reason. A 0x9 mask is refused by the translator.
  • The native pass runs first, so on inbox WARP, which has no 32-lane waves, the six dispatch cases report the capability skip. sparse is translator-only and passes. On the RTX all 7 cases pass.
  • With main's compile_dxil, the store stops at "direct image opcode or descriptor modifiers".
  • 35 tests pass with -R "native_image_store_exact_width|native_direct_container|startup_compute_dispatch". On the previous base 86beae95, a wider selection (...|startup_compute_image_store|startup_compute_request|startup_compute_translate|native_image|native_store|native_descriptor_scc) passed 56 of 56.
  • Mutation check by hand: removing the runtime channel-count check makes the RGBA case fail.

Measured with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, main 7364e6a9 against this commit.

  • Local capture of 2,689 requests: 494 to 562 compile.
  • Requests of one start-up run: 507 to 575.
  • The 882 requests of #3226: 128 to 153. The 25 new programs account for 125,680 dispatches of that run.
  • All of these programs used to stop at "direct image opcode or descriptor modifiers". No program that compiled before stops compiling.
  • These are translator counts. At run time each dispatch still needs a bound texture with a float or normalized format that has exactly that many channels, otherwise it is refused with the reason above. I have not measured which formats the title binds.
  • Counts and instruction shape only.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-28 01:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3243) `Leyukaka:image-store-exact-width` → `main` · +252 −28 · 8 files · 1 commits · merged 2026-11-28 02:30 UTC Part of #1545 (claimed there) and #2935. Target branch `main`. **Change.** Direct compute lowers non-D16 `image_store` with a prefix `dmask` (`0x1`, `0x3` or `0x7`; 2D, 2D array and 3D) as a typed UAV store of `float`, `float2` or `float3`, with every component written. The D16 path already does the same for masks 1 and 3. Following your note in #1545, sparse masks stay refused unless the unwritten components and the cross-lane behaviour are proven. Here the bound texture has no unwritten component, so there is no read-modify-write and no race between invocations. - `src/gfx1013_compute_native.h`, `src/gfx1013_direct_compute.inl`: `float*_texture_uav` binding kinds. `image_io` accepts the three prefix masks and keeps refusing non-prefix masks (`0x2`, `0x9`, `0xd`, ...) with the existing message. - `src/direct_compute_cache.cpp`: the runtime manifest carries the width as `uav <i> <tex2d|tex2da|tex3d> float table <p> <o> channels <1|2|3>`. - `src/startup_stubs/d3d12_compute_dispatch.inl`: before the dispatch, the runtime refuses the binding with "an exact-width image store requires a matching output texture channel count" unless the view format and the resource format both have exactly that many channels (`R*`, `RG*` or `R11G11B10_FLOAT`). Without typed UAV store support for that format, it refuses with "an exact-width image store requires typed UAV store support". The UAV view uses the texture's own format. Width-4 outputs keep their existing format list. **Tests.** The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on `main` `7364e6a9` plus this commit. - New `native_image_store_exact_width_{warp,hardware}_{r,rg,rgb,array,volume,rgba,sparse}` read back `R32_FLOAT` (`0x1`), `R32G32_FLOAT` (`0x3`) and `R11G11B10_FLOAT` (`0x7`) in 2D, a 2D array and 3D, with sentinel texels, through both the native route (manifest removed) and the published manifest. - An `R8G8B8A8_UNORM` texture bound to a `0x7` store is refused at run time with the channel-count reason. A `0x9` mask is refused by the translator. - The native pass runs first, so on inbox WARP, which has no 32-lane waves, the six dispatch cases report the capability skip. `sparse` is translator-only and passes. On the RTX all 7 cases pass. - With `main`'s `compile_dxil`, the store stops at "direct image opcode or descriptor modifiers". - 35 tests pass with `-R "native_image_store_exact_width|native_direct_container|startup_compute_dispatch"`. On the previous base `86beae95`, a wider selection (`...|startup_compute_image_store|startup_compute_request|startup_compute_translate|native_image|native_store|native_descriptor_scc`) passed 56 of 56. - Mutation check by hand: removing the runtime channel-count check makes the RGBA case fail. **Measured** with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests`, `main` `7364e6a9` against this commit. - Local capture of 2,689 requests: 494 to 562 compile. - Requests of one start-up run: 507 to 575. - The 882 requests of #3226: 128 to 153. The 25 new programs account for 125,680 dispatches of that run. - All of these programs used to stop at "direct image opcode or descriptor modifiers". No program that compiled before stops compiling. - These are translator counts. At run time each dispatch still needs a bound texture with a float or normalized format that has exactly that many channels, otherwise it is refused with the reason above. I have not measured which formats the title binds. - Counts and instruction shape only. AI-assisted.
Non-D16 image_store with dmask 0x1, 0x3 or 0x7 (2D, 2D array, 3D) is
lowered as a typed UAV store of float, float2 or float3 with every
component written, as the D16 path already does for masks 1 and 3. The
manifest carries the channel count (`channels 1|2|3`, plus tex3d), and
the runtime refuses the dispatch unless the bound texture has exactly
that many channels ("an exact-width image store requires a matching
output texture channel count") and supports typed UAV stores. No channel
is left unwritten, so there is no read-modify-write and no race between
invocations. Non-prefix masks stay refused.

New test native_image_store_exact_width (WARP and hardware): R32_FLOAT,
R32G32_FLOAT and R11G11B10_FLOAT readbacks in 2D, a 2D array and 3D, with
sentinel texels, through the published manifest and the native route;
an RGBA8 texture with a 0x7 store is refused at run time and a 0x9 mask
by the translator. The native pass runs first, so an adapter without
32-lane waves (inbox WARP) reports the capability skip.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 01:37:42 +00:00
github-bot changed target branch from main to gh-pr/3243/base 2026-11-28 02:34:19 +00:00
github manually merged commit 1c0ab3b1bd into gh-pr/3243/base 2026-11-28 02:34:22 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 02:30 UTC · original · approved these changes

Reviewed 1c0ab3b1bd. The exact-width compiler binding and both runtime paths agree on channels 1/2/3. Hardware verified full texel readback and untouched sentinels for the source-built cases, RGBA refused the partial store without writing, and the translator refused the sparse mask. The existing two-mip, four-channel graphics-resource, and R32_UINT image atomic dispatch checks passed as well. The two blockers from #3049's original-program comparison remain separate from these fixture results.

On main f9286e7d (trial tree 17ca974ca4), Debug and Release /O2 each had 16 passes and 6 capability skips. In-box WARP did not run the wave32 exact-width dispatches. WARP's sparse negative, existing texture dispatch, and two-mip fixtures passed. The only intervening main change was the two PowerShell launcher files from #2867. The exact result tree on main 24eb18b9 is b4fc66a9a0. On that tree the R32 positive and the RGBA refusal passed again.

ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R "^(native_image_store_exact_width_.*|native_image_atomic_(controls|runtime_hardware)|startup_compute_dispatch_(texture_|two_mips_)?(warp|hardware))$"

Windows 11 26200.9974, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, D3D12 debug layer enabled for exact-width dispatch. Required hosted Windows CI passed.

**@⁠R0Y00** on GitHub · 2026-11-28 02:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3243#pullrequestreview-6095198600) · **approved these changes** Reviewed 1c0ab3b1bd1c. The exact-width compiler binding and both runtime paths agree on channels 1/2/3. Hardware verified full texel readback and untouched sentinels for the source-built cases, RGBA refused the partial store without writing, and the translator refused the sparse mask. The existing two-mip, four-channel graphics-resource, and R32_UINT image atomic dispatch checks passed as well. The two blockers from #3049's original-program comparison remain separate from these fixture results. On main f9286e7d (trial tree 17ca974ca4fc9db78b5340bcb261abcc1764e1c9), Debug and Release /O2 each had 16 passes and 6 capability skips. In-box WARP did not run the wave32 exact-width dispatches. WARP's sparse negative, existing texture dispatch, and two-mip fixtures passed. The only intervening main change was the two PowerShell launcher files from #2867. The exact result tree on main 24eb18b9 is b4fc66a9a0d5216c0417fd1eb014da4c9fc9ce33. On that tree the R32 positive and the RGBA refusal passed again. ``` ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R "^(native_image_store_exact_width_.*|native_image_atomic_(controls|runtime_hardware)|startup_compute_dispatch_(texture_|two_mips_)?(warp|hardware))$" ``` Windows 11 26200.9974, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, D3D12 debug layer enabled for exact-width dispatch. Required hosted Windows CI passed.
This discussion has been locked. Commenting is limited to contributors.
No description provided.