Mesa (main): r600/sfn: lower to scalar with filter applied

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 7 12:33:33 UTC 2021


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Wed Mar 31 10:55:57 2021 +0200

r600/sfn: lower to scalar with filter applied

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9943>

---

 src/gallium/drivers/r600/r600_pipe_common.c | 4 ++++
 src/gallium/drivers/r600/sfn/sfn_nir.cpp    | 3 +--
 src/gallium/drivers/r600/sfn/sfn_nir.h      | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c
index fe3d0c6169a..9599ba7af2b 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.c
+++ b/src/gallium/drivers/r600/r600_pipe_common.c
@@ -1181,6 +1181,8 @@ r600_get_compiler_options(struct pipe_screen *screen,
        return &rscreen->nir_options;
 }
 
+extern bool r600_lower_to_scalar_instr_filter(const nir_instr *instr, const void *);
+
 bool r600_common_screen_init(struct r600_common_screen *rscreen,
 			     struct radeon_winsys *ws)
 {
@@ -1330,6 +1332,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
 		.lower_bitfield_insert_to_bitfield_select = true,
 		.has_fused_comp_and_csel = true,
 		.lower_find_msb_to_reverse = true,
+                .lower_to_scalar = true,
+                .lower_to_scalar_filter = r600_lower_to_scalar_instr_filter,
 	};
 
 	rscreen->nir_options = nir_options;
diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp
index b421f838c9f..6314db50e1f 100644
--- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp
@@ -810,6 +810,7 @@ bool has_saturate(const nir_function *func)
    return false;
 }
 
+extern "C"
 bool r600_lower_to_scalar_instr_filter(const nir_instr *instr, const void *)
 {
    if (instr->type != nir_instr_type_alu)
@@ -875,8 +876,6 @@ int r600_shader_from_nir(struct r600_context *rctx,
       NIR_PASS_V(sel->nir, nir_lower_int64);
    while(optimize_once(sel->nir, false));
 
-   NIR_PASS_V(sel->nir, nir_lower_alu_to_scalar, r600_lower_to_scalar_instr_filter, NULL);
-
    NIR_PASS_V(sel->nir, r600_lower_shared_io);
    NIR_PASS_V(sel->nir, r600_nir_lower_atomics);
 
diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.h b/src/gallium/drivers/r600/sfn/sfn_nir.h
index d13accb3bce..6bac550ac2c 100644
--- a/src/gallium/drivers/r600/sfn/sfn_nir.h
+++ b/src/gallium/drivers/r600/sfn/sfn_nir.h
@@ -146,6 +146,7 @@ extern "C" {
 
 bool r600_vectorize_vs_inputs(nir_shader *shader);
 
+bool r600_lower_to_scalar_instr_filter(const nir_instr *instr, const void *);
 
 int r600_shader_from_nir(struct r600_context *rctx,
                          struct r600_pipe_shader *pipeshader,



More information about the mesa-commit mailing list