shader: lower gfx1013 1D float image stores and mip loads #2049

Merged
Jess-Doit merged 1 commit from upstream-pr/2056 into main 2026-11-25 22:15:19 +00:00
Jess-Doit commented 2026-11-24 23:44:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T23:44:13Z.


Refs #1545. Stacked on #1649 (at a9fb1792): this PR also shows #1649’s commits until #1649 merges, and the change here is only 3e27abf6. It stays a draft until then; I’ll rebase onto main once #1649 lands.

Change

Lower gfx1013 full-mask R32G32B32A32_FLOAT 1D stores to RWTexture1D<float4> at u0. Lower explicit-mip reads from a separate descriptor to Texture1D<float4> at t0, with Load(int2(x, mip)). The caller declares the UAV and SRV dimensions independently. RDNA 2 specifies one address VGPR for the store and two for the load (§8.2.3, Table 42). LLVM 15 accepted both forms and rejected the wrong address widths. AMD RDNA 2 ISA

The compute fixture adds a distinct 1D case flag and uses the existing footprint-based upload and readback path.

Tests

The source-built shader copies all four channels from source mips 1 and 2 into eight unique texels of destination mip 0. The CPU reference compares all 224 destination words across mips of widths 32, 16 and 8, including 192 sentinels. The LLVM check reassembles the recorded bytes, disassembles the MIMG instructions, and compares the container CLI output against the HLSL from the assembly text.

Control Result
Force the source mip to zero 32 mismatches on each adapter. First at mip 0, word 0, expected 3f100000, actual 3f000000.
Shift destination X by one 36 mismatches on each adapter. First at mip 0, word 0, expected 3f100000, actual sentinel bf000000.
Sparse store or load mask Rejected with the operation's requires full DMASK 0xf diagnostic.
D16, 1D arrays, or 1D atomics Rejected as Unsupported compute instruction, identifying the instruction.
A16, plain image_load, or image_store_mip Rejected as an unsupported image load or store target.
Store with extra address VGPR or load missing its mip VGPR Rejected as an unsupported image target. LLVM 15 reports image address size does not match dim and a16.
Same descriptor, overlapping descriptors, or absent separate SRV Rejected by the descriptor or binding check.
Wrong UAV or SRV dimension, gfx1030, or UINT binding Rejected by the corresponding view or gfx1013 RGBA32 FLOAT binding check.
Omit vmcnt(0) Rejected for consuming the load before the wait.

Verification

Tested commit 3e27abf675945f30785477f3b457e7f92eabbe87 on Windows 10 22H2, build 19045.6456, using DXC 1.9.2602.17. The GTX 1060 6GB used driver 32.0.15.6094. In-box WARP used Microsoft Basic Render Driver 10.0.19041.5794. The D3D12 debug layer reported zero warnings and errors for the 1D fixture and its controls on both adapters.

Preset GTX 1060 pass WARP pass Docs pass Fail Capability skip
Debug (dev) 15 15 1 0 0
Release (release) 15 15 1 0 0

Set VULKAN_SDK to the Vulkan SDK 1.4.363.0 installation. Use a Python environment with requirements-dev.txt installed.

. .\tools\dev.ps1
$env:XBOX2WINDOWS_ADAPTER = '1060'
$env:X2W_D3D12_DEBUG = '1'
$python = (Resolve-Path .\out\pe-env\Scripts\python.exe).Path
$filter = '^compute_store_aot_(gfx1013_.*(image|mimg)|mimg_)|^docs_links$'
foreach ($preset in 'dev','release') {
    cmake --preset $preset "-DINTAKE_PYTHON=$python"
    cmake --build --preset $preset --target offscreen_check -j 2
    ctest --preset $preset --no-tests=error -j 1 -V -R $filter
}
& $python -B tests/compute_mimg_float_store_1d_check.py

The local binary checks used LLVM 15.0.7 for assembly, llvm-objcopy to extract .text, and libLLVM 15.0.0 from the LLVMSharp NuGet runtime for disassembly. The Windows DLL can be extracted to out/libLLVM-15.dll. LLVMSharp Windows runtime package

$mc = (Get-Command llvm-mc -CommandType Application).Source
$objcopy = (Get-Command llvm-objcopy -CommandType Application).Source
$library = (Resolve-Path .\out\libLLVM-15.dll).Path
foreach ($suite in 'float_store_1d','float_store','float_store_layers') {
    & $python -B "tests/compute_mimg_NAME_check.py".Replace('NAME', $suite) --binary $mc $objcopy --llvm $library
}
python3 -B tests/compute_mimg_float_store_1d_check.py --binary llvm-mc-15 llvm-objcopy-15 --llvm libLLVM-15.so.1

Limits

The 1D profile requires full masks, full-width addresses and data, and a separate read-only SRV for explicit mips. The fixture exercises in-bounds coordinates and normal binary32 values on desktop D3D12. Console out-of-bounds behavior, special floating-point values, and arbitrary resource formats are outside the measurement.

I reran it at 3e27abf6 on the same machine: 31/31 in dev and 31/31 in release (GTX 1060 and WARP, debug layer on, no skips), plus the LLVM 15 --binary checks of the 1D, 2D and layers fixtures.

AI-assisted (Codex, driven with Claude Code; Claude Code reviewed the change and reran the checks).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593729469 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2056). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-24T23:44:13Z. --- Refs #1545. **Stacked on #1649** (at `a9fb1792`): this PR also shows #1649’s commits until #1649 merges, and the change here is only `3e27abf6`. It stays a draft until then; I’ll rebase onto main once #1649 lands. ## Change Lower gfx1013 full-mask `R32G32B32A32_FLOAT` 1D stores to `RWTexture1D<float4>` at `u0`. Lower explicit-mip reads from a separate descriptor to `Texture1D<float4>` at `t0`, with `Load(int2(x, mip))`. The caller declares the UAV and SRV dimensions independently. RDNA 2 specifies one address VGPR for the store and two for the load (§8.2.3, Table 42). LLVM 15 accepted both forms and rejected the wrong address widths. [AMD RDNA 2 ISA](https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content) The compute fixture adds a distinct 1D case flag and uses the existing footprint-based upload and readback path. ## Tests The source-built shader copies all four channels from source mips 1 and 2 into eight unique texels of destination mip 0. The CPU reference compares all 224 destination words across mips of widths 32, 16 and 8, including 192 sentinels. The LLVM check reassembles the recorded bytes, disassembles the MIMG instructions, and compares the container CLI output against the HLSL from the assembly text. | Control | Result | |---|---| | Force the source mip to zero | 32 mismatches on each adapter. First at mip 0, word 0, expected `3f100000`, actual `3f000000`. | | Shift destination X by one | 36 mismatches on each adapter. First at mip 0, word 0, expected `3f100000`, actual sentinel `bf000000`. | | Sparse store or load mask | Rejected with the operation's `requires full DMASK 0xf` diagnostic. | | D16, 1D arrays, or 1D atomics | Rejected as `Unsupported compute instruction`, identifying the instruction. | | A16, plain `image_load`, or `image_store_mip` | Rejected as an unsupported image load or store target. | | Store with extra address VGPR or load missing its mip VGPR | Rejected as an unsupported image target. LLVM 15 reports `image address size does not match dim and a16`. | | Same descriptor, overlapping descriptors, or absent separate SRV | Rejected by the descriptor or binding check. | | Wrong UAV or SRV dimension, gfx1030, or UINT binding | Rejected by the corresponding view or gfx1013 RGBA32 FLOAT binding check. | | Omit `vmcnt(0)` | Rejected for consuming the load before the wait. | ## Verification Tested commit `3e27abf675945f30785477f3b457e7f92eabbe87` on Windows 10 22H2, build 19045.6456, using DXC 1.9.2602.17. The GTX 1060 6GB used driver 32.0.15.6094. In-box WARP used Microsoft Basic Render Driver 10.0.19041.5794. The D3D12 debug layer reported zero warnings and errors for the 1D fixture and its controls on both adapters. | Preset | GTX 1060 pass | WARP pass | Docs pass | Fail | Capability skip | |---|---:|---:|---:|---:|---:| | Debug (`dev`) | 15 | 15 | 1 | 0 | 0 | | Release (`release`) | 15 | 15 | 1 | 0 | 0 | Set `VULKAN_SDK` to the Vulkan SDK 1.4.363.0 installation. Use a Python environment with `requirements-dev.txt` installed. ```powershell . .\tools\dev.ps1 $env:XBOX2WINDOWS_ADAPTER = '1060' $env:X2W_D3D12_DEBUG = '1' $python = (Resolve-Path .\out\pe-env\Scripts\python.exe).Path $filter = '^compute_store_aot_(gfx1013_.*(image|mimg)|mimg_)|^docs_links$' foreach ($preset in 'dev','release') { cmake --preset $preset "-DINTAKE_PYTHON=$python" cmake --build --preset $preset --target offscreen_check -j 2 ctest --preset $preset --no-tests=error -j 1 -V -R $filter } & $python -B tests/compute_mimg_float_store_1d_check.py ``` The local binary checks used LLVM 15.0.7 for assembly, llvm-objcopy to extract `.text`, and libLLVM 15.0.0 from the LLVMSharp NuGet runtime for disassembly. The Windows DLL can be extracted to `out/libLLVM-15.dll`. [LLVMSharp Windows runtime package](https://www.nuget.org/packages/libLLVM.runtime.win-x64/15.0.0) ```powershell $mc = (Get-Command llvm-mc -CommandType Application).Source $objcopy = (Get-Command llvm-objcopy -CommandType Application).Source $library = (Resolve-Path .\out\libLLVM-15.dll).Path foreach ($suite in 'float_store_1d','float_store','float_store_layers') { & $python -B "tests/compute_mimg_NAME_check.py".Replace('NAME', $suite) --binary $mc $objcopy --llvm $library } ``` ```bash python3 -B tests/compute_mimg_float_store_1d_check.py --binary llvm-mc-15 llvm-objcopy-15 --llvm libLLVM-15.so.1 ``` ## Limits The 1D profile requires full masks, full-width addresses and data, and a separate read-only SRV for explicit mips. The fixture exercises in-bounds coordinates and normal binary32 values on desktop D3D12. Console out-of-bounds behavior, special floating-point values, and arbitrary resource formats are outside the measurement. I reran it at `3e27abf6` on the same machine: 31/31 in dev and 31/31 in release (GTX 1060 and WARP, debug layer on, no skips), plus the LLVM 15 `--binary` checks of the 1D, 2D and layers fixtures. AI-assisted (Codex, driven with Claude Code; Claude Code reviewed the change and reran the checks).
Jess-Doit commented 2026-11-25 06:01:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-25T05:10:51Z.


Kept in step: d9d5ce8b merges the new #1649 head, which already includes current main. The CLI's lower() call forwards both image_srv_dimension and main's load_format_constant. On GTX 1060 + WARP: 12 passed, 0 failed, 0 skipped. LLVM 15 fixture checks, docs links and bidi also pass.

Status: still a draft that depends on #1649. I'll rebase it onto main and mark it ready once #1649 merges.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7153523620 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2056#issuecomment-7153523620). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-25T05:10:51Z. --- Kept in step: `d9d5ce8b` merges the new #1649 head, which already includes current `main`. The CLI's `lower()` call forwards both `image_srv_dimension` and main's `load_format_constant`. On GTX 1060 + WARP: 12 passed, 0 failed, 0 skipped. LLVM 15 fixture checks, docs links and bidi also pass. **Status:** still a draft that depends on #1649. I'll rebase it onto `main` and mark it ready once #1649 merges.
Jess-Doit commented 2026-11-25 18:01:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-25T17:09:22Z.


Rebased onto the refreshed #1649 (9ae3d2ed, on main 7092683a) and force-pushed: head is now 03002826.

One behaviour change from the rebase: main's same-texel UAV load path (#2136) now applies only to 2D views. Before, a plain 1D image_load would enter it and be refused later, as an unverified descriptor. Now it gets the existing full-width refusal, which is what this PR's control expects. The UAV-load docs already describe that path as 2D-only.

Tests on Windows 10 build 19045, dev preset, GTX 1060 6GB (driver 32.0.15.6094) and in-box WARP 10.0.19041.

  • compute_store_aot_gfx1013_image_: 12 of 12.
  • Pure-Python: the 1D, layers, UAV load, D16 and heap-store checks pass.

This stays a draft until #1649 merges.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7169088095 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2056#issuecomment-7169088095). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-25T17:09:22Z. --- Rebased onto the refreshed #1649 (`9ae3d2ed`, on `main` `7092683a`) and force-pushed: head is now `03002826`. **One behaviour change from the rebase:** `main`'s same-texel UAV load path (#2136) now applies only to 2D views. Before, a plain 1D `image_load` would enter it and be refused later, as an unverified descriptor. Now it gets the existing full-width refusal, which is what this PR's control expects. The UAV-load docs already describe that path as 2D-only. **Tests** on Windows 10 build 19045, `dev` preset, GTX 1060 6GB (driver 32.0.15.6094) and in-box WARP 10.0.19041. - `compute_store_aot_gfx1013_image_`: 12 of 12. - Pure-Python: the 1D, layers, UAV load, D16 and heap-store checks pass. This stays a draft until #1649 merges.
Jess-Doit commented 2026-11-25 21:01:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-25T20:41:19Z.


Moved onto the rebased #1649 (fab79c8e, on main 5123cc6d) and force-pushed: head is now 84e36821. There were no conflicts.

Tests: ctest -R "mimg|image_store|image_load|1d" on GTX 1060 + WARP: 45 of 46 pass. The one failure, startup_image_load_d16_warp, fails on main on this host too.

Still a draft until #1649 merges. Ready for more review.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7174041539 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2056#issuecomment-7174041539). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-25T20:41:19Z. --- Moved onto the rebased #1649 (`fab79c8e`, on `main` `5123cc6d`) and force-pushed: head is now `84e36821`. There were no conflicts. **Tests:** `ctest -R "mimg|image_store|image_load|1d"` on GTX 1060 + WARP: 45 of 46 pass. The one failure, `startup_image_load_d16_warp`, fails on `main` on this host too. Still a draft until #1649 merges. Ready for more review.
Jess-Doit commented 2026-11-25 22:02:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-25T21:52:04Z.


#1649 is merged, so this is rebased onto current main (0104f763) as one commit and force-pushed: head is now ce50e406. There were no conflicts. It now contains only the 1D change, and I'm marking it ready for review.

Tests on Windows 10 19045, GTX 1060 + WARP:

  • ctest -R "mimg|image_store|image_load|1d": 48 of 49 pass.
  • The one failure, startup_image_load_d16_warp, fails on main on this host too.
  • All zero-argument *_controls in tests/compute_store_check.py pass, and so do the 1D translation controls.

Ready for more review.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7175639987 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2056#issuecomment-7175639987). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-25T21:52:04Z. --- #1649 is merged, so this is rebased onto current `main` (`0104f763`) as one commit and force-pushed: head is now `ce50e406`. There were no conflicts. It now contains only the 1D change, and I'm marking it ready for review. **Tests** on Windows 10 19045, GTX 1060 + WARP: - `ctest -R "mimg|image_store|image_load|1d"`: 48 of 49 pass. - The one failure, `startup_image_load_d16_warp`, fails on `main` on this host too. - All zero-argument `*_controls` in `tests/compute_store_check.py` pass, and so do the 1D translation controls. Ready for more review.
upstream-sync closed this pull request 2026-11-25 23:01:41 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2049
No description provided.