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 52d04fdd7d9d0f6fc1b3683b5d0bf0aed3517ec1..34b08b2fe0bbc8141c73ddefc6b950a375846467 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 d51ef5519cc83dce29c63f94f0d2039a68c77206..93b19c1f6f8fa2f6545a411f18059c4a7d54fc82 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 de07bfd0c87a933e265bfa08d0ab6129be870482..1bdf34164b3736bcca7403ad61a2176a275b286a 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 342fd3b1e7a0a55096715e80b004a4685d2c9e6a..d51e8093a69bd7e59c257cc1fbc81a7582f05247 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 08443fa87cfd125d8239da58f7db2db04772546b..ec1d29dbbe360e33e085763081787a9693cdbaf0 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 1a62757ea3630b5f4110aa8350b6a7a2e806b7e9..80ccd698a3675fbbb5bf9e90ce4cb1e6ad694a4c 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,