test: isolate the quad axis in the compute LOD replay #3299

Merged
RonLogic merged 1 commit from upstream-pr/3299 into main 2026-11-28 06:23:40 +00:00
RonLogic commented 2026-11-28 06:15:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-28T06:15:35Z.


Change

Refs #3255 and the RX 9060 XT readback in #3241.

The multidimensional Compute replay uses a trilinear sampler. Its original ramp produced horizontal and vertical derivatives of 0.5 and 1 texel along the same texture axis, while the reference required an exact mip-0 value. The revised ramp is constant within each horizontal pair. It places consecutive quads at a 0.75-texel vertical footprint and spatial 2D quads at three texels. This leaves room below the mip transition and keeps the layout difference visible in the readback.

The compile controls also inspect DXIL NumThreads. The implicit shader must use flattened dimensions and the explicit-LOD shader must retain the requested shape. Production shader lowering and runtime bindings are unchanged.

Verification

1936f7ac on 6a1968a1. Windows 11 build 26300.10075, DXC 1.9.2602.17, Agility 1.620.2. RTX 4070 driver 32.0.16.2124 and app-local WARP 1.0.22. Both adapters had the D3D12 debug layer enabled.

cmake --build out/build/release-agility --target offscreen_check compile_dxil
ctest --test-dir out/build/release-agility --no-tests=error -R '^(native_compute_implicit_lod_.*|native_direct_container|shader_wave32_(hardware|warp))$' -V

All six checks passed, with zero skips. The independent source-built HLSL control read ddx=0 and ddy=0.75 texels for all 32 flattened threads on both adapters, and all 320 output and guard words matched. With an actual 8x4x1 spatial dispatch, it read ddy=3 and the mip-0 oracle rejected all 32 sample words. The first mismatch was 0x3f800000 expected versus 0x40560000 on RTX and 0x404b0000 on WARP. The metadata check independently rejected the unflattened 8x4x1 module when substituted for the flattened shader.

Evidence and follow-up

The RX 9060 XT report remains to be rerun with this ramp. Its original 0x3f948000 word is consistent with a fractional trilinear blend, so it leaves both the LOD calculation and the lane-order hypothesis open. The changed programs are generated by the existing synthetic fixture. I used Codex to prepare the change and ran verification locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5537376580 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3299). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-28T06:15:35Z. --- ## Change Refs #3255 and the [RX 9060 XT readback in #3241](https://github.com/R0Y00/Xbox2Windows/pull/3241#issuecomment-7233177324). The multidimensional Compute replay uses a trilinear sampler. Its original ramp produced horizontal and vertical derivatives of 0.5 and 1 texel along the same texture axis, while the reference required an exact mip-0 value. The revised ramp is constant within each horizontal pair. It places consecutive quads at a 0.75-texel vertical footprint and spatial 2D quads at three texels. This leaves room below the mip transition and keeps the layout difference visible in the readback. The compile controls also inspect DXIL `NumThreads`. The implicit shader must use flattened dimensions and the explicit-LOD shader must retain the requested shape. Production shader lowering and runtime bindings are unchanged. ## Verification `1936f7ac` on `6a1968a1`. Windows 11 build 26300.10075, DXC 1.9.2602.17, Agility 1.620.2. RTX 4070 driver 32.0.16.2124 and app-local WARP 1.0.22. Both adapters had the D3D12 debug layer enabled. ```powershell cmake --build out/build/release-agility --target offscreen_check compile_dxil ctest --test-dir out/build/release-agility --no-tests=error -R '^(native_compute_implicit_lod_.*|native_direct_container|shader_wave32_(hardware|warp))$' -V ``` All six checks passed, with zero skips. The independent source-built HLSL control read `ddx=0` and `ddy=0.75` texels for all 32 flattened threads on both adapters, and all 320 output and guard words matched. With an actual `8x4x1` spatial dispatch, it read `ddy=3` and the mip-0 oracle rejected all 32 sample words. The first mismatch was `0x3f800000` expected versus `0x40560000` on RTX and `0x404b0000` on WARP. The metadata check independently rejected the unflattened `8x4x1` module when substituted for the flattened shader. ## Evidence and follow-up The RX 9060 XT report remains to be rerun with this ramp. Its original `0x3f948000` word is consistent with a fractional trilinear blend, so it leaves both the LOD calculation and the lane-order hypothesis open. The changed programs are generated by the existing synthetic fixture. I used Codex to prepare the change and ran verification locally.
Leyukaka commented 2026-11-28 06:18:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T06:18:13Z.


Thanks, this fixes a flaw in the #3255 fixture that I missed. The original ramp, V = (index & 15) / 16 on the 8-texel-tall base, gave the consecutive quad 0.5 texel in ddx and 1 texel in ddy, both along the same texture axis. Under max() that is LOD 0, right at the trilinear boundary. The RX 9060 XT word 0x3f948000 is 1 + 41/256. That is consistent with LOD log2(hypot(0.5, 1)) = 0.161 under trilinear filtering, which would blend in mip 1. I have not verified that on that card.

I checked the new ramp by reading the diff (not run). V = (index & 14) * 3 / (8 * HEIGHT) gives:

  • zero ddx, since lane pairs share a value. That removes the dependence on how the two derivatives are combined;
  • 0.75 texel in ddy for consecutive quads (LOD about -0.42, mip 0, with margin);
  • 3 texels for spatial 2D quads (LOD about 1.58).

The & 14 wrap falls between quads, never inside one. So the wrong quad layout stays observable, and the expected sample stays clear of the mip transition. The NumThreads check on both shaders also pins the flattening directly, independent of the driver.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7235209181 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3299#issuecomment-7235209181). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T06:18:13Z. --- Thanks, this fixes a flaw in the #3255 fixture that I missed. The original ramp, `V = (index & 15) / 16` on the 8-texel-tall base, gave the consecutive quad 0.5 texel in ddx and 1 texel in ddy, both along the same texture axis. Under `max()` that is LOD 0, right at the trilinear boundary. The RX 9060 XT word `0x3f948000` is 1 + 41/256. That is consistent with LOD log2(hypot(0.5, 1)) = 0.161 under trilinear filtering, which would blend in mip 1. I have not verified that on that card. I checked the new ramp by reading the diff (not run). `V = (index & 14) * 3 / (8 * HEIGHT)` gives: - zero ddx, since lane pairs share a value. That removes the dependence on how the two derivatives are combined; - 0.75 texel in ddy for consecutive quads (LOD about -0.42, mip 0, with margin); - 3 texels for spatial 2D quads (LOD about 1.58). The `& 14` wrap falls between quads, never inside one. So the wrong quad layout stays observable, and the expected sample stays clear of the mip transition. The `NumThreads` check on both shaders also pins the flattening directly, independent of the driver. AI-assisted.
R0Y00 commented 2026-11-28 06:23:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T06:23:31Z.

Review: APPROVED


Independent Release check on 1936f7ac: ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^(native_compute_implicit_lod_.*|native_direct_container|shader_wave32_(hardware|warp))$' reported four passes and two capability skips. The RTX 4060 Laptop hardware replay and DXIL dimensions controls passed on Windows 11 build 26200/DXC 10.0.26100; inbox WARP 10.0.26100.9818 skipped the two wave32 cases. The revised ramp holds the coordinate constant across horizontal pairs and still distinguishes spatial ordering. The diff is confined to fixture and documentation. The RX 9060 XT follow-up remains open.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6096258143 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3299#pullrequestreview-6096258143). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-28T06:23:31Z. **Review:** APPROVED --- Independent Release check on `1936f7ac`: `ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^(native_compute_implicit_lod_.*|native_direct_container|shader_wave32_(hardware|warp))$'` reported four passes and two capability skips. The RTX 4060 Laptop hardware replay and DXIL dimensions controls passed on Windows 11 build 26200/DXC 10.0.26100; inbox WARP 10.0.26100.9818 skipped the two wave32 cases. The revised ramp holds the coordinate constant across horizontal pairs and still distinguishes spatial ordering. The diff is confined to fixture and documentation. The RX 9060 XT follow-up remains open.
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!3299
No description provided.