Repository navigation
hk: let only G17-runtime renders carry occlusion availability - #94
Merged
Merged
Conversation
Native AGX3 occlusion pools let a render carry a query's availability in one of its four retirement timestamp slots, and a CPU read that finds such a timestamp skips the submission wait. That assumes the kernel writes every slot when it retires the render, after the end-of-render maintenance that makes the counts visible. The G17 kernel does. On G15 (M3) the firmware writes each slot from its stage's own start or end record: the vertex end lands when tiling finishes, before the fragment work writes the counts. With two queries in one render, the second one rides on the vertex-end slot, and vkGetQueryPoolResults, even with WAIT_BIT, returns its count as available before the fragment work wrote it. On an M3 Pro, reading the later query first before the fence returned 0 in 48 of 48 reads, against the correct count after the fence. Add hk_oq_render_stamps_supported(), true only for G17P, where the path was measured, and gate the stamped pool on it. Every other chip keeps the queued availability store and the submission wait on readback, as before the stamped path. Other chips whose kernel writes the slots at retirement can be added once qualified. test-hk-query-oq checks the chip decision.
M5 (G17G/G17S) runs the same G17 kernel runtime as G17P for render retirement. A render completes only once its completion stamps cover it, after the end-of-render maintenance (g17/queue/render/retirement.rs, complete_poll()). The host then writes the four stage timestamps into the requested slots before signalling the fence (g17/completion.rs, Output::publish()). Only the render publication and its notification differ on M5. A stamp in a query's availability slot therefore means the counts are visible there too, so include G17G and G17S in hk_oq_render_stamps_supported(). G15 and G16G keep the queued store.
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.
Fixes the blocker on omacom#19, raised by maralcbr and chriskearney and confirmed on M3 Pro hardware by chriskearney.
Problem. Native AGX3 occlusion pools let a render carry a query's availability in one of its four retirement timestamp slots (e07644e). A CPU read that finds such a timestamp skips the submission wait. That assumes the kernel writes every slot when it retires the render, after the end-of-render maintenance that makes the counts visible.
So with two queries in one render, the second rides on the vertex-end slot.
vkGetQueryPoolResults, even withWAIT_BIT, then returns its count as available before the fragment work has written it. chriskearney's M3 Pro probe read the later query first, before the fence: 48/48 early reads returned 0, while every read after the fence was correct.Change.
hk_oq_render_stamps_supported()gates the stamped pool. It returns true for G17P and for M5 (G17G/G17S).g17/queue/render/retirement.rs,complete_poll()). The host then writes the four stage timestamps into the slots before signalling the fence (g17/completion.rs,Output::publish()). Only the render publication and notification differ on M5. This is from the M5 kernel source (m5/push-20261025, T6050 probed throughprobe_g17()); M5 hasn't been measured on this path.Testing (host only):
hk_query_oq_test: 55/55, including the new chip checks (G17P and M5 stamp; G15G/S/C and G16G don't).hk_query_oq.candhk_query_pool.cbuild with-Dwerror=true.