Mesa (main): radv: cache the slab bo pointer in the pipeline.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 11 05:58:11 UTC 2022


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon May  9 16:06:58 2022 +1000

radv: cache the slab bo pointer in the pipeline.

Otherwise each emission has to pointer chase across cachelines.

Reduces overhead seen with zink on pixmark volplosion test.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16393>

---

 src/amd/vulkan/radv_cmd_buffer.c     | 2 +-
 src/amd/vulkan/radv_pipeline.c       | 2 ++
 src/amd/vulkan/radv_pipeline_cache.c | 1 +
 src/amd/vulkan/radv_private.h        | 1 +
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 65e219bce41..6ba076020cd 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -1405,7 +1405,7 @@ radv_emit_graphics_pipeline(struct radv_cmd_buffer *cmd_buffer)
 
    radv_emit_batch_break_on_new_ps(cmd_buffer);
 
-   radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, pipeline->slab->alloc->arena->bo);
+   radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, pipeline->slab_bo);
 
    if (unlikely(cmd_buffer->device->trace_bo))
       radv_save_pipeline(cmd_buffer, pipeline);
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 63b5400836e..3cb547ff6c5 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -3810,6 +3810,8 @@ radv_upload_shaders(struct radv_device *device, struct radv_pipeline *pipeline,
    if (!pipeline->slab)
       return VK_ERROR_OUT_OF_DEVICE_MEMORY;
 
+   pipeline->slab_bo = pipeline->slab->alloc->arena->bo;
+
    /* Upload shader binaries. */
    uint64_t slab_va = radv_buffer_get_va(pipeline->slab->alloc->arena->bo);
    uint32_t slab_offset = pipeline->slab->alloc->offset;
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index 238f6a3ea1d..cce39e5a66d 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -387,6 +387,7 @@ radv_create_shaders_from_pipeline_cache(
       entry->slab = pipeline->slab;
    } else {
       pipeline->slab = entry->slab;
+      pipeline->slab_bo = pipeline->slab->alloc->arena->bo;
    }
 
    if (num_stack_sizes) {
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 2e5917f9456..2abf56017eb 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1881,6 +1881,7 @@ struct radv_pipeline {
    struct radv_dynamic_state dynamic_state;
 
    struct radv_pipeline_slab *slab;
+   struct radeon_winsys_bo *slab_bo;
 
    bool need_indirect_descriptor_sets;
    struct radv_shader *shaders[MESA_VULKAN_SHADER_STAGES];



More information about the mesa-commit mailing list