Skip to content

gpu: isolate watch test resets from TLAS result reuse - #78

Merged
simnJS merged 1 commit into
MiamiGame:mainfrom
AliceWood:gpu/isolate-tlas-reuse-test
Nov 25, 2026
Merged

simnJS merged 1 commit into
MiamiGame:mainfrom
AliceWood:gpu/isolate-tlas-reuse-test

Conversation

@AliceWood

Copy link
Copy Markdown
Contributor

What and why

The watch tests clear their guards before each run. Their setup used the runtime's full-address-space remap notification, which also evicted spare ray-tracing buffers from other tests. Reset the guards and the shared page-read cache directly. Actual title remaps still notify all three subsystems in their original order.

The TLAS rebuild test now runs the watch setup after the first buffer becomes available for reuse. It checks that the same two buffers alternate across four rebuilds and that the final ray hits. Weak references identify the allocations without keeping them busy. A replacement allocation can have the same GPU address. This removes the five-attempt loop and its process-wide log of released ranges.

Fixes the TLAS reuse case reported in #54. The issue tracks other tests as well.

Depends on: none

Area

xtp-gpu watch setup and ray-tracing tests.

Tests

  • cargo xtask pr-check passes on my machine
  • Changed behaviour has tests using synthetic inputs.
  • Ran on a title: no.

Compared upstream 458cd45 and head 765e1e5 on Windows 10 build 19045.3693, RTX 4080, driver 32.0.16.1742.

  • Strict hardware diagnostics, rt::tests::rt_tlas_rebuilds_reuse_a_result_nothing_holds: the original test passed alone. With the new test and the original watch setup, the forced interleaving failed the allocation-identity assertion. The identical test passed with the fix, including the ray hit.

  • Ran the TLAS test together with watch::tests:: at eight test threads, 16 times per revision. All 16 batches passed on each revision (27 tests per batch, 5 ignored). Upstream had its retry loop. The PR has none.

  • Ran the rt, watch, shadow and texture unit tests together with XTP_TEST_ADAPTER=hardware, XTP_REQUIRE_GPU=1, diagnostics and eight test threads. Both revisions had 113 passes, 9 ignored, and the same two failures creating a root signature (E_INVALIDARG): rt_missing_tlas_writes_every_ray_as_a_miss and rt_spliced_trace_binds_t240_as_a_root_srv_with_bounded_root_srvs.

  • On WARP, all 26 enabled watch tests passed. The installed WARP driver reported no DXR when the TLAS test required a GPU.

  • cargo xtask pr-check --base origin/main on hardware passed formatting, both Clippy configurations, policy and commit conventions. Workspace testing stopped at precook_fills_the_cache_once_for_every_build_of_the_translator and precook_keeps_pipelines_across_translation_keys. The same two tests failed on unmodified upstream. Both runs reported that compute pipelines require shader model 6.6 and the local runtime exposes 6.5. An initial run in a restricted Windows session stopped earlier at the precook process-lock test on both revisions. That test passed in the normal Windows session.

  • A supplementary pr-check with XTP_TEST_ADAPTER=none reached the GPU unit suite. Its only failure, resource::tests::host_descriptions_are_ones_warp_creates, creates a WARP device directly. The same test failed on upstream with the same resource description and HRESULT.

Provenance

  • Written for XTP using existing XTP source and tests.
  • Some of it comes from elsewhere.

AI assistance: Codex wrote the patch and ran the checks on the contributor's machine. It read the issue discussion, the contribution guide, and the XTP watch, shadow, resource and ray-tracing code directly. The earlier WARP frequency was reported by another contributor. The before/after runs above are local measurements.

Checklist

  • The diff contains only XTP code and test changes and follows the asset policy.
  • No code copied from xcl or AnyPS5.
  • Submitted under GPL-3.0-or-later.
  • The title and commit use the repository convention. The diff is under 400 lines.
  • Updated the affected test documentation.

@github-actions github-actions Bot added area/gpu touches crates/xtp-gpu size/M 100 to 399 changed lines labels Nov 25, 2026

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this looks right. Extracting forget_guards keeps the order of title_memory_remapped unchanged. serial() now resets only the guards and the page-read cache. Weak::ptr_eq is a sound identity check, since spare reuse counts only strong references. The forced reset reproduces the interleaving every time.

Nit, non-blocking: a doc comment on forget_guards would help. We'll merge once test and gpu-debug-layer are green.

@AliceWood
AliceWood marked this pull request as ready for review November 25, 2026 18:09

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All checks are green. Approving, thanks.

@simnJS
simnJS merged commit a0a2abf into MiamiGame:main Nov 25, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/gpu touches crates/xtp-gpu size/M 100 to 399 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants