Skip to content

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

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
RonLogic:test/implicit-lod-quad-ramp
Nov 28, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
RonLogic:test/implicit-lod-quad-ramp

Conversation

@RonLogic

Copy link
Copy Markdown
Contributor

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.

@Leyukaka

Copy link
Copy Markdown
Collaborator

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 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@R0Y00
R0Y00 merged commit 19358da into R0Y00:main Nov 28, 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.

3 participants