Repository navigation
feat(kyty): answer guest BVH walks over several TLASes from the host query - #366
Merged
Merged
Conversation
Raghav314
temporarily deployed
to
repository-maintenance
November 27, 2026 13:59 — with
GitHub Actions
Inactive
Raghav314
force-pushed
the
feat/kyty-rt-multi-tlas-walks
branch
from
November 27, 2026 14:18
148e9d3 to
b90571f
Compare
Raghav314
temporarily deployed
to
repository-maintenance
November 27, 2026 14:18 — with
GitHub Actions
Inactive
…query A compute shader can walk more than one top-level tree: its walk loops read their TLAS header from different user-data slots. The host query bound only the primary TLAS, so a lane starting in another tree never matched it, and its box intersections returned no children. Those rays missed although the site counted as served. The source analysis now records which TLAS headers each walk loop starts from. A walk that starts only from other trees binds them as extra sources and marks its intersections BvhIntersectOracleMulti. A walk that also starts from the primary tree keeps the single-tree query, and one the new path refuses falls back to the previous source matching. A tree another walk already bound is reused when its root matches and its record layout differs at most in the mask fields, the rule the primary tree already used (now CompatibleRecordLayouts). A walk that still ends up on the primary tree although it starts from another tree is logged. Only shaders with a marked intersection change. They load each extra source's context once at entry, and each lane picks its tree when its walk starts by matching its start node, then resumes and reads instance slots from that tree. Every other shader emits the same SPIR-V as before. The world-ray match also accepts a walk that uses a negated ray component.
Raghav314
force-pushed
the
feat/kyty-rt-multi-tlas-walks
branch
from
November 27, 2026 14:44
b90571f to
884f24c
Compare
Raghav314
temporarily deployed
to
repository-maintenance
November 27, 2026 14:44 — with
GitHub Actions
Inactive
12 tasks done
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Guest BVH walks over more than one top-level tree (TLAS) now get host ray-query answers for every tree, not only the first.
DeriveOracleWalksnow reports which TLAS headers each walk loop starts from. InTraceNativeTraversals:MaxRayQuerySources) and marks its intersectionsBvhIntersectOracleMulti;CompatibleRecordLayouts);Tested
Arch Linux (CachyOS kernel 7.3.6), NVIDIA GeForce RTX 4090, driver 620.73.04.
Offline survey of the title's pipeline cache (68 compute programs,
--subgroup 32 --oracle 33), compared with the base:757dand47b9also walk several trees; their 12 and 3 empty sites now get answers.Unchanged programs emit identical SPIR-V: every program was compiled with the base and with this PR, and the SPIR-V compared byte for byte (97 variants covering all 68 programs; the other 27 rows stop before SPIR-V on both sides). Only the 18 programs this PR targets differ: the 14 multi-tree programs (12 already served plus
757dand47b9) and 4 single-tree programs that ran empty. So no other shader's cost changes.Validation layer:
agc_kyty_shadersandkyty_shim_*ran underVK_LAYER_KHRONOS_validationon the base and on this PR, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_LOADER_DEBUG=layer.kyty_shim_lod_stats_destination(does not link),kyty_shim_memory_sparse_reads_switch(timeout) andkyty_shim_prepared_variant_first_use. The base run also reportskyty_shim_compute_recipesas not run, because its binary was not built in that run; it passes on this PR.VUID-IDs, with no new ones.Tests:
RtOracle.cppaddsTwoTlasWalks(). One program has two walk loops whose TLAS headers come from user-data offsets 0x20 and 0x40. The second walk's tree must be bound as an extra source and only its intersection marked multi-tree. Two walks over one tree must bind nothing extra. The test fails on the base. The hand-built walk was split into helpers so one program can hold two walks.RecordLayouts()checksCompatibleRecordLayoutswith the layouts of a real shader: layouts that differ only in mask fields are compatible, ones that place record fields differently are not. It fails if the rule falls back to exact equality or drops the unmasked comparison.Performance: not measured in game. The cost is confined to the 16 programs whose SPIR-V changes: rays that used to miss are now traced, and multi-tree programs select a tree per lane and bind 2 or 3 tree contexts per dispatch instead of 1.
In game: an earlier version of this change reached gameplay in the title and looked correct. The final version was not run in game.
Note: programs found only in the code cache have guessed dispatch inputs, and the survey compiles them at both wave sizes. Their wave64 rows are therefore variants that may never be dispatched; only the 12 manifest programs, all wave32, have real dispatch inputs.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)