Skip to content

d3d12_pipeline_library_host_test: handle host trailing padding in serialized empty libraries on AMD - #6088

Open
liamhob wants to merge 1 commit into
ItsNotRexed:mainfrom
liamhob:fix/pipeline-library-host-amd-padding
Open

liamhob wants to merge 1 commit into
ItsNotRexed:mainfrom
liamhob:fix/pipeline-library-host-amd-padding

Conversation

@liamhob

@liamhob liamhob commented Nov 23, 2026

Copy link
Copy Markdown

What and why

On \main\ (\561b65a8), \d3d12_pipeline_library_host_test\ fails on hosts with AMD native D3D12 (measured on AMD Radeon RX 9070 XT, driver 26.10.1):

\
pipeline library create: its own blob, last byte flipped: ours 0x80070057 host 0x0 MISMATCH
pipeline library create: its own blob, last byte flipped (output): ours 0x2 host 0x1 MISMATCH
\\

  • When \create: its own blob, last byte flipped\ runs, the test flips \ lipped.back() ^= 0xFF\ on the device's own serialized empty library blob (\c.own).
  • On the layer, \c.own\ is 16 bytes (\sizeof(Header)), so flipping byte 15 corrupts \Header::reserved, which is rejected with \E_INVALIDARG\ (0x80070057).
  • On host D3D12, \c.own\ is device-specific: 900 bytes on NVIDIA (with checksum/trailer at the end, so flipping byte 899 is rejected as \E_INVALIDARG), and 872 bytes on AMD. On AMD, the internal header and tables do not occupy the entire 872 bytes, leaving trailing padding. AMD's driver does not validate the unused trailing padding bytes of an empty library, so it returns \S_OK\ (0x0) and sets *ppPipelineLibrary.

The test already treats device-specific formats as non-comparable ([own format]). This change checks whether the host accepted flipping the last byte in its own serialized format (\ heirs == S_OK\ and output non-null); when it does, it reports this host format difference and skips failing on it. On NVIDIA (where the host rejects it with \E_INVALIDARG), the step continues to compare identically.

Verification

  • Tested on Windows 11, MSVC 19.44, Vulkan SDK 1.4.363.0, AMD Radeon RX 9070 XT (AMD driver 26.10.1).
  • \d3d12_pipeline_library_host_test.exe: exits 0 (\72 steps compared with the host (22 more not compared), 0 mismatches).
  • \git diff --check: clean.
  • \python scripts/check_no_game_data.py: clean.
  • No game files used. AI-assisted.

@milas6669

Copy link
Copy Markdown

Comparison with #5873 (coordinator asked, 13:08). I merged both onto main 561b65a8 (git merge, no textual conflict) and built d3d12_pipeline_library_host_test on Windows 11 with an RTX 3070 (621.24). All four builds (main, #6088, #5873, both) exit 0.

They do not conflict as text, but they relax the same step. #6088 matches create: its own blob, last byte flipped by prefix, so it also covers a step #5873 has renamed to ... [own format]. #5873 marks that step [own format], which own_format already treats as not compared. So after both merge, #6088's host_tolerates_trailing_padding can never change the outcome for that step, and its comment (about trailing padding of empty libraries) no longer describes anything that runs. The whole AMD difference both PRs describe is a host that accepts a flipped last byte (S_OK / output 1).

One difference worth deciding: on NVIDIA the host rejects the flipped byte, and this run shows ours 0x80070057 host 0x80070057 on main and with #6088 (compared). With #5873 the same line ends (each device's own format; not compared), so the NVIDIA host/layer agreement is no longer checked. #6088 keeps that comparison and relaxes it only where the host accepts the blob. I couldn't run AMD, so the AMD side rests on the reports on the two PRs. No failure from either PR or from both together.

@mrp1no

mrp1no commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@liamhob @KoertLichtendonk, comparing this with #5873 as asked. Both PRs handle the same step, create: its own blob, last byte flipped, and its (output) record. They don't conflict as text, but whichever lands second has nothing left to fix.

  • d3d12_pipeline_library_host_test: an own blob with its last byte changed is own format (AMD accepts it) #5873 (D3D-600, opened 12:24): the step is [own format] on every host, so it is recorded and never compared. Run on two AMD hosts (Radeon 610M by @Etr0p, RX 9060 XT by @emirduran707), on an Intel host and on four NVIDIA hosts.
  • This PR (D3D-619): the step is skipped only when the host accepts the flipped blob, so NVIDIA and Intel hosts, which refuse it, keep comparing it. That rule is narrower and keeps more coverage. The 872-byte AMD blob with unvalidated trailing padding, against NVIDIA's 900 bytes with a trailer, is also a better explanation than mine.

I'm fine either way. If the maintainer prefers this narrower rule, I'll close #5873. Otherwise #5873 can stay as it is, and this PR's padding explanation would be worth keeping in the docs line.

AI-assisted (Claude Code).

@jdPhobos

Copy link
Copy Markdown

Tested 6e919ec on AMD Radeon RX 7800 XT (RDNA 3, gfx1101, subgroup 32..64), AMD proprietary driver 26.11.2, Vulkan 1.4.359 (Vulkan SDK 1.4.363.1), Windows 11 x64, MSVC RelWithDebInfo (VS 2026): pass (reproduced RED on origin/main 561b65a8 and verified GREEN on 6e919ec with and without Vulkan validation; first RDNA 3 confirmation alongside the author's RDNA 4 RX 9070 XT run).

  • Baseline origin/main (561b65a8) — RED (d3d12_pipeline_library_host):
    • Host empty library size: 0x368 (872 bytes) vs layer 0x10 (16 bytes).
    • Reproduced the exact 2 mismatches (74 steps compared with the host (20 more not compared), 2 mismatches):
      • pipeline library create: its own blob, last byte flipped: ours 0x80070057 host 0x0 MISMATCH
      • pipeline library create: its own blob, last byte flipped (output): ours 0x2 host 0x1 MISMATCH
  • PR #6088 (6e919ec) — GREEN:
    • ctest -C RelWithDebInfo -R "^d3d12_pipeline_library_host$": Passed (5.56 s)
    • With LEONIDA_VK_VALIDATION=1 (VK_LAYER_KHRONOS_validation active): Passed (5.55 s, 0 validation errors)
  • git diff --check: clean.

Synthetic CTest target only; no game files.

@FIocker

FIocker commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Independent Windows 11 / RTX 5080 (621.01) compatibility check of 6e919ec3. The base and PR both reported 74 comparisons, 20 excluded and zero mismatches. A separate System32 D3D12 probe resolved the default adapter by LUID to the RTX 5080. It serialized an 896-byte empty pipeline library, reopened the original with S_OK and a non-null output, then rejected the same blob with its last byte flipped (E_INVALIDARG, null output). This confirms the NVIDIA case remains covered by comparison on this machine. Synthetic inputs only. AI-assisted.

@Bhrema

Bhrema commented Nov 23, 2026

Copy link
Copy Markdown

Tested 6e919ec359 on AMD Radeon RX 6750 XT, driver 32.0.21045.16010, Windows 11 25H2 (10.0.26200), VS 2022/18 Community, Vulkan SDK 1.4.363.1: pass.

Built with scripts\build_runtime.ps1 (RelWithDebInfo, VULKAN_SDK set). Ran runtime\build\d3d12_pipeline_library_host_test.exe.

device: AMD Radeon RX 6750 XT
subgroup sizes: 32..64 (default 64)
pipeline library create: its own blob, last byte flipped: ours 0x80070057 host 0x0 (host permits flipped trailing padding in its own format; not compared)
pipeline library create: its own blob, last byte flipped (output): ours 0x2 host 0x1 (host permits flipped trailing padding in its own format; not compared)
pipeline library: 72 steps compared with the host (22 more not compared), 0 mismatches
d3d12_pipeline_library_host_test: OK

Exit code 0. The AMD host-padding rows are classified as not compared, matching the PR. AI-assisted.

@memorypressure

Copy link
Copy Markdown

Static review (Windows-host C++ test, not runnable on this CPU-only Linux verifier): the added skip is fail-safe — it fires only when the host accepted the flipped trailing byte, so a host that rejects is still compared and can still fail, and it is scoped to the one "last byte flipped" case by name prefix (line 108). The docs hunk matches the AMD 872-byte empty library and passes the table-ids and repeated-lines guards, and the merge is clean against the post-round-44 docs. One consequence worth confirming you intended: if both sides accept the flipped blob, that case is now skipped rather than compared. Flag: the branch reports no CI checks. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only review).

@itsonlysimbo

Copy link
Copy Markdown
Contributor

Tested 6e919ec3 on RTX 4070, NVIDIA 621.14, Windows 11 (10.0.26300), MSVC 19.44, Ninja, RelWithDebInfo, Vulkan SDK 1.4.363: no regression.

AI-assisted (Claude Code).

@larpinguser larpinguser left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary: runtime/test/d3d12_pipeline_library_host_test.cpp detects the "own blob, last byte flipped" steps and skips comparison when the host accepts its 872-byte AMD library's trailing padding (S_OK or output count 1), while still comparing NVIDIA's rejected case. docs/d3d12_vulkan.md records the 900/872-byte host sizes and this format difference.

Why merge: Removes a false mismatch on AMD hosts while preserving the parity check everywhere the host rejects the corrupt byte.

Verdict: Approve

@larpinguser

Copy link
Copy Markdown

Summary: runtime/test/d3d12_pipeline_library_host_test.cpp detects the "own blob, last byte flipped" steps and skips comparison when the host accepts its 872-byte AMD library's trailing padding (S_OK or output count 1), while still comparing NVIDIA's rejected case. docs/d3d12_vulkan.md records the 900/872-byte host sizes and this format difference.

Why merge: Removes a false mismatch on AMD hosts while preserving the parity check everywhere the host rejects the corrupt byte.

Verdict: Approve

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.

9 participants