Repository navigation
test: texture tiles NOTE only for the measured CopyTiles offset rounding on AMD and Intel (D3D-TILES-AMD-BYTE-OFFSET) - #964
Conversation
…-TILES-AMD-BYTE-OFFSET) d3d12_texture_tiles failed on AMD Windows (RX 7900 XT, driver 32.0.32029.2010 / 26.11.2) with "row-major alias tile 0 at (0,0): got 0x20000cc, expected 0xcc020000". The half that failed was native D3D12, not the Vulkan layer: the layer's 256 x 240 replay at linear offset 1 had already passed, and buffered stdout printed its progress line after the native failure on stderr. AMD's driver behaves as if CopyTiles rounded BufferStartOffsetInBytes down to a multiple of 4, in both directions: the row-major CopyTextureRegion finds each texel 1-3 bytes early, and texels that straddle a tile seam differ in the CopyTiles reads too. Offsets 1, 2, 3, 5, 6 and 7 diverge; 4 and 8 match. CopyTiles documents no alignment for that offset, WARP meets the test's expectations at every offset tried (1-8), and so does the layer, which stages unaligned offsets through transfer scratch so Vulkan only sees texel-aligned bufferOffsets (the validation layer reports nothing). The mechanism is inferred from the texel values: the D3D12 debug layer is not installed here and was not run. At a byte-unaligned offset the native run now reads every texel quietly and is a NOTE (on stdout) only when every checked read equals modelled_readback(), the CPU model of CopyTiles moving whole 64 KiB tiles with the offset rounded down to 4. Any other divergence fails and names the first read off the model, and every byte-offset case first checks that the model with the true offset reproduces the expectations. In local runs with extra cases (not committed), native on this GPU matches the model at every texel for offsets 1-3 and 5-7 on 256x256, 240x240, 130x129 and 129x250, and a deliberately wrong model (a multiple of 2) fails. WARP runs at those offsets to confirm the expectations; without WARP the output says nothing confirms them. The layer is held to the expectations at every offset, as before. 256x240 and 240x240 at offset 4 are new cases, so native stays strict on clipped tiles on every GPU. Under Wine and Proton neither the hardware adapter nor WARP is compared (host_wine.h), as in the other host-comparison tests. stdout is unbuffered so progress lines stay in order with failures. docs/testing.md gets a Known problems row and docs/d3d12_vulkan.md describes the driver behaviour. Not addressed here, and still red now and then on AMD: the native half of the COPY-to-DIRECT case (offset 4) sometimes reads zeros through the aliased tiles on this GPU (5 of 30 runs under a parallel ctest, and once in 3 single-test runs). On 23c4596 that case is never reached on AMD, because the offset-1 case fails first; it also fails with the unchanged test code when only that case is run, and in a native-only probe without the layer. It is a separate finding. Tested on AMD Radeon RX 7900 XT, driver 32.0.32029.2010, Windows 11, Vulkan SDK 1.4.363.0: the test from 23c4596 fails 6/6 runs at offset 1; this one passed 6/6 in a row (3 with LEONIDA_VK_VALIDATION=1, no validation messages), apart from the handoff case above; full ctest: only the 4 failures main already has on this GPU (vk_queue_query_sync, d3d12_execute_indirect_validation, d3d12_clear, d3d12_pipeline_library_host). AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
4 open issues
height - first_yandwidth - first_xare unsigned subtractions. If a future case uses a texture… · New For the byte-unaligned cases, the advisory model assumes deterministic bytes in the upload buffer… · New This row hard-codes an example NOTE mentioning only offset 1→0 (and offset 3). The test output is… · New The!advisory->unmodelled++idiom is hard to read and easy to misinterpret when revisiting this… · New
What changed in this PR
Updates the d3d12_texture_tiles test to treat a specific AMD Windows CopyTiles byte-offset divergence as a non-fatal NOTE (when it matches a CPU model), and documents the behavior.
Changes:
- Refactors the test’s readback verification into shared helpers and adds a CPU model to classify AMD’s rounded-offset behavior.
- Adds optional WARP verification for byte-unaligned offsets and skips native/WARP comparisons under Wine/Proton.
- Documents the known AMD driver behavior in testing and D3D12/Vulkan docs.
| File | Description |
|---|---|
| runtime/test/d3d12_texture_tiles_test.cpp | Adds CPU model + advisory reporting for byte-unaligned CopyTiles offsets; adds WARP confirmation; skips native/WARP comparisons under Wine; unbuffers stdout |
| docs/testing.md | Adds a Known problems entry describing the NOTE and the AMD CopyTiles rounding behavior |
| docs/d3d12_vulkan.md | Documents the test’s behavior and the inferred AMD driver rounding behavior |
Review effort: Lite
| bool for_each_checked(UINT width, UINT height, UINT64 tile_copy_offset, Visit&& visit) { | ||
| for (UINT tile = 0; tile < tiles; ++tile) { | ||
| const UINT first_y = (tile / 2) * tile_height, first_x = (tile % 2) * tile_width; | ||
| const UINT rows = std::min(tile_height, height - first_y), columns = std::min(tile_width, width - first_x); |
There was a problem hiding this comment.
Done in e4f040332: the loop skips a tile whose first row or column is outside the texture (if (first_y >= height || first_x >= width) continue;) before the subtractions.
| D3D12_RESOURCE_STATE_COPY_DEST, readback)); | ||
| const D3D12_RANGE empty{0, 0}; | ||
| void* mapped = nullptr; | ||
| EXPECT(SUCCEEDED(upload->Map(0, &empty, &mapped))); |
There was a problem hiding this comment.
Done in e4f040332: the upload range before tile_copy_offset is zeroed (std::memset(mapped, 0, tile_copy_offset)) before fill_tiles(), so the rounded-down model reads known bytes.
| | With `--wave64-emulate` (or `LEONIDA_W64_EMULATE=1`) on an NVIDIA RTX 5080 with Windows driver 32.0.16.1692 (616.92), `crosslane_fuzz.py --seed 91001 --dpp --no-maskdata` reports a hard mismatch for `cs_xl64_9100373886`: after `s_xor_b64 s[16:17], vcc, vcc` (0 in every lane), the second of two nested `v_cndmask_b32_e64 … s[16:17]` returns the old register instead of the lane id | An NVIDIA driver miscompile, not the translator (SHADER-720). The same SPIR-V (spirv-val clean) matches the model on an RTX 3060 with 616.64, an RTX 5060 Ti (Blackwell) with 621.14, an RTX 5070 Ti with 621.24 and an RTX 5080 with the Linux 580.65.06 driver. Hand edits narrow it to a value selected through the `%active` gate of a store; on the Linux 580 driver a similar pattern, a subgroup shuffle selected by an `%active` that is false, still fails in three wave32 `v_permlane16`/`v_permlanex16` programs of the same seed (#3796, #3918) | Update the NVIDIA driver to 621.14 or newer on Windows. If a crosslane mismatch only shows on one driver, check another driver or GPU before changing the translator | | ||
| | `lds_fuzz.py --wave 64` (native, not `--emulate`) reports a `ds_bpermute_b32` mismatch on an AMD GPU on Windows, e.g. `cs_ldsfuzz_s7031_496_w64` (seed 7031): small values like `0x14` where the model wants another lane's data, while `--oracle hw` and `--emulate` on another GPU agree with the model | The AMD Windows driver (32.0.21042.62, gfx1036) miscompiles a native wave64 compute shader with two subgroup shuffles; a reduced SPIR-V module is in #4613 | Not a translator regression: check the same seed with `--oracle hw` and with `--emulate`. Native wave64 results on that driver need that cross-check | | ||
| | On AMD's Windows driver a compute pipeline creation takes tens of minutes: `vk_pipeline_check` prints `still compiling <name> after ...s` with one busy thread, or a compute PSO creation through the D3D12 layer seems never to return | The driver's compiler on one module in the dispatch-loop form (`"control_flow": "dispatch loop"` in the translated `index.json`). Measured on a Radeon gfx1036 iGPU, driver 32.0.21042.62 (SHADER-995): `XboxBvhBuilder.dll`'s `LeafRehydration` in that form (a 581-case switch in a loop) was created after 34 minutes of one busy thread (XXTESTING), while its structured module is created in 2.9 s and an RTX 3070 (NVIDIA 610.74) created the dispatch-loop one in 11 s. It is not every such module: ten other programs of that DLL compile in that form on the Radeon in 0.4 to 40 s ([embedded_shaders.md](embedded_shaders.md), section 7). Not tried on another AMD GPU or driver branch | Translate with current `main`. Since SHADER-427 only a tree nested deeper than 64, a graph that cannot be made reducible or `--dispatch-loop` gives that form, and none of that DLL's programs has it; the shaders stage translates again by itself when the translator changed. A wave64 compute shader that still has it comes out in another form with `--wave64-emulate on` (12.4 s for this program on that driver), which that driver can crash on for other programs (#857) | | ||
| | `d3d12_texture_tiles` passes but prints `NOTE: native D3D12 broke the expectations at N of M checked reads, every read as CopyTiles would with linear offset 1 rounded down to 0 in both directions` (and the same at offset 3) | AMD's Windows D3D12 driver (RX 7900 XT, 26.11.2, `32.0.32029.2010`) runs `CopyTiles` at a byte-unaligned `BufferStartOffsetInBytes` as if the offset were rounded down to a multiple of 4, in both directions. That is inferred from the texel values; the D3D12 debug layer was not run. `CopyTiles` documents no alignment, WARP meets the test's expectations at every offset tried (1-8), and so does the layer, which stages such offsets through aligned scratch | Nothing: the note is harmless. The test still fails when a native run diverges in any other way, or at a 4-byte offset | |
There was a problem hiding this comment.
Done in e4f040332: the row now quotes the note with placeholders (linear offset X rounded down to Y), says Y is X rounded down to a multiple of 4, and that the test runs X = 1 and 3.
| if (actual != modelled && !advisory->unmodelled++) | ||
| std::snprintf(advisory->first_unmodelled, sizeof(advisory->first_unmodelled), | ||
| "%s tile %u at (%u,%u): got %#x, expected %#x, modelled %#x", read, tile, x, y, actual, | ||
| expected, modelled); |
There was a problem hiding this comment.
Done in e4f040332: it is now an explicit if (... unmodelled == 0) { ... } followed by the increment on its own line (the field is model.unmodelled since the second driver model was added).
- for_each_checked skips a tile that starts past the texture's edge, so a case smaller than the tile grid cannot underflow `height - first_y`. - The upload buffer is zeroed before the CopyTiles offset: modelled_readback() reads those bytes when it rounds the offset down, and the model should not rely on the committed resource starting zeroed. - The first-unmodelled capture and the counter are written out explicitly instead of `!advisory->unmodelled++`. - docs/testing.md quotes the NOTE with placeholders (offset X rounded down to Y) instead of offset 1 only. Tested on AMD Radeon RX 7900 XT, driver 32.0.32029.2010: builds without warnings, d3d12_texture_tiles passes 3/3 (one with LEONIDA_VK_VALIDATION=1, no validation messages). AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed the four review comments in
Re-run on the RX 7900 XT (driver 32.0.32029.2010): builds without warnings, |
|
Tested e4f0403 applied on The native device the test picks here is the Iris Xe (tiled resources tier 3). The result is the same with the layer on the Iris Xe and on the RTX 4060 Laptop GPU (NVIDIA 616.92). The three offset-4 cases match natively, the layer passes every case and WARP is found (tier 3). Then: On unchanged What this driver does, measured with a temporary local edit of So a second accepted model, rounded in the readback direction only, would cover this driver. I can rerun here if you push one. Built with MSVC 19.50 + Ninja, RelWithDebInfo. AI-assisted: this run was made with a coding agent. |
…ding (D3D-TILES-AMD-BYTE-OFFSET) An Intel Iris Xe host (Intel 32.0.101.7092, Windows 11 26100) still failed d3d12_texture_tiles at linear offset 1: 94208 of 245760 checked reads broke the expectations, and 155648 differed from the AMD model. Measured there, that driver rounds BufferStartOffsetInBytes down to a multiple of 4 only when CopyTiles writes the buffer (tiles to buffer); the upload (buffer to tiles) honours the offset. modelled_readback() now takes the upload and the readback offsets separately, and a native run at a byte-unaligned offset is a NOTE when every checked read matches one of two measured models: rounded in both directions (AMD) or only in the tiles-to-buffer copies (Intel). The NOTE names the model that matched, and every diverging case on a device must match the same model, or the test fails. Anything else still fails too, and the failure prints how many reads each model leaves unexplained, with the first one. 4-byte offsets stay strict, and the layer is still held to the expectations. docs/testing.md and docs/d3d12_vulkan.md describe the Intel pattern, measured on that host in ProjectLeonida#964. On the AMD Radeon RX 7900 XT (32.0.32029.2010) the test still passes with the both-directions NOTE (4 runs, one with LEONIDA_VK_VALIDATION=1). A temporary local probe (not committed) checked the models against each other: the readback-only model breaks the expectations at 94208 of 245760 reads at offset 1 and 84480 of 222720 at offset 3, and differs from the both-directions model at 155648 reads at offset 1, the counts measured on the Iris Xe. On the AMD GPU it leaves 155648 and 138240 reads unexplained, so the two models do not overlap, and an upload-only model or one rounding to a multiple of 2 fails there too. A probe that pretended an earlier case had matched the Intel model made the AMD run fail on the model mismatch, as intended. Full ctest (-j 6): d3d12_texture_tiles passes; the other failures are the four main already has on this GPU, plus xmem once (its working-set charge check, under parallel load; it passed 3 of 3 runs alone, and this change does not touch it). Not run on Intel here.
|
@MalexAson thanks, that was exactly what was missing. Pushed
Checked on the RX 7900 XT, without Intel hardware:
Could you rerun |
|
Tested 83aea69 applied on
The counts are the ones from my first measurement, and both diverging cases report the same model, so the one-model-per-device rule holds here. AI-assisted: this run was made with a coding agent. |
…Intel iGPU's native D3D12 d3d12_texture_tiles prints "Native D3D12: Intel(R) UHD Graphics" before its failure, and d3d12_root_args_validation walks the hardware adapters. Say so, and tie texture_tiles to ProjectLeonida#964 instead of calling it unexplained. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Tested on a two-GPU Windows laptop: the layer on an NVIDIA GeForce RTX 4060 Laptop GPU (NVIDIA 610.78), Windows 11 build 26300. The test's native D3D12 side is the Intel UHD Graphics iGPU (Windows driver 31.0.101.4255, tiled resources tier 3), the first hardware adapter.
So the Iris Xe pattern also holds on an Intel UHD Graphics. A side note: the test picks its native adapter itself and ignores |
…ajor-offset # Conflicts: # runtime/test/d3d12_texture_tiles_test.cpp


Claimed in the coordination issue as: D3D-TILES-AMD-BYTE-OFFSET
What and why
d3d12_texture_tilesfails on AMD Windows (RX 7900 XT, AMD 26.11.2 / 32.0.32029.2010):row-major alias tile 0 at (0,0): got 0x20000cc, expected 0xcc020000. It is one of the fivectestfailures #787 lists for RDNA3 on Windows.The half that fails is native D3D12, not the Vulkan layer. The layer's
256 x 240, linear offset 1replay had already passed. Buffered stdout printed its progress line after the native failure on stderr, which made it look like the layer's failure.AMD's driver behaves as if
CopyTilesroundedBufferStartOffsetInBytesdown to a multiple of 4, in both directions:0x020000cc, which is the bytes at offset 0 instead of offset 1, and the texels that straddle a tile seam.The other implementations disagree with AMD:
CopyTilesdocuments no alignment for that offset.This is inferred from the texel values. I did not run the D3D12 debug layer (not installed on this machine).
Update: an Intel Iris Xe host (Intel 32.0.101.7092), measured in this PR by @MalexAson, rounds the offset only in the tiles-to-buffer copies; its upload honours the offset. The test now accepts that pattern as a second model.
Change (test and docs only, no runtime change):
CopyTilesfrommodelled_readback(). Both round the offset down to a multiple of 4: AMD's in both directions, Intel's only in the tiles-to-buffer copies. The NOTE names the model, and every diverging case on a device must match the same one. Any other divergence still fails and prints, for each model, how many reads it leaves unexplained and the first one. Every byte-offset case first checks that the model with the true offset reproduces the test's expectations. The precedent for a NOTE on a measured driver divergence isd3d12_bundle_test.256x240and240x240at offset 4: native stays strict on clipped tiles on every GPU.host_wine.h), as in the other host-comparison tests. stdout is unbuffered.docs/testing.md: new Known problems row.docs/d3d12_vulkan.md: describes the driver behaviour.Tested
AMD Radeon RX 7900 XT, driver 32.0.32029.2010, Windows 11, MSVC (VS 2022), Vulkan SDK 1.4.363.0, base
23c459644.LEONIDA_VK_VALIDATION=1and 3 without. After: passed 6/6 in a row, with no validation messages, and a passing run prints nogot ... expectedlines. The one exception is the handoff case described below.83aea690a: pass, with the tiles-to-buffer-only NOTE at offsets 1 and 3 (test: texture tiles NOTE only for the measured CopyTiles offset rounding on AMD and Intel (D3D-TILES-AMD-BYTE-OFFSET) #964 (comment)).ctest: only the 4 failuresmainalready has on this GPU (vk_queue_query_sync,d3d12_execute_indirect_validationd3d12_execute_indirect_validation: 5 rows where the layer rejects and live WARP and hardware accept (over-strict, not permissive) #504,d3d12_cleard3d12: use legal Vulkan depth clear values (D3D-CLEAR-DEPTH-RANGE) #516/d3d12/vulkan: write NaN depth clears with a copy on AMD (D3D-CLEAR-NAN-DEPTH) #787,d3d12_pipeline_library_host).Still intermittent on AMD, separate issue: the native half of the COPY-to-DIRECT case (offset 4) sometimes reads zeros through the aliased tiles on this GPU. It failed 5 of 30 runs under a parallel
ctestand once in 3 single-test runs.mainthis case is never reached on AMD, because the offset-1 case fails first. This PR therefore turns a deterministic red into an occasional one on AMD.GPUs tested: AMD Radeon RX 7900 XT (RDNA3), AMD driver 26.11.2 (32.0.32029.2010), Windows 11; Intel Iris Xe (Raptor Lake-P), Intel 32.0.101.7092, Windows 11 24H2 (by @MalexAson)
AI-assisted: yes (Claude Code; the change went through three independent review passes before opening)
Checklist
mainand merges cleanly (written on23c459644, merges cleanly ontoa28927849).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code