Skip to content

Cover PSO-only RT surface: recursion, RAY_FLAG_SKIP_CLOSEST_HIT_SHADER, callables - #1279

Open
MarijnS95 wants to merge 1 commit into
llvm:mainfrom
Traverse-Research:rt-pso-tests-pso-only
Open

MarijnS95 wants to merge 1 commit into
llvm:mainfrom
Traverse-Research:rt-pso-tests-pso-only

Conversation

@MarijnS95

@MarijnS95 MarijnS95 commented Jun 3, 2026 •

Copy link
Copy Markdown
Collaborator

Three tests stacked on #1275 covering features that inline RT (RayQuery in compute) physically can't express — they're only reachable through a DispatchRays-driven RT pipeline.

  • trace-ray-recursion.test — closest-hit fires a secondary TraceRay from an above-the-triangle origin. First-level CH sees payload=0 → bumps to 0x1 → calls TraceRay. Second-level CH sees payload!=0 → writes 0x10. Unwinds: first-level OR's in 0x100. Final payload 0x110 (272 decimal). RayTracingPipelineConfig.MaxTraceRecursionDepth: 2 so both TraceRay calls are within budget.

  • ray-flag-skip-closest-hit.test — two lanes fire identical rays at the same triangle. Lane 0 uses RAY_FLAG_NONE so CH runs and writes 0xBEEF. Lane 1 uses RAY_FLAG_SKIP_CLOSEST_HIT_SHADER (PSO-only — inline RT has no equivalent) so CH is skipped and payload keeps its initial 0xAAAA. Output [0xBEEF, 0xAAAA].

  • callable-shader.test — two callable shaders writing distinct sentinels (0xAAAA / 0xBBBB). Each lane calls CallShader(Idx, ...) so the SBT callable region's per-record routing is exercised independently of the hit-group / miss routing already covered in Cover DispatchRays index/dimensions + SBT miss/hit-group routing #1277. Callable shaders themselves don't exist in inline RT.

    Only # XFAIL: Clang — the clang HLSL path doesn't implement the RT pipeline yet ([EPIC]: Bring-up and test coverage for PSO-based raytracing #1268). On Vulkan the current DXC -spirv output is valid: each callable's IncomingCallableDataKHR is listed only in its own entry point's interface and spirv-val is clean, so the module loads and the test passes (confirmed by an XPASS on the windows-intel VK CI runner). An earlier DXC over-listed those interface variables in every callable entry point, which has since been fixed upstream — so no Vulkan XFAIL or spirv-opt cleanup is needed anymore.

All three pass on Metal once the Metal bring-up (#1281) sets setMaxCallStackDepth(MaxTraceRecursionDepth) so nested TraceRay actually unwinds; with the default of 1 the second TraceRay was silently dropped and the recursion test produced 0x1 instead of 0x110. With #1281 rebased underneath, Metal is dropped from the XFAIL list on all three tests.

Test plan

Local on an NVIDIA RTX 3060:

  • Linux Vulkan (native offloader)
  • Linux D3D12 (Wine + vkd3d-proton + cross-compiled offloader.exe)
  • Windows Vulkan (native offloader.exe)
  • Windows D3D12 (native offloader.exe)

CI (RT-capable runners):

  • windows-nvidia D3D12 (RaytracingTier 1.2)
  • windows-intel VK (VK_KHR_ray_tracing_pipeline) — all three RT tests pass; callable previously surfaced as an XPASS against the stale Vulkan XFAIL that this revision removes
  • macOS Metal (supportsRaytracing)

@MarijnS95
MarijnS95 force-pushed the rt-pso-tests-pso-only branch from 3241fb5 to a59e78f Compare July 1, 2026 10:04
@MarijnS95
MarijnS95 force-pushed the rt-pso-tests-pso-only branch from a59e78f to 7b8162f Compare July 16, 2026 20:24
@MarijnS95
MarijnS95 force-pushed the rt-pso-tests-pso-only branch 3 times, most recently from b5dc558 to 58f370e Compare July 28, 2026 09:02
@MarijnS95
MarijnS95 force-pushed the rt-pso-tests-pso-only branch from 58f370e to fde1857 Compare August 3, 2026 12:46
Three tests stacked on llvm#1275 covering features that inline RT (RayQuery
in compute) physically can't express — they're only reachable through
a DispatchRays-driven RT pipeline.

  - `trace-ray-recursion.test` — closest-hit fires a secondary TraceRay
    from an above-the-triangle origin. First-level CH sees payload=0 →
    bumps to 0x1 → calls TraceRay. Second-level CH sees payload!=0 →
    writes 0x10. Unwinds: first-level OR's in 0x100. Final payload
    0x110 (272 decimal). `RayTracingPipelineConfig.MaxTraceRecursion-
    Depth: 2` so both TraceRay calls are within budget.
  - `ray-flag-skip-closest-hit.test` — two lanes fire identical rays at
    the same triangle. Lane 0 uses RAY_FLAG_NONE so CH runs and writes
    0xBEEF. Lane 1 uses RAY_FLAG_SKIP_CLOSEST_HIT_SHADER (PSO-only —
    inline RT has no equivalent) so CH is skipped and payload keeps its
    initial 0xAAAA. Output [0xBEEF, 0xAAAA].
  - `callable-shader.test` — two callable shaders writing distinct
    sentinels (0xAAAA / 0xBBBB). Each lane calls `CallShader(Idx, ...)`
    so the SBT callable region's per-record routing is exercised
    independently of the hit-group / miss routing already covered in
    llvm#1277. Callable shaders themselves don't exist in inline RT.

    Only `# XFAIL: Clang` — the clang HLSL path doesn't implement the RT
    pipeline yet (llvm#1268). On Vulkan the current DXC `-spirv` output is
    valid: each callable's IncomingCallableDataKHR is listed only in its
    own entry point's interface and `spirv-val` is clean, so the module
    loads and the test passes (confirmed XPASS on the Intel Vulkan CI
    runner). An earlier DXC over-listed those interface variables in
    every callable entry point — that's since been fixed upstream, so no
    Vulkan XFAIL or `spirv-opt` cleanup is needed anymore.

All three pass on Metal once the bring-up PR ahead of this commit sets
the raygen pipeline's `setMaxCallStackDepth(MaxTraceRecursionDepth)` so
nested TraceRay actually unwinds (with the default of 1, the second
TraceRay was silently dropped and the recursion test produced 0x1
instead of 0x110).

Locally verified on the user's Linux box:
  - Vulkan via the native offloader: recursion + skip-CH PASS. Callable
    passes on Vulkan too — current DXC emits valid SPIR-V (confirmed via
    XPASS on the Intel Vulkan CI runner).
  - D3D12 via Wine + vkd3d-proton + cross-compiled offloader.exe: all
    three PASS.
And on macOS 15 / metal-irconverter 3.1.1 via the native offloader:
  - All three PASS (recursion + skip-CH + callable).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MarijnS95
MarijnS95 force-pushed the rt-pso-tests-pso-only branch from fde1857 to c44296a Compare August 3, 2026 14:24
@MarijnS95

MarijnS95 commented Aug 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

Only lavapipe fails specifically on all RT tests and existing InlineRT tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants