Mesa (master): pan/bi: Lower large arrays to scratch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Apr 3 19:35:54 UTC 2021


Module: Mesa
Branch: master
Commit: 11010b932b268c8dba2916f2f8196f09e336c42b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=11010b932b268c8dba2916f2f8196f09e336c42b

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Fri Mar  5 21:55:18 2021 +0000

pan/bi: Lower large arrays to scratch

No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10020>

---

 src/gallium/drivers/panfrost/pan_screen.c | 2 +-
 src/panfrost/bifrost/bifrost_compile.c    | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index 208e062c667..2ad2739af85 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -355,7 +355,7 @@ panfrost_get_shader_param(struct pipe_screen *screen,
                 return 0;
 
         case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR:
-                return 0;
+                return pan_is_bifrost(dev);
 
         case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
                 return 1;
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 94b555111bc..ecb52a2c127 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -3007,6 +3007,12 @@ bifrost_compile_shader_nir(nir_shader *nir,
                 NIR_PASS_V(nir, nir_lower_point_size, 1.0, 1024.0);
         }
 
+        /* Lower large arrays to scratch and small arrays to bcsel (TODO: tune
+         * threshold, but not until addresses / csel is optimized better) */
+        NIR_PASS_V(nir, nir_lower_vars_to_scratch, nir_var_function_temp, 16,
+                        glsl_get_natural_size_align_bytes);
+        NIR_PASS_V(nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0);
+
         NIR_PASS_V(nir, nir_split_var_copies);
         NIR_PASS_V(nir, nir_lower_global_vars_to_local);
         NIR_PASS_V(nir, nir_lower_var_copies);



More information about the mesa-commit mailing list