Repository navigation
hk: custom primitive restart indices and process-wide memory budget (vulkan-cts-1.4.7.0) - #52
Merged
RyanTheTide merged 2 commits intoOct 23, 2026
Conversation
VK_EXT_primitive_restart_index lets vkCmdSetPrimitiveRestartIndexEXT
pick any restart value, zero included. Several draw paths still used
the all-ones value of the index type.
- G15S, G15C and G17P direct indexed draws wrote 0xff, 0xffff or
0xffffffff into the restart state update in front of the draw.
- Indirect indexed draws did the same through the HAL200 indirect
record and through agx_vdm_draw() on the other Index List chips.
Conditional rendering turns a direct draw into an indirect one, so
it was hit there too.
- The GPU-side robust index repair emitted the fixed value as well.
- The AGX2 path cached the last emitted restart index and used zero to
mean "nothing emitted yet", so a custom index of zero at the start
of a stream was never emitted.
Take the value from the dynamic state for application draws.
Geometry shading and transform feedback keep the fixed value, since
they draw an index buffer that poly generates. agx_vdm_draw() and the
robust index kernels now take the restart index as an argument, and
the gallium driver passes the GL restart index the same way. The
AGX2 cache gets an explicit flag instead of the zero sentinel.
vulkan-cts-1.4.7.0 added 3,242 primitive_restart_index cases. On G17P
120 of the 216 that fraction 0 of 16 runs failed with an image
mismatch, all custom_index_{zero,one,max_minus_one} and
conditional_rendering variants. They all pass now. G14 passed before
and still does.
Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
VK_EXT_memory_budget defines heapUsage as an estimate of how much memory the process is using in the heap. Every VkInstance enumerates its own hk_physical_device, though, and each one counted only the allocations made through it. A second instance in the same process saw none of the first one's memory. Keep the usage and BO cache counters in one record per render node, shared by every physical device of that node in the process and reference counted by them. Allocation, free, the heap size check and the budget all read the shared counters. heapUsage also stops counting idle BOs in the BO cache. They are reclaimable, and an allocation that reuses one moved a BO from the cache counter to the used counter, so the reported usage did not change. The cache still lowers the budget. This fixes dEQP-VK.info.device_memory_budget_multi_instance, new in vulkan-cts-1.4.7.0 and on its mandatory list, which failed with "Memory heap usage not increased for heap 0": first because the second instance did not see the first one's allocation, then because the second allocation came out of the BO cache. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This was referenced Oct 23, 2026
Closed
Closed
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.
The vulkan-cts-1.4.7.0 dry run on the Neo (fraction 0 of 16) failed 121 tests, all new in 1.4.7.0. These two commits fix both causes.
Custom primitive restart index. VK_EXT_primitive_restart_index lets an app set any restart value, zero included, but several draw paths still wrote the index type's all-ones value. That covered G15S, G15C and G17P direct and indirect draws, agx_vdm_draw() on the other Index List chips, and the robust index repair kernels. Conditional rendering turns a direct draw into an indirect one, so it failed the same way. The value now comes from the dynamic state. Geometry shading and transform feedback keep the fixed value, since they draw poly's own index buffer. The AGX2 restart cache also used zero to mean "nothing emitted yet", which is a legal custom index now, so it has an explicit flag instead. Gallium passes the GL restart index to agx_vdm_draw() the same way.
Memory budget per process. heapUsage has to count the whole process, but each VkInstance has its own physical device and only counted its own allocations. The counters now live in one refcounted record per render node. Idle BO cache entries no longer count as usage either. An allocation that reused one didn't raise the reported usage, which was the second way
dEQP-VK.info.device_memory_budget_multi_instancefailed. That test is on the mandatory list, so it would have failed every fraction.Testing
🤖 Generated with Claude Code