From 47fb3f06c484f9e7efae8d0fbee71cddb2105e0c Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Tue, 5 Sep 2023 19:32:43 +0200 Subject: [PATCH] tu: Add push_consts_per_stage debug option Signed-off-by: Danylo Piliaiev Part-of: --- src/freedreno/ir3/ir3_compiler.c | 2 +- src/freedreno/ir3/ir3_compiler.h | 2 ++ src/freedreno/vulkan/tu_device.cc | 3 ++- src/freedreno/vulkan/tu_pipeline.cc | 3 +++ src/freedreno/vulkan/tu_util.cc | 1 + src/freedreno/vulkan/tu_util.h | 2 +- 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/freedreno/ir3/ir3_compiler.c b/src/freedreno/ir3/ir3_compiler.c index 52d04fd..34b08b2 100644 --- a/src/freedreno/ir3/ir3_compiler.c +++ b/src/freedreno/ir3/ir3_compiler.c @@ -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; diff --git a/src/freedreno/ir3/ir3_compiler.h b/src/freedreno/ir3/ir3_compiler.h index d51ef55..93b19c1 100644 --- a/src/freedreno/ir3/ir3_compiler.h +++ b/src/freedreno/ir3/ir3_compiler.h @@ -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 { diff --git a/src/freedreno/vulkan/tu_device.cc b/src/freedreno/vulkan/tu_device.cc index de07bfd..1bdf341 100644 --- a/src/freedreno/vulkan/tu_device.cc +++ b/src/freedreno/vulkan/tu_device.cc @@ -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); diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index 342fd3b..d51e809 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -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 { diff --git a/src/freedreno/vulkan/tu_util.cc b/src/freedreno/vulkan/tu_util.cc index 08443fa..ec1d29d 100644 --- a/src/freedreno/vulkan/tu_util.cc +++ b/src/freedreno/vulkan/tu_util.cc @@ -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 }, diff --git a/src/freedreno/vulkan/tu_util.h b/src/freedreno/vulkan/tu_util.h index 1a62757..80ccd69 100644 --- a/src/freedreno/vulkan/tu_util.h +++ b/src/freedreno/vulkan/tu_util.h @@ -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, -- 2.7.4