Skip to content

d3d12 tests: skip PSO tests on devices below the 144-byte push-constant contract - #1449

Open
whoalin1 wants to merge 2 commits into
ProjectLeonida:mainfrom
whoalin1:pc-tail-skip-guards
Open

whoalin1 wants to merge 2 commits into
ProjectLeonida:mainfrom
whoalin1:pc-tail-skip-guards

Conversation

@whoalin1

@whoalin1 whoalin1 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue: #14 (comment)
Related: #1419 applies the same guard to #1341's new d3d12_skip_compute_test (Depends on: #1341).

What

On GPUs whose maxPushConstantsSize is under the 144 bytes every translated shader's push-constant block needs (the Vulkan minimum is 128; AMD Radeon iGPUs report 128), the D3D12 layer refuses every pipeline with E_NOTIMPL (PipelineState::push_constants_fit; the uniform-buffer tail is not built yet). Every test that creates a PSO therefore failed on such devices — 24 ctest entries on our AMD iGPU.

LEONIDA_PC_TAIL_UBO=1 does not help these tests: it only changes how test/shaders/build.py translates the .asm fixtures, while the layer still declares the whole 144-byte VkPushConstantRange.

  • vktest::Device now records the chosen device's maxPushConstantsSize and offers below_shader_push_constant_contract() — the vk-side twin of rt::d3d12::device_push_constants_need_fallback (same <144 condition, usable before the D3D12 device exists, which the helper-structured tests need).
  • One guard line after initialize() in the 22 test sources behind the 24 failing entries (all already had SKIP_RETURN_CODE 77 in CMake — no CMake change).
  • Tests that intentionally exercise the refusal (d3d12_vulkan_device_test) and tests already guarded are untouched.

Tested

Known tradeoff (reviewer-noted): d3d12_typeless_families/d3d12_depth_resolve skip their clears-only paths too on low-limit devices; d3d12_first_light (package-gated) and d3d12_state_sweep (silent zero-comparison pass) have the same latent gap — follow-ups noted on the coordination issue.

AI-assisted (Devin).

Consolidated follow-up

This branch now also includes the two remaining push-constant-contract skips formerly opened as #1467: d3d12_first_light_test and d3d12_state_sweep_test now exit 77 before building PSOs on devices below the 144-byte contract, rather than failing or silently comparing nothing. The consolidation is cherry-pick e8f09538f; no additional code was written.

@PierreEbele

Copy link
Copy Markdown
Contributor

Reviewed 90abd34: this box (arm64 Linux, no GPU, no C++/Vulkan toolchain) cannot run or compile
the d3d12 suite, so verification was static: the <144 skip twins push_constants_fit
(sizeof(ShaderUserData)=144), all 22 guards follow initialize(), and all 24 ctest entries map
SKIP_RETURN_CODE 77. Unverified suggestion: state_sweep and first_light (env set) also build
through the shim with no such skip — a below-contract Windows GPU would still fail them; a
follow-up if such machines are in scope.

AI-assisted review.

Recommendation: Merge

…nt contract

On GPUs whose maxPushConstantsSize is under the 144 bytes every translated
shader's push-constant block needs (the Vulkan minimum is 128; the AMD iGPU
reports 128), the D3D12 layer refuses every pipeline with E_NOTIMPL
(PipelineState::push_constants_fit; the uniform-buffer tail of ProjectLeonida#224 is not
built), so every test that creates a PSO fails there. LEONIDA_PC_TAIL_UBO=1
does not help: it only changes how test/shaders/build.py translates the
shader fixtures, while the layer still declares the whole 144-byte range.

vktest::Device now records the chosen device's maxPushConstantsSize and
offers below_shader_push_constant_contract(), the vk-side twin of
rt::d3d12::device_push_constants_need_fallback (same <144 condition, usable
before the D3D12 device exists). The 22 test sources behind the failing
ctest entries call it after initialize() and return 77. Every one of those
entries already mapped 77 to SKIP through SKIP_RETURN_CODE except
xbox_native_base_draw, xbox_derived_mask_zero and xbox_derived_mask_restore
(entries of d3d12_translated_draw_test added to main later), which gain the
same mapping here.

Verified on the AMD iGPU (radeon, maxPushConstantsSize 128): the entries of
the 22 sources now skip; the rest of the d3d12 set is unchanged. On the
RTX 4070 SUPER all of them still pass.

AI-assisted.

Co-Authored-By: Devin <noreply@cognition.ai>
Co-Authored-By: SWE-2.1 Max <noreply@google.com>
@whoalin1
whoalin1 force-pushed the pc-tail-skip-guards branch from 33973fb to 428522e Compare November 25, 2026 19:06
@whoalin1

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (73cc1a2ba) and pushed as 428522e85.

Verification on this machine:

  • Full rebuild after rebase: BUILD_RC=0.
  • NVIDIA RTX 4070 (Vulkan validation enabled): all 53 guarded entries passed, including the three xbox_native_base_draw / xbox_derived_mask_zero / xbox_derived_mask_restore entries.
  • AMD RDNA2 iGPU with LEONIDA_PC_TAIL_UBO=1: 52/53 guarded entries now skip honestly through return code 77; the only pass is d3d12_bundle_indirect_warp, which exits through the WARP path before the device-initialize guard. In particular, the three xbox entries that previously printed SKIP but were counted as failures now report ***Skipped because the regenerated CTest metadata maps them correctly.

The state-sweep / first-light coverage PierreEbele mentioned is already split into #1467 (honest-pushconst-skips), so this PR remains scoped to the existing PSO tests.

AI-assisted verification with Devin.

@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 26, 2026
…ract

d3d12_first_light_test builds translated PSOs that need 144 push-constant
bytes; on a device with a smaller limit (e.g. a 128-byte iGPU) PSO creation
would fail. d3d12_state_sweep_test was worse: every case's PSO fails the same
way, each counts as a per-case skip, and the test could return success having
compared nothing.

Both now check rt::d3d12::device_push_constants_need_fallback right after the
layer device exists and return 77, matching d3d12_pipeline_library_test,
d3d12_msaa_draw_test and d3d12_fspx_compute_test.

Co-Authored-By: Devin <noreply@cognition.ai>
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.

2 participants