Module: Mesa
Branch: main
Commit: 752fba464398f1193d4616234a311f985dfa4814
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=752fba464398f1193d4616234a311f985dfa4814

Author: Samuel Pitoiset <[email protected]>
Date:   Thu Aug 31 10:35:38 2023 +0200

radv: fix gang submissions with chaining

Gang submissions are mostly only be used for task shaders to both
submit GFX and ACE command buffers in the same submission. Though,
the gang leader (the last submitted CS) IP type should match the
queue IP type to determine which fence to signal.

But if chaining is enabled, it's possible that all GFX cmdbufs are
chained to the first GFX cmdbuf, which means the last CS is ACE and
not GFX.

Fix this by resetting chaining for GFX when a cmdbuffer has GFX+ACE.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9724
Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24966>

---

 src/amd/vulkan/radv_queue.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_queue.c b/src/amd/vulkan/radv_queue.c
index f420ff23744..f5bd047447a 100644
--- a/src/amd/vulkan/radv_queue.c
+++ b/src/amd/vulkan/radv_queue.c
@@ -1637,8 +1637,14 @@ radv_queue_submit_normal(struct radv_queue *queue, 
struct vk_queue_submit *submi
          /* Follower needs to be first because the last CS must match the 
queue's IP type. */
          if (radv_cmd_buffer_has_follower(cmd_buffer)) {
             queue->device->ws->cs_unchain(cmd_buffer->gang.cs);
-            if (!chainable_ace || !queue->device->ws->cs_chain(chainable_ace, 
cmd_buffer->gang.cs, false))
+            if (!chainable_ace || !queue->device->ws->cs_chain(chainable_ace, 
cmd_buffer->gang.cs, false)) {
                cs_array[num_submitted_cs++] = cmd_buffer->gang.cs;
+               /* Reset chaining for GFX when the cmdbuf has GFX+ACE because 
the follower CS (ACE)
+                * must always be before the leader CS (GFX). Otherwise, the 
GFX CS might be chained
+                * to previous one and ordering would be incorrect.
+                */
+               chainable = NULL;
+            }
 
             chainable_ace = can_chain_next ? cmd_buffer->gang.cs : NULL;
             submit_ace = true;

Reply via email to