radv: Split submission in winsys instead of radv_queue.
authorTimur Kristóf <timur.kristof@gmail.com>
Wed, 5 Apr 2023 22:13:34 +0000 (00:13 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 11 Apr 2023 17:05:03 +0000 (17:05 +0000)
This will still make it so that RADV_DEBUG=hang will only submit
one command buffer at a time, but otherwise let's pass all CS
objects into one submission and let the winsys split them if
necessary.

The winsys can do a better job at splitting them because
radv_queue has no knowledge of IBs and ignores chaining in the
splitting logic.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22354>

src/amd/vulkan/radv_queue.c
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index 4523add..7b62e4d 100644 (file)
 #include "vk_sync.h"
 #include "vk_semaphore.h"
 
-/* The number of IBs per submit isn't infinite, it depends on the IP type
- * (ie. some initial setup needed for a submit) and the number of IBs (4 DW).
- * This limit is arbitrary but should be safe for now.  Ideally, we should get
- * this limit from the KMD.
- */
-#define RADV_MAX_IBS_PER_SUBMIT 192
-
 enum radeon_ctx_priority
 radv_get_queue_global_priority(const VkDeviceQueueGlobalPriorityCreateInfoKHR *pObj)
 {
@@ -1588,8 +1581,8 @@ radv_queue_submit_normal(struct radv_queue *queue, struct vk_queue_submit *submi
 
    const unsigned num_perfctr_cs = use_perf_counters ? 2 : 0;
    const unsigned num_gang_wait_cs = use_ace ? 4 : 0;
-   const unsigned max_cs_submission = queue->device->trace_bo ? 1 : RADV_MAX_IBS_PER_SUBMIT;
    const unsigned cmd_buffer_count = submission->command_buffer_count;
+   const unsigned max_cs_submission = queue->device->trace_bo ? 1 : cmd_buffer_count;
    const unsigned cs_array_size = (use_ace ? 2 : 1) * MIN2(max_cs_submission, cmd_buffer_count) +
                                   num_perfctr_cs + num_gang_wait_cs;
 
index 3fed599..d74f0da 100644 (file)
@@ -45,8 +45,8 @@
 
 #define GFX6_MAX_CS_SIZE 0xffff8 /* in dwords */
 
-/* TODO: change this to a suitable number. */
-#define RADV_MAX_IBS_PER_SUBMIT 256
+/* Maximum allowed total number of submitted IBs. */
+#define RADV_MAX_IBS_PER_SUBMIT 192
 
 enum { VIRTUAL_BUFFER_HASH_TABLE_SIZE = 1024 };