tu: Add push_consts_per_stage debug option
authorDanylo Piliaiev <dpiliaiev@igalia.com>
Tue, 5 Sep 2023 17:32:43 +0000 (19:32 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 4 Oct 2023 15:51:54 +0000 (15:51 +0000)
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25086>

src/freedreno/ir3/ir3_compiler.c
src/freedreno/ir3/ir3_compiler.h
src/freedreno/vulkan/tu_device.cc
src/freedreno/vulkan/tu_pipeline.cc
src/freedreno/vulkan/tu_util.cc
src/freedreno/vulkan/tu_util.h

index 52d04fd..34b08b2 100644 (file)
@@ -197,7 +197,7 @@ ir3_compiler_create(struct fd_device *dev, const struct fd_dev_id *dev_id,
       compiler->has_dp2acc = dev_info->a6xx.has_dp2acc;
       compiler->has_dp4acc = dev_info->a6xx.has_dp4acc;
 
-      if (compiler->gen == 6) {
+      if (compiler->gen == 6 && options->shared_push_consts) {
          compiler->shared_consts_base_offset = 504;
          compiler->shared_consts_size = 8;
          compiler->geom_shared_consts_size_quirk = 16;
index d51ef55..93b19c1 100644 (file)
@@ -70,6 +70,8 @@ struct ir3_compiler_options {
 
   /* If base_vertex should be lowered in nir */
   bool lower_base_vertex;
+
+  bool shared_push_consts;
 };
 
 struct ir3_compiler {
index de07bfd..1bdf341 100644 (file)
@@ -2164,7 +2164,8 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
          .disable_cache = true,
          .bindless_fb_read_descriptor = -1,
          .bindless_fb_read_slot = -1,
-         .storage_16bit = physical_device->info->a6xx.storage_16bit
+         .storage_16bit = physical_device->info->a6xx.storage_16bit,
+         .shared_push_consts = !TU_DEBUG(PUSH_CONSTS_PER_STAGE),
       };
       device->compiler =
          ir3_compiler_create(NULL, &physical_device->dev_id, &ir3_options);
index 342fd3b..d51e809 100644 (file)
@@ -315,6 +315,9 @@ tu_push_consts_type(const struct tu_pipeline_layout *layout,
    if (!layout->push_constant_size)
       return IR3_PUSH_CONSTS_NONE;
 
+   if (TU_DEBUG(PUSH_CONSTS_PER_STAGE))
+      return IR3_PUSH_CONSTS_PER_STAGE;
+
    if (tu6_shared_constants_enable(layout, compiler)) {
       return IR3_PUSH_CONSTS_SHARED;
    } else {
index 08443fa..ec1d29d 100644 (file)
@@ -31,6 +31,7 @@ static const struct debug_control tu_debug_options[] = {
    { "perfc", TU_DEBUG_PERFC },
    { "flushall", TU_DEBUG_FLUSHALL },
    { "syncdraw", TU_DEBUG_SYNCDRAW },
+   { "push_consts_per_stage", TU_DEBUG_PUSH_CONSTS_PER_STAGE },
    { "rast_order", TU_DEBUG_RAST_ORDER },
    { "unaligned_store", TU_DEBUG_UNALIGNED_STORE },
    { "log_skip_gmem_ops", TU_DEBUG_LOG_SKIP_GMEM_OPS },
index 1a62757..80ccd69 100644 (file)
@@ -34,7 +34,7 @@ enum tu_debug_flags
    TU_DEBUG_PERFC = 1 << 9,
    TU_DEBUG_FLUSHALL = 1 << 10,
    TU_DEBUG_SYNCDRAW = 1 << 11,
-   /* bit 12 is available */
+   TU_DEBUG_PUSH_CONSTS_PER_STAGE = 1 << 12,
    TU_DEBUG_GMEM = 1 << 13,
    TU_DEBUG_RAST_ORDER = 1 << 14,
    TU_DEBUG_UNALIGNED_STORE = 1 << 15,