test: texture tiles NOTE only for the measured CopyTiles offset rounding on AMD and Intel (D3D-TILES-AMD-BYTE-OFFSET) #964

Open
github-bot wants to merge 4 commits from github-bot/gh-964 into main AGit
Owner

@⁠adrianmjim on GitHub · 2026-11-24 15:56 UTC · original
adrianmjim:fix/texture-tiles-row-major-offset → main · +245 −47 · 3 files · 4 commits · open

Claimed in the coordination issue as: D3D-TILES-AMD-BYTE-OFFSET

What and why

d3d12_texture_tiles fails 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 five ctest failures #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 1 replay 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 CopyTiles rounded BufferStartOffsetInBytes down to a multiple of 4, in both directions:

  • Offsets 1, 2, 3, 5, 6 and 7 diverge; offsets 4 and 8 match.
  • Every divergent texel fits that model. That includes the reported 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:

  • CopyTiles documents no alignment for that offset.
  • WARP meets the test's expectations at every offset tried (1-8).
  • The layer meets them too. It stages unaligned offsets through transfer scratch, and the validation layer reports nothing.

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):

  • At a byte-unaligned offset, the native run reads every texel and produces a NOTE (on stdout) only if every checked read equals one of two CPU models of CopyTiles from modelled_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 is d3d12_bundle_test.
  • WARP runs at those offsets to confirm the expectations. Without WARP, the test says that nothing confirms them.
  • The layer is held to the expectations at every offset, as before.
  • New cases 256x240 and 240x240 at offset 4: native stays strict on clipped tiles on every GPU.
  • Under Wine/Proton neither the hardware adapter nor WARP is compared (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.

  • Before: fails 6/6 at offset 1, 3 runs with LEONIDA_VK_VALIDATION=1 and 3 without. After: passed 6/6 in a row, with no validation messages, and a passing run prints no got ... expected lines. The one exception is the handoff case described below.
  • Model fit: in local runs with extra cases (not committed), native matches the model at every texel for offsets 1-3 and 5-7 on 256x256, 240x240, 130x129 and 129x250.
  • Negative control: a deliberately wrong model (rounding to a multiple of 2) fails.
  • Intel model: on the CPU, the tiles-to-buffer-only model breaks the expectations at 94208 of 245760 reads (offset 1) and 84480 of 222720 (offset 3), and differs from the both-directions model at 155648 reads: the counts measured on the Iris Xe. On the 7900 XT it leaves 155648 and 138240 reads unexplained, so the two models don't overlap; an upload-only model fails too. A probe that pretended an earlier case matched the Intel model made the AMD run fail on the mismatch. Confirmed on the Iris Xe by @⁠MalexAson at 83aea690a: pass, with the tiles-to-buffer-only NOTE at offsets 1 and 3 (#964).
  • Full ctest: only the 4 failures main already has on this GPU (vk_queue_query_sync, d3d12_execute_indirect_validation #504, d3d12_clear #516/#787, d3d12_pipeline_library_host).
  • Not tested by me: NVIDIA, Intel (run by @⁠MalexAson, above), other AMD drivers, Wine.

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 ctest and once in 3 single-test runs.

  • On main this 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.
  • It also fails with the unchanged test code when only that case is run, and in a native-only probe with no Vulkan layer in the process (7 of 30 under load, 0 of 15 for the same work on one queue).
  • I did not loosen it. Details are in the coordination issue as a finding.

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

  • Based on current main and merges cleanly (written on 23c459644, merges cleanly onto a28927849).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

**@⁠adrianmjim** on GitHub · 2026-11-24 15:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964) `adrianmjim:fix/texture-tiles-row-major-offset` → `main` · +245 −47 · 3 files · 4 commits · open Claimed in the coordination issue as: D3D-TILES-AMD-BYTE-OFFSET ### What and why `d3d12_texture_tiles` fails 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 five `ctest` failures #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 1` replay 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 `CopyTiles` rounded `BufferStartOffsetInBytes` down to a multiple of 4, in both directions: - Offsets 1, 2, 3, 5, 6 and 7 diverge; offsets 4 and 8 match. - Every divergent texel fits that model. That includes the reported `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: - `CopyTiles` documents no alignment for that offset. - WARP meets the test's expectations at every offset tried (1-8). - The layer meets them too. It stages unaligned offsets through transfer scratch, and the validation layer reports nothing. 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):** - At a byte-unaligned offset, the native run reads every texel and produces a NOTE (on stdout) only if **every checked read** equals one of two CPU models of `CopyTiles` from `modelled_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 is `d3d12_bundle_test`. - WARP runs at those offsets to confirm the expectations. Without WARP, the test says that nothing confirms them. - The layer is held to the expectations at every offset, as before. - New cases `256x240` and `240x240` at offset 4: native stays strict on clipped tiles on every GPU. - Under Wine/Proton neither the hardware adapter nor WARP is compared (`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`. - **Before:** fails 6/6 at offset 1, 3 runs with `LEONIDA_VK_VALIDATION=1` and 3 without. **After:** passed 6/6 in a row, with no validation messages, and a passing run prints no `got ... expected` lines. The one exception is the handoff case described below. - **Model fit:** in local runs with extra cases (not committed), native matches the model at every texel for offsets 1-3 and 5-7 on 256x256, 240x240, 130x129 and 129x250. - **Negative control:** a deliberately wrong model (rounding to a multiple of 2) fails. - **Intel model:** on the CPU, the tiles-to-buffer-only model breaks the expectations at 94208 of 245760 reads (offset 1) and 84480 of 222720 (offset 3), and differs from the both-directions model at 155648 reads: the counts measured on the Iris Xe. On the 7900 XT it leaves 155648 and 138240 reads unexplained, so the two models don't overlap; an upload-only model fails too. A probe that pretended an earlier case matched the Intel model made the AMD run fail on the mismatch. **Confirmed on the Iris Xe** by @⁠MalexAson at `83aea690a`: pass, with the tiles-to-buffer-only NOTE at offsets 1 and 3 (https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/964). - **Full `ctest`:** only the 4 failures `main` already has on this GPU (`vk_queue_query_sync`, `d3d12_execute_indirect_validation` #504, `d3d12_clear` #516/#787, `d3d12_pipeline_library_host`). - **Not tested by me:** NVIDIA, Intel (run by @⁠MalexAson, above), other AMD drivers, Wine. **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 `ctest` and once in 3 single-test runs. - On `main` this 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. - It also fails with the unchanged test code when only that case is run, and in a native-only probe with no Vulkan layer in the process (7 of 30 under load, 0 of 15 for the same work on one queue). - I did not loosen it. Details are in the coordination issue as a finding. 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 - [x] Based on current `main` and merges cleanly (written on `23c459644`, merges cleanly onto `a28927849`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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 23c45964 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 23c45964 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 <[email protected]>
- 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 <[email protected]>
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 #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.
# Conflicts:
#	runtime/test/d3d12_texture_tiles_test.cpp
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:30:45 +00:00
@ -85,0 +102,4 @@
for (UINT tile = 0; tile < tiles; ++tile) {
const UINT first_y = (tile / 2) * tile_height, first_x = (tile % 2) * tile_width;
if (first_y >= height || first_x >= width) continue; // a texture smaller than the tile grid
const UINT rows = std::min(tile_height, height - first_y), columns = std::min(tile_width, width - first_x);
Author
Owner

@⁠Copilot on GitHub · 2026-11-24 16:16 UTC · original

height - first_y and width - first_x are unsigned subtractions. If a future case uses a texture smaller than a tile (or otherwise makes first_* > *), this will underflow and produce a huge rows/columns, leading to out-of-bounds offset calculations. Make this robust by guarding if (first_y >= height || first_x >= width) continue; (or by computing remaining extents with conditional logic before subtracting).

**@⁠Copilot** on GitHub · 2026-11-24 16:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#discussion_r4683002217) `height - first_y` and `width - first_x` are unsigned subtractions. If a future case uses a texture smaller than a tile (or otherwise makes `first_* > *`), this will underflow and produce a huge `rows/columns`, leading to out-of-bounds offset calculations. Make this robust by guarding `if (first_y >= height || first_x >= width) continue;` (or by computing remaining extents with conditional logic before subtracting).
@ -114,13 +212,10 @@ bool run(ID3D12Device& device, UINT width, UINT height, UINT64 tile_copy_offset,
const D3D12_RANGE empty{0, 0};
void* mapped = nullptr;
EXPECT(SUCCEEDED(upload->Map(0, &empty, &mapped)));
Author
Owner

@⁠Copilot on GitHub · 2026-11-24 16:16 UTC · original

For the byte-unaligned cases, the advisory model assumes deterministic bytes in the upload buffer prior to tile_copy_offset (e.g., when modelling a rounded-down offset). In the real test, only the region starting at tile_copy_offset is written, leaving earlier bytes undefined (dependent on heap/page reuse). To keep the model comparison stable and avoid flakiness on systems where the upload heap isn't zero-filled, initialize the entire mapped upload range used by the test (at least [rounded_offset, tile_copy_offset), or simply the full upload allocation) to a known value before calling fill_tiles().

**@⁠Copilot** on GitHub · 2026-11-24 16:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#discussion_r4683002281) For the byte-unaligned cases, the advisory model assumes deterministic bytes in the upload buffer prior to `tile_copy_offset` (e.g., when modelling a rounded-down offset). In the real test, only the region starting at `tile_copy_offset` is written, leaving earlier bytes undefined (dependent on heap/page reuse). To keep the model comparison stable and avoid flakiness on systems where the upload heap isn't zero-filled, initialize the entire mapped upload range used by the test (at least `[rounded_offset, tile_copy_offset)`, or simply the full upload allocation) to a known value before calling `fill_tiles()`.
Author
Owner

@⁠Copilot on GitHub · 2026-11-24 16:16 UTC · original
On docs/testing.md line 668 (outdated):

@@ -665,6 +665,7 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin
 | 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 |

This row hard-codes an example NOTE mentioning only offset 1→0 (and offset 3). The test output is parameterized and can also produce NOTE lines for other byte-unaligned offsets (e.g., 5→4, 7→4) if cases expand in the future, and the prose in the same row already mentions offsets 1–8. Consider generalizing the example NOTE text to use placeholders like linear offset X rounded down to Y so the Known problems entry stays consistent with the test’s actual output format.

**@⁠Copilot** on GitHub · 2026-11-24 16:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#discussion_r4683002349) On `docs/testing.md` line 668 (outdated): ```diff @@ -665,6 +665,7 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin | 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 | ``` This row hard-codes an example NOTE mentioning only offset 1→0 (and offset 3). The test output is parameterized and can also produce NOTE lines for other byte-unaligned offsets (e.g., 5→4, 7→4) if cases expand in the future, and the prose in the same row already mentions offsets 1–8. Consider generalizing the example NOTE text to use placeholders like `linear offset X rounded down to Y` so the Known problems entry stays consistent with the test’s actual output format.
Author
Owner

@⁠Copilot on GitHub · 2026-11-24 16:16 UTC · original
On runtime/test/d3d12_texture_tiles_test.cpp line 312 (outdated):

@@ -218,37 +299,32 @@ bool run(ID3D12Device& device, UINT width, UINT height, UINT64 tile_copy_offset,
     EXPECT(WaitForSingleObject(event.handle, 15000) == WAIT_OBJECT_0);
 
     EXPECT(SUCCEEDED(readback->Map(0, nullptr, &mapped)));
-    const auto read_pixel = [mapped](UINT64 offset) {
-        std::uint32_t value = 0;
-        std::memcpy(&value, static_cast<const std::uint8_t*>(mapped) + offset, sizeof(value));
-        return value;
-    };
-    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);
-        for (UINT y = 0; y < rows; ++y) {
-            for (UINT x = 0; x < columns; ++x) {
-                const auto tiled = tile_copy_offset + tile * tile_bytes + y * row_pitch + x * sizeof(std::uint32_t);
-                EXPECT(compare_pixel(result, read_pixel(tiled), 0, "initially unbound", tile, x, y));
-                const UINT source_x = ((tile ^ 1) % 2) * tile_width;
-                // The source never wrote the texels beyond its own clipped edge.
-                if (source_x + x < width) {
-                    const auto aliased = pixel(tile ^ 1, x, y);
-                    const auto row_major = row_major_offset +
-                                           ((first_y + y) * full_width + first_x + x) * sizeof(std::uint32_t);
-                    EXPECT(compare_pixel(result, read_pixel(image_bytes + tiled), aliased, "alias", tile, x, y));
-                    EXPECT(compare_pixel(result, read_pixel(row_major), aliased, "row-major alias", tile, x, y));
-                }
-                const auto remapped = tile < 2 ? pixel(0, x, y) : 0;
-                EXPECT(compare_pixel(result, read_pixel(2 * image_bytes + tiled), remapped, "remap", tile, x, y));
-            }
+    const auto* bytes = static_cast<const std::uint8_t*>(mapped);
+    const auto judge = [&](const char* read, UINT tile, UINT x, UINT y, UINT64 offset, std::uint32_t expected) {
+        const auto actual = load(bytes, offset);
+        if (advisory) {
+            const auto modelled = load(advisory->model->data(), offset);
+            ++advisory->texels;
+            advisory->differ += actual != expected;
+            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);

The !advisory->unmodelled++ idiom is hard to read and easy to misinterpret when revisiting this code. Consider rewriting this as an explicit if (actual != modelled) { if (advisory->unmodelled == 0) ...; ++advisory->unmodelled; } so the 'first unmodelled' capture and the counter increment are unambiguous.

**@⁠Copilot** on GitHub · 2026-11-24 16:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#discussion_r4683002420) On `runtime/test/d3d12_texture_tiles_test.cpp` line 312 (outdated): ```diff @@ -218,37 +299,32 @@ bool run(ID3D12Device& device, UINT width, UINT height, UINT64 tile_copy_offset, EXPECT(WaitForSingleObject(event.handle, 15000) == WAIT_OBJECT_0); EXPECT(SUCCEEDED(readback->Map(0, nullptr, &mapped))); - const auto read_pixel = [mapped](UINT64 offset) { - std::uint32_t value = 0; - std::memcpy(&value, static_cast<const std::uint8_t*>(mapped) + offset, sizeof(value)); - return value; - }; - 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); - for (UINT y = 0; y < rows; ++y) { - for (UINT x = 0; x < columns; ++x) { - const auto tiled = tile_copy_offset + tile * tile_bytes + y * row_pitch + x * sizeof(std::uint32_t); - EXPECT(compare_pixel(result, read_pixel(tiled), 0, "initially unbound", tile, x, y)); - const UINT source_x = ((tile ^ 1) % 2) * tile_width; - // The source never wrote the texels beyond its own clipped edge. - if (source_x + x < width) { - const auto aliased = pixel(tile ^ 1, x, y); - const auto row_major = row_major_offset + - ((first_y + y) * full_width + first_x + x) * sizeof(std::uint32_t); - EXPECT(compare_pixel(result, read_pixel(image_bytes + tiled), aliased, "alias", tile, x, y)); - EXPECT(compare_pixel(result, read_pixel(row_major), aliased, "row-major alias", tile, x, y)); - } - const auto remapped = tile < 2 ? pixel(0, x, y) : 0; - EXPECT(compare_pixel(result, read_pixel(2 * image_bytes + tiled), remapped, "remap", tile, x, y)); - } + const auto* bytes = static_cast<const std::uint8_t*>(mapped); + const auto judge = [&](const char* read, UINT tile, UINT x, UINT y, UINT64 offset, std::uint32_t expected) { + const auto actual = load(bytes, offset); + if (advisory) { + const auto modelled = load(advisory->model->data(), offset); + ++advisory->texels; + advisory->differ += actual != expected; + 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); ``` The `!advisory->unmodelled++` idiom is hard to read and easy to misinterpret when revisiting this code. Consider rewriting this as an explicit `if (actual != modelled) { if (advisory->unmodelled == 0) ...; ++advisory->unmodelled; }` so the 'first unmodelled' capture and the counter increment are unambiguous.
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-24 16:16 UTC · original · reviewed

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
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

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-24 16:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#pullrequestreview-6043051528) · **reviewed** > [!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](https://gh.io/AA11tgch) for more details. <!-- ccr-overview-v2 --> ## Copilot review overview <details open> <summary><strong>4 open issues</strong></summary> - <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [`height - first_y` and `width - first_x` are unsigned subtractions. If a future case uses a texture…](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/964) · New - <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [For the byte-unaligned cases, the advisory model assumes deterministic bytes in the upload buffer…](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/964) · New - <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [This row hard-codes an example NOTE mentioning only offset 1→0 (and offset 3). The test output is…](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/964) · New - <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [The `!advisory->unmodelled++` idiom is hard to read and easy to misinterpret when revisiting this…](https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/964) · New </details> <details> <summary><strong>What changed in this PR</strong></summary> 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 | </details> <sub>Review effort: Lite</sub>
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-24 16:46 UTC · original

Addressed the four review comments in e4f040332:

  • Unsigned underflow (:102): for_each_checked now skips a tile that starts past the texture edge. No current case reaches it, but a case smaller than the tile grid can no longer underflow.
  • Bytes before the CopyTiles offset (:201): the upload buffer is now zeroed over [0, tile_copy_offset) before fill_tiles. Those bytes were already zero in practice, since it is a committed resource without D3D12_HEAP_FLAG_CREATE_NOT_ZEROED. The model reads them when it rounds the offset down, though, so it should not depend on that.
  • !advisory->unmodelled++: now an explicit if with a separate increment.
  • docs/testing.md: the NOTE is quoted with placeholders (offset X rounded down to Y).

Re-run on the RX 7900 XT (driver 32.0.32029.2010): builds without warnings, d3d12_texture_tiles passes 3/3, one of them with LEONIDA_VK_VALIDATION=1 (no validation messages). AI-assisted.

**@⁠adrianmjim** on GitHub · 2026-11-24 16:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#issuecomment-7138192912) Addressed the four review comments in `e4f040332`: - **Unsigned underflow** (`:102`): `for_each_checked` now skips a tile that starts past the texture edge. No current case reaches it, but a case smaller than the tile grid can no longer underflow. - **Bytes before the CopyTiles offset** (`:201`): the upload buffer is now zeroed over `[0, tile_copy_offset)` before `fill_tiles`. Those bytes were already zero in practice, since it is a committed resource without `D3D12_HEAP_FLAG_CREATE_NOT_ZEROED`. The model reads them when it rounds the offset down, though, so it should not depend on that. - **`!advisory->unmodelled++`**: now an explicit `if` with a separate increment. - **docs/testing.md**: the NOTE is quoted with placeholders (offset X rounded down to Y). Re-run on the RX 7900 XT (driver 32.0.32029.2010): builds without warnings, `d3d12_texture_tiles` passes 3/3, one of them with `LEONIDA_VK_VALIDATION=1` (no validation messages). AI-assisted.
Author
Owner

@⁠MalexAson on GitHub · 2026-11-24 19:24 UTC · original

Tested e4f0403323 applied on main 6293c1c4f, on Intel Iris Xe (Raptor Lake-P, 8086:a7a0), Intel 32.0.101.7092, Windows 11 24H2 (26100.6584): d3d12_texture_tiles still fails. This driver breaks the expectations too, but in a different pattern from the AMD one.

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:

Native D3D12 failed: 256 x 240, linear offset 1: 94208 of 245760 checked reads break the expectations, and 155648 differ from the rounded-down model; first: alias tile 0 at (0,0): got 0x1cc0200, expected 0xcc020000, modelled 0xcc020000

On unchanged main the same run stops at line 239 with alias tile 0 at (0,0): got 0x1cc0200, expected 0xcc020000.

What this driver does, measured with a temporary local edit of modelled_readback (not something to merge): it rounds BufferStartOffsetInBytes down to a multiple of 4 only in the tiles-to-buffer direction, and honours it in the buffer-to-tiles direction. With the model rounding only the three readback copies, every diverging read is explained, 94208 of 245760 at offset 1 and 84480 of 222720 at offset 3, and the test passes with its NOTE on both layer GPUs. Rounding only the upload direction leaves the same 155648 reads unexplained as rounding both.

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.

**@⁠MalexAson** on GitHub · 2026-11-24 19:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#issuecomment-7142048267) Tested e4f0403323 applied on `main` 6293c1c4f, on Intel Iris Xe (Raptor Lake-P, 8086:a7a0), Intel 32.0.101.7092, Windows 11 24H2 (26100.6584): `d3d12_texture_tiles` still fails. This driver breaks the expectations too, but in a different pattern from the AMD one. 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: ``` Native D3D12 failed: 256 x 240, linear offset 1: 94208 of 245760 checked reads break the expectations, and 155648 differ from the rounded-down model; first: alias tile 0 at (0,0): got 0x1cc0200, expected 0xcc020000, modelled 0xcc020000 ``` On unchanged `main` the same run stops at line 239 with `alias tile 0 at (0,0): got 0x1cc0200, expected 0xcc020000`. What this driver does, measured with a temporary local edit of `modelled_readback` (not something to merge): it rounds `BufferStartOffsetInBytes` down to a multiple of 4 only in the tiles-to-buffer direction, and honours it in the buffer-to-tiles direction. With the model rounding only the three readback copies, every diverging read is explained, 94208 of 245760 at offset 1 and 84480 of 222720 at offset 3, and the test passes with its NOTE on both layer GPUs. Rounding only the upload direction leaves the same 155648 reads unexplained as rounding both. 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.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-24 20:44 UTC · original

@⁠MalexAson thanks, that was exactly what was missing. Pushed 83aea690a: a second accepted model, rounded only in the tiles-to-buffer copies.

  • modelled_readback() now takes the upload and the readback offsets separately. A native run at a byte-unaligned offset is a NOTE when every checked read matches one of the two models: both directions (AMD) or tiles-to-buffer only (Intel). The NOTE says which one matched.
  • Every diverging case on one device has to match the same model, so a driver can't pass by matching AMD at one offset and Intel at another.
  • Anything else still fails, and the failure now 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.

Checked on the RX 7900 XT, without Intel hardware:

  • The test still passes with the both-directions NOTE, 4/4 runs (one with LEONIDA_VK_VALIDATION=1).
  • A temporary probe (not committed) compared the models on the CPU. The readback-only model breaks the expectations at 94208 of 245760 reads at offset 1 and 84480 of 222720 at offset 3. It differs from the both-directions model at 155648 reads. Those are the counts you measured.
  • On AMD the readback-only model leaves 155648 (offset 1) and 138240 (offset 3) reads unexplained, so the two models don't overlap. An upload-only model, and one rounding to a multiple of 2, fail on AMD too.
  • The docs credit the Intel pattern to your measurement in this PR.

Could you rerun d3d12_texture_tiles on the Iris Xe at 83aea690a? It should print ... rounded down to 0 only in the tiles-to-buffer copies at offsets 1 and 3.

**@⁠adrianmjim** on GitHub · 2026-11-24 20:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#issuecomment-7143988639) @⁠MalexAson thanks, that was exactly what was missing. Pushed `83aea690a`: a second accepted model, rounded only in the tiles-to-buffer copies. - `modelled_readback()` now takes the upload and the readback offsets separately. A native run at a byte-unaligned offset is a NOTE when every checked read matches one of the two models: both directions (AMD) or tiles-to-buffer only (Intel). The NOTE says which one matched. - Every diverging case on one device has to match the same model, so a driver can't pass by matching AMD at one offset and Intel at another. - Anything else still fails, and the failure now 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. Checked on the RX 7900 XT, without Intel hardware: - The test still passes with the both-directions NOTE, 4/4 runs (one with `LEONIDA_VK_VALIDATION=1`). - A temporary probe (not committed) compared the models on the CPU. The readback-only model breaks the expectations at 94208 of 245760 reads at offset 1 and 84480 of 222720 at offset 3. It differs from the both-directions model at 155648 reads. Those are the counts you measured. - On AMD the readback-only model leaves 155648 (offset 1) and 138240 (offset 3) reads unexplained, so the two models don't overlap. An upload-only model, and one rounding to a multiple of 2, fail on AMD too. - The docs credit the Intel pattern to your measurement in this PR. Could you rerun `d3d12_texture_tiles` on the Iris Xe at `83aea690a`? It should print `... rounded down to 0 only in the tiles-to-buffer copies` at offsets 1 and 3.
Author
Owner

@⁠MalexAson on GitHub · 2026-11-24 20:57 UTC · original

Tested 83aea690a applied on main 6293c1c4f, on Intel Iris Xe (Raptor Lake-P, 8086:a7a0), Intel 32.0.101.7092, Windows 11 24H2 (26100.6584): pass, with the NOTE you predicted at both offsets.

Vulkan replay: 256 x 240, linear offset 1, initially unbound, aliased, row-major, gated remap
NOTE: native D3D12 broke the expectations at 94208 of 245760 checked reads, every read as CopyTiles would with linear offset 1 rounded down to 0 only in the tiles-to-buffer copies (docs/testing.md, Known problems); not a failure
WARP meets the expectations at linear offset 1 (245760 pixels)
Vulkan replay: 240 x 240, linear offset 3, initially unbound, aliased, row-major, gated remap
NOTE: native D3D12 broke the expectations at 84480 of 222720 checked reads, every read as CopyTiles would with linear offset 3 rounded down to 0 only in the tiles-to-buffer copies (docs/testing.md, Known problems); not a failure
WARP meets the expectations at linear offset 3 (222720 pixels)
  • The three offset-4 cases match natively (262144, 245760 and 222720 pixels), and the layer passes every case.
  • ctest -R "^d3d12_texture_tiles$": 3 of 3 runs pass with the layer on the Iris Xe, and 3 of 3 with the layer on the RTX 4060 Laptop GPU (NVIDIA 621.40; it was 616.92 for my first report). The native device is the Iris Xe in both. With the layer on the RTX 4060 the COPY-to-DIRECT case runs as well and matches natively (262144 pixels).
  • No warnings from the test's translation unit, MSVC 19.50 + Ninja, RelWithDebInfo.

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.

**@⁠MalexAson** on GitHub · 2026-11-24 20:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#issuecomment-7144284362) Tested 83aea690a applied on `main` 6293c1c4f, on Intel Iris Xe (Raptor Lake-P, 8086:a7a0), Intel 32.0.101.7092, Windows 11 24H2 (26100.6584): pass, with the NOTE you predicted at both offsets. ``` Vulkan replay: 256 x 240, linear offset 1, initially unbound, aliased, row-major, gated remap NOTE: native D3D12 broke the expectations at 94208 of 245760 checked reads, every read as CopyTiles would with linear offset 1 rounded down to 0 only in the tiles-to-buffer copies (docs/testing.md, Known problems); not a failure WARP meets the expectations at linear offset 1 (245760 pixels) Vulkan replay: 240 x 240, linear offset 3, initially unbound, aliased, row-major, gated remap NOTE: native D3D12 broke the expectations at 84480 of 222720 checked reads, every read as CopyTiles would with linear offset 3 rounded down to 0 only in the tiles-to-buffer copies (docs/testing.md, Known problems); not a failure WARP meets the expectations at linear offset 3 (222720 pixels) ``` - The three offset-4 cases match natively (262144, 245760 and 222720 pixels), and the layer passes every case. - `ctest -R "^d3d12_texture_tiles$"`: 3 of 3 runs pass with the layer on the Iris Xe, and 3 of 3 with the layer on the RTX 4060 Laptop GPU (NVIDIA 621.40; it was 616.92 for my first report). The native device is the Iris Xe in both. With the layer on the RTX 4060 the COPY-to-DIRECT case runs as well and matches natively (262144 pixels). - No warnings from the test's translation unit, MSVC 19.50 + Ninja, RelWithDebInfo. 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.
Author
Owner

@⁠efeekrb on GitHub · 2026-11-25 16:35 UTC · original

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. main at 24a29f8, RelWithDebInfo, LEONIDA_VK_DEVICE=4060. This PR's diff applied cleanly, and only d3d12_texture_tiles_test was rebuilt.

  • main: d3d12_texture_tiles fails 3 of 3 reruns, in the 256 x 240, linear offset 1 case: alias tile 0 at (0,0): got 0x1cc0200, expected 0xcc020000.
  • With this PR: passes 3 of 3. The offset-4 cases match on all 262,144, 245,760 and 222,720 pixels. At offset 1 and offset 3 the test prints the NOTE, with the Intel pattern the description measured: native D3D12 breaks the expectations at 94,208 of 245,760 reads (offset 1) and 84,480 of 222,720 (offset 3), every read as CopyTiles would with the offset rounded down to 0 only in the tiles-to-buffer copies, and WARP meets the expectations at both.

So the Iris Xe pattern also holds on an Intel UHD Graphics. A side note: the test picks its native adapter itself and ignores LEONIDA_HOST_ADAPTER (finding: #1608), so on a two-GPU PC the native side is the iGPU even when the layer runs on the NVIDIA GPU. No game files; counts and pass/fail lines only. AI-assisted (Claude Code).

**@⁠efeekrb** on GitHub · 2026-11-25 16:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/964#issuecomment-7168215483) 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. `main` at `24a29f8`, RelWithDebInfo, `LEONIDA_VK_DEVICE=4060`. This PR's diff applied cleanly, and only `d3d12_texture_tiles_test` was rebuilt. - `main`: `d3d12_texture_tiles` fails 3 of 3 reruns, in the 256 x 240, linear offset 1 case: `alias tile 0 at (0,0): got 0x1cc0200, expected 0xcc020000`. - With this PR: passes 3 of 3. The offset-4 cases match on all 262,144, 245,760 and 222,720 pixels. At offset 1 and offset 3 the test prints the NOTE, with the Intel pattern the description measured: native D3D12 breaks the expectations at 94,208 of 245,760 reads (offset 1) and 84,480 of 222,720 (offset 3), every read as `CopyTiles` would with the offset rounded down to 0 only in the tiles-to-buffer copies, and WARP meets the expectations at both. So the Iris Xe pattern also holds on an Intel UHD Graphics. A side note: the test picks its native adapter itself and ignores `LEONIDA_HOST_ADAPTER` (finding: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608), so on a two-GPU PC the native side is the iGPU even when the layer runs on the NVIDIA GPU. No game files; counts and pass/fail lines only. AI-assisted (Claude Code).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/964/head:github-bot/gh-964'
git switch 'github-bot/gh-964'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-964'
git switch 'github-bot/gh-964'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-964'
git switch 'github-bot/gh-964'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-964'
git switch 'main'
git merge --squash 'github-bot/gh-964'
git switch 'main'
git merge --ff-only 'github-bot/gh-964'
git switch 'main'
git merge 'github-bot/gh-964'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.