Repository navigation
Conversation
|
The compute and draw paths can skip an extra source with an out-of-range SGPR pair, but the emitted shader still scans that context slot. Neither skip clears the slot, so a valid entry from an earlier dispatch or draw can be selected if its header matches. Invalidate skipped slots before the shader runs, or reject those sources before emitting the scan. Please add a synthetic regression test that checks hit results from two distinct trees in one dispatch. The coverage counts show that more sites are marked native, but they don't establish that each walk selects the right tree. |
6b7cd96 to
520f121
Compare
|
Both fixed in 520f121. Skipped slots: when a dispatch or a draw skips an extra tree because its SGPR pair is out of range, Kyty now clears that context slot's valid word before the shader runs ( Regression test: |
|
The updated diff clears skipped extra slots in both compute and draw, and the reported two-TLAS test covers the requested hit results as well as invalid and duplicate entries. One remaining issue: |
520f121 to
e1dc335
Compare
|
Fixed in e1dc335. The field is now versioned like The runtime store never reaches this case: its stamp is a hash over the |
|
The serialization concern is addressed in the updated diff: the reader clears the extra-source vector for older layouts, and One test portability issue remains: |
A compute shader whose walks read different top-level trees kept only the walks of the first tree native and ran the others empty, so their rays missed. Keep walks of other trees that share the instance-record layout and record each extra tree in the shader info. When a shader has more than one tree, each walk picks its host context at run time by matching the tree header it read against the valid context entries. The host prepares one context, acceleration structure and instance-node range per tree, and keeps every tree's guest memory mapped. Shaders with one tree emit the same code as before. Size the walk-site limit from the encoding: the site field and the site mask allow 32, and the emitter's per-site state now follows MaxRayQuerySites instead of a fixed 4. Draws prepare every tree as dispatches do. Walks answered by the host query or rewritten to results stay on the first tree, whose context those paths read. A header never splits off twice with different layouts, sites stay below MaxRayQuerySites, shaders with extra trees synchronize device-address memory conservatively instead of using the first tree's bounded reach, and the readback ring holds one dispatch's contexts without waiting on its own submission. A dispatch or draw that skips an extra tree because its SGPR pair is out of range clears that context slot's valid word, so the walk never picks a stale entry left by an earlier dispatch. The tree pick moves into PickContext, and kyty_shim_rt_context_pick runs it with ray queries against two host trees, an invalid slot and a repeated header. The new shader-info field is versioned like relative_vgprs: a reader flag (default on) decides whether it is read, and older records decode with no extra sources. kyty_spirv_match also tries the layout from before the field, and a fixture store without it covers that path.
e1dc335 to
8bd4916
Compare
|
Fixed in 8bd4916. |
|
The updated diff addresses the device-selection issue: |
What
Kyty serves a compute shader's BVH walks natively only when every walk reads the same top-level tree. A shader whose walks read two or three different trees kept the walks of the first tree and ran the others empty, so their rays missed.
NativeTraversalLayoutkeeps walks of other trees with the same instance-record layout and records each extra tree (user SGPR, header offset, header V#, root, layout) inShaderInfo::ray_query_extra_sources, serialized with the shader.CacheTlasMemorykeeps every tree's guest memory mapped.MaxContextsso one dispatch's contexts never wait on its own submission.MaxRayQuerySites; sites a shader does not use emit nothing.Tested
Arch Linux (CachyOS), NVIDIA GeForce RTX 4090, driver 620.73.04.
Native coverage
kyty_rt_probe --subgroup 32 --oracle 33 --stats --allover the shader store of a PS5 open-world title (68 compute shaders with BVH walks, 550 walk sites):The title's shaders use at most 7 walk sites and 3 trees each. The remaining empty sites are shaders whose instance records are read through a buffer descriptor built inside the shader, which this PR does not change.
Tests
kyty_shim_rt_*,kyty_shim_native_rt,kyty_shim_recompiler_*andkyty_shim_hw_oracle*(14 tests) pass on base and on this PR with the Vulkan validation layer inserted, 0VUID-on both.kyty_shim_rt_corpusskips on both.kyty_shim_recompiler_valid_spirvpassed 30 of 30 repeated runs.New
kyty_shim_rt_context_pick: two host TLASes (one instance each, custom index 11 and 22) and a context table holding tree A, tree B, a slot with valid = 0 whose header matches a third tree, and a second entry with tree A's header pointing at tree B. One 64-lane dispatch runs the emitter's tree pick and a ray query against the picked tree: walks on A return 11, walks on B return 22, the invalid slot and an unknown header miss. Mutants that ignore the valid word or let the last matching entry win fail it (16 failures each). Passes with the validation layer, 0VUID-; skips without ray-query support.In game
One attended session on the change (before the rebase onto current
Brainrot; the rebase changed no survey result): host-traced RT dispatches every 10 s, no device loss, no Xid. It was a cold start, so most of the session was shader compilation.Not measured: driver compile time of the shaders that now emit more walk sites (the stored modules from that session predate the rebase and the current replay tool cannot read them). Extra trees take their header from user data or the walk itself, not the flattened SRT, and start from the default instance capacity; those are speed limits, not correctness ones.
Checklist
Brainrot; 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)