Repository navigation
hk: resolve each occurrence of a command buffer in a submission - #444
Merged
RyanTheTide merged 1 commit intoNov 19, 2026
Merged
RyanTheTide merged 1 commit into
RyanTheTide merged 1 commit into
Conversation
A simultaneous-use command buffer may occur more than once in one
vkQueueSubmit, for example {c0, c1, c0}. hk_sync_resolve_submit()
kept the resolved barrier and prior fields in each hk_cs, so the
second occurrence of c0 overwrote those of the first before the
payload was built. The first occurrence then went out with the
second's fields: a wait on a command after it, which the G17 kernel
refuses (barrier past the commands before it, EINVAL) and the device
is lost.
Resolve every occurrence completely, the first-command chain and the
vertex-half split included, before the next one starts, and save its
fields to a per-queue array in submission order. queue_submit() and
the sibling queue check read that array, and the payload loop loads
each entry into its stream before emitting it.
A sparse bind that only flushes the sparse table has no stream to
resolve: the array is not resized for it, since util_dynarray_resize()
returns NULL for zero entries of a never-allocated array, which lost
the device on a queue's first such bind (vkd3d-proton's tiled-resource
tests). The hk-g17p-sparse-bind-first-submit shim test binds one tile as
a queue's first submission.
Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Assisted-by: LLM
|
Hardware evidence for this bug from the M5 Pro driver-overhead lane, which also covers G16G (M4 mini):
The lane fixed it differently: it split such a batch into consecutive ioctls in which each recording occurs once. That fix passed on the M5:
This PR keeps one ioctl per batch, which is the better shape, so we won't open a competing PR. We're happy to run the same repro and regression list on the M5 with this PR applied if that helps it land. The mustpass cases with this pattern are 🤖 Generated with Claude Code |
RyanTheTide
added a commit
to jgoyvaerts/mesa
that referenced
this pull request
Nov 19, 2026
Keep both sets of shim tests in src/asahi/meson.build and src/asahi/vulkan/meson.build next to the ones aurora-silicon#444 added. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide
added a commit
to jgoyvaerts/mesa
that referenced
this pull request
Nov 19, 2026
Keep both sets of shim tests in src/asahi/meson.build and src/asahi/vulkan/meson.build next to the ones aurora-silicon#444 added. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This was referenced Nov 19, 2026
Merged
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
A simultaneous-use command buffer may occur more than once in one
vkQueueSubmit, for example{c0, c1, c0}.hk_sync_resolve_submit()kept the resolved barrier and prior fields in eachhk_cs, so the second occurrence ofc0overwrote those of the first before the payload was built. The first occurrence then went out with a wait on a command after it; the G17 kernel refuses that (refused a submission (EINVAL)) and the device is lost.Every occurrence is now resolved completely, the first-command chain and the vertex-half split included, before the next one starts, and its fields are saved to a per-queue array in submission order.
queue_submit()and the sibling-queue check read that array, and the payload loop loads each entry into its stream before emitting it.A sparse bind that only flushes the sparse table has no stream to resolve, so the array is not resized for it:
util_dynarray_resize()returns NULL for zero entries of a never-allocated array, which lost the device on a queue's first such bind (vkd3d-proton's tiled-resource tests).Tests:
test-hk-sync-priorgainstest_repeated_recording({a, b, a}, exact and legacy priors, with and without the first-command chain); the newhk-g17p-sparse-bind-first-submitshim test binds one tile as a queue's first submission.Testing
M4 Pro (J616s, G17P), kernel 7.3.0-m4.167, release builds, guarded runs, 0 GPU recoveries.
--suite asahi --suite vulkan200/200.vkQueueSubmitreturnsVK_ERROR_DEVICE_LOST(kernel EINVAL); with this commit it passes. The single-occurrence variants pass on both.dEQP-VK.api.command_buffers.*(221 cases): 132 pass, 89 not supported, 0 fail.🤖 Generated with Claude Code