radv/bvh: use atomic load/store in update_gfx12.comp
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

It looks like these are used to synchronize access to args.bounds, but
they were not atomic.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 2d48b2cb47 ("radv: Use subgroup OPs for BVH updates on GFX12")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15641
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42214>
This commit is contained in:
Rhys Perry 2026-06-12 11:40:49 +01:00 committed by Marge Bot
parent a116cc91cd
commit 4fe2ddf5e2

View file

@ -97,8 +97,10 @@ main()
bool is_ready = is_leaf_or_invalid;
while (true) {
if (!is_ready)
is_ready = DEREF(INDEX(uint32_t, args.internal_ready_count, child_index)) != 0;
if (!is_ready) {
is_ready = atomicLoad(DEREF(INDEX(uint32_t, args.internal_ready_count, child_index)),
gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeVisible) != 0;
}
if (radv_ballot(cluster, is_ready) != 0xff)
continue;
@ -121,13 +123,8 @@ main()
} else {
DEREF(INDEX(vk_aabb, args.bounds, node_index - 1)) = total_bounds;
memoryBarrier(gl_ScopeDevice, gl_StorageSemanticsBuffer,
gl_SemanticsAcquireRelease | gl_SemanticsMakeAvailable | gl_SemanticsMakeVisible);
DEREF(INDEX(uint32_t, args.internal_ready_count, node_index - 1)) = 1;
memoryBarrier(gl_ScopeDevice, gl_StorageSemanticsBuffer,
gl_SemanticsAcquireRelease | gl_SemanticsMakeAvailable | gl_SemanticsMakeVisible);
atomicStore(DEREF(INDEX(uint32_t, args.internal_ready_count, node_index - 1)), 1u, gl_ScopeDevice,
gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeAvailable);
}
}