Mesa (main): radv: move ac_shader_config to radv_shader_binary instead of legacy

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 11 13:09:34 UTC 2021


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Sep 22 10:13:01 2021 +0200

radv: move ac_shader_config to radv_shader_binary instead of legacy

This will allow us to avoid postprocessing binaries when they are
loaded from the shaders cache.

LLVM binaries already contain the shader config as part of the ELF,
so it's duplicated and increase the cache entry by 48 bytes. Though,
I don't think that should matter for LLVM.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12992>

---

 src/amd/compiler/aco_interface.cpp | 2 +-
 src/amd/vulkan/radv_shader.c       | 2 +-
 src/amd/vulkan/radv_shader.h       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/amd/compiler/aco_interface.cpp b/src/amd/compiler/aco_interface.cpp
index 5c425afc0db..60499f2aa5e 100644
--- a/src/amd/compiler/aco_interface.cpp
+++ b/src/amd/compiler/aco_interface.cpp
@@ -247,7 +247,7 @@ aco_compile_shader(unsigned shader_count, struct nir_shader* const* shaders,
    legacy_binary->exec_size = exec_size;
    legacy_binary->code_size = code.size() * sizeof(uint32_t);
 
-   legacy_binary->config = config;
+   legacy_binary->base.config = config;
    legacy_binary->disasm_size = 0;
    legacy_binary->ir_size = llvm_ir.size();
 
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 3069f2d02db..63bf77f8e76 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -1445,7 +1445,7 @@ radv_shader_variant_create(struct radv_device *device, const struct radv_shader_
       variant->exec_size = rtld_binary.exec_size;
    } else {
       assert(binary->type == RADV_BINARY_TYPE_LEGACY);
-      config = ((struct radv_shader_binary_legacy *)binary)->config;
+      config = ((struct radv_shader_binary_legacy *)binary)->base.config;
       variant->code_size =
          radv_get_shader_binary_size(((struct radv_shader_binary_legacy *)binary)->code_size);
       variant->exec_size = ((struct radv_shader_binary_legacy *)binary)->exec_size;
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
index 90cfaed5a9b..2f232ad854e 100644
--- a/src/amd/vulkan/radv_shader.h
+++ b/src/amd/vulkan/radv_shader.h
@@ -353,6 +353,7 @@ struct radv_shader_binary {
    gl_shader_stage stage;
    bool is_gs_copy_shader;
 
+   struct ac_shader_config config;
    struct radv_shader_info info;
 
    /* Self-referential size so we avoid consistency issues. */
@@ -361,7 +362,6 @@ struct radv_shader_binary {
 
 struct radv_shader_binary_legacy {
    struct radv_shader_binary base;
-   struct ac_shader_config config;
    unsigned code_size;
    unsigned exec_size;
    unsigned ir_size;



More information about the mesa-commit mailing list