From 8b52c9bab74f9aeee298660821fd826279239df2 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 17 Apr 2023 12:06:45 +0200 Subject: [PATCH] r600/sfn: Tie in address load splitting Add R600_NIR_DEBUG flag "noaddrsplit" to disable the behaviour and use the old code path. Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/r600/sfn/sfn_debug.cpp | 1 + src/gallium/drivers/r600/sfn/sfn_debug.h | 3 ++- src/gallium/drivers/r600/sfn/sfn_nir.cpp | 25 ++++++++++++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_debug.cpp b/src/gallium/drivers/r600/sfn/sfn_debug.cpp index d23123c..9bfd375 100644 --- a/src/gallium/drivers/r600/sfn/sfn_debug.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_debug.cpp @@ -65,6 +65,7 @@ static const struct debug_named_value sfn_debug_options[] = { {"opt", SfnLog::opt, "Log optimization" }, {"steps", SfnLog::steps, "Log shaders at transformation steps" }, {"noopt", SfnLog::noopt, "Don't run backend optimizations" }, + {"noaddrsplit", SfnLog::noaddrsplit, "Don't split address loads early" }, DEBUG_NAMED_VALUE_END }; diff --git a/src/gallium/drivers/r600/sfn/sfn_debug.h b/src/gallium/drivers/r600/sfn/sfn_debug.h index be7c3bb..5cedf77 100644 --- a/src/gallium/drivers/r600/sfn/sfn_debug.h +++ b/src/gallium/drivers/r600/sfn/sfn_debug.h @@ -69,7 +69,8 @@ public: all = (1 << 15) - 1, nomerge = 1 << 16, steps = 1 << 17, - noopt = 1 << 18 + noopt = 1 << 18, + noaddrsplit = 1 << 19 }; SfnLog(); diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp index 4ba3fb5..6d0d588 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp @@ -43,6 +43,7 @@ #include "sfn_ra.h" #include "sfn_scheduler.h" #include "sfn_shader.h" +#include "sfn_split_address_loads.h" #include "util/u_prim.h" #include @@ -1006,6 +1007,23 @@ r600_shader_from_nir(struct r600_context *rctx, } } + if (!r600::sfn_log.has_debug_flag(r600::SfnLog::noaddrsplit)) + split_address_loads(*shader); + + if (r600::sfn_log.has_debug_flag(r600::SfnLog::steps)) { + std::cerr << "Shader after splitting address loads\n"; + shader->print(std::cerr); + } + + if (!r600::sfn_log.has_debug_flag(r600::SfnLog::noopt)) { + optimize(*shader); + + if (r600::sfn_log.has_debug_flag(r600::SfnLog::steps)) { + std::cerr << "Shader after optimization\n"; + shader->print(std::cerr); + } + } + auto scheduled_shader = r600::schedule(shader); if (r600::sfn_log.has_debug_flag(r600::SfnLog::steps)) { std::cerr << "Shader after scheduling\n"; @@ -1044,9 +1062,10 @@ r600_shader_from_nir(struct r600_context *rctx, /* We already schedule the code with this in mind, no need to handle this * in the backend assembler */ - pipeshader->shader.bc.ar_handling = AR_HANDLE_NORMAL; - pipeshader->shader.bc.r6xx_nop_after_rel_dst = 0; - + if (!r600::sfn_log.has_debug_flag(r600::SfnLog::noaddrsplit)) { + pipeshader->shader.bc.ar_handling = AR_HANDLE_NORMAL; + pipeshader->shader.bc.r6xx_nop_after_rel_dst = 0; + } r600::sfn_log << r600::SfnLog::shader_info << "pipeshader->shader.processor_type = " << pipeshader->shader.processor_type << "\n"; -- 2.7.4