Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/experiments/native-compute-implicit-derivatives.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ ctest --preset dev --no-tests=error -j 1 -R '^native_compute_implicit_lod_' -V
On an NVIDIA GeForce RTX 5080 (Windows 11, Release), the hardware fixture
matches its CPU reference for 4-, 12-, 32- and 96-thread wave32 groups,
64- and 128-thread wave64 groups, and the multidimensional (8,4,1) and
(8,4,2) groups. Its other readbacks cover bias selecting mip 2, point depth
(8,4,2) groups. The multidimensional fixture varies the texture coordinate
only in the quad's vertical direction. Its derivative spans 0.75 texels
for consecutive quads and three texels for spatial 2D quads. This keeps
the expected sample below the first mip transition and leaves the wrong
quad layout observable with the fixture's trilinear sampler.
The compile controls check that implicit shaders emit flattened DXIL
group dimensions and explicit-LOD shaders keep the requested dimensions.
Its other readbacks cover bias selecting mip 2, point depth
comparison at mip 1, both LOD query outputs, and the four taps of mip-zero
Gather. Bias and Gather each use the same CPU reference for their implicit
and explicit-LOD shaders. Inbox WARP reports the capability skip
Expand Down
18 changes: 12 additions & 6 deletions tests/native_compute_implicit_lod_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ def program(group, wave32, implicit):
vop2(26, 5, 130, 0), # v5 = linear index * 4, the output byte offset
]
if y > 1:
# V ramps within each pair of guest rows. Consecutive quads step two lanes
# in ddy, covering one texel (mip 0). Without flattening, the 2D spatial
# quad steps eight lanes in ddy, covering four texels (mip 2).
# Use a vertical-only ramp. Consecutive quads step two indices in ddy
# (0.75 texels) and have zero ddx. Spatial 2D quads step eight indices
# in ddy (three texels), so they sample above mip zero.
code += [
0x7E0202F0, # v_mov_b32 v1, 0.5 (U)
vop2(27, 2, 143, 0), # v2 = linear index & 15
vop2(27, 2, 142, 0), # v2 = linear index & 14
0x7E040D02, # v_cvt_f32_u32 v2, v2
vop2(8, 2, 255, 2), bits(1 / (2 * HEIGHT)), # V
vop2(8, 2, 255, 2), bits(3 / (8 * HEIGHT)), # V
0x7E060280, # v_mov_b32 v3, 0 (explicit LOD)
]
else:
Expand Down Expand Up @@ -200,8 +200,14 @@ def main(cli, sdk, *render_args):
with tempfile.TemporaryDirectory() as tmp:
work = Path(tmp)
if not render_args:
dxc = Path(sdk) / 'dxc.exe'
for group, wave32 in CASES:
tuple(compile_pair(cli, sdk, work, group, wave32))
shaders = compile_pair(cli, sdk, work, group, wave32)
for shader, dimensions in zip(shaders, ((math.prod(group), 1, 1), group)):
dump = subprocess.check_output([dxc, '-dumpbin', shader], text=True, timeout=30)
expected = '; NumThreads=(' + ','.join(map(str, dimensions)) + ')'
actual = next((line for line in dump.splitlines() if line.startswith('; NumThreads=')), '')
assert actual == expected, (shader.name, expected, actual)
for group, reason in (
((36, 1, 1), 'partial final wave in multi-wave group'),
((6, 1, 1), 'implicit derivatives require a pixel stage'),
Expand Down
Loading