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

Author: Ian Romanick <[email protected]>
Date:   Tue Oct 24 13:09:13 2023 -0700

nir/split_vars: Don't split arrays of cooperative matrix types

glsl_type_is_vector_or_scalar would more accruately be called "can be an
r-value that isn't an array, structure, or matrix. This optimization
pass really shouldn't do anything to cooperative matrices. These
matrices will eventually be lowered to something else (dependent on the
backend), and that thing may (or may not) be handled by this or another
pass.

Fixes: 2d0f4f2c17b ("compiler/types: Add support for Cooperative Matrix types")
Reviewed-by: Caio Oliveira <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25871>

---

 src/compiler/nir/nir_split_vars.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_split_vars.c 
b/src/compiler/nir/nir_split_vars.c
index 165750cd2e2..7cbd6d6a638 100644
--- a/src/compiler/nir/nir_split_vars.c
+++ b/src/compiler/nir/nir_split_vars.c
@@ -87,7 +87,15 @@ num_array_levels_in_array_of_vector_type(const struct 
glsl_type *type)
       if (glsl_type_is_array_or_matrix(type)) {
          num_levels++;
          type = glsl_get_array_element(type);
-      } else if (glsl_type_is_vector_or_scalar(type)) {
+      } else if (glsl_type_is_vector_or_scalar(type) &&
+                 !glsl_type_is_cmat(type)) {
+         /* glsl_type_is_vector_or_scalar would more accruately be called "can
+          * be an r-value that isn't an array, structure, or matrix. This
+          * optimization pass really shouldn't do anything to cooperative
+          * matrices. These matrices will eventually be lowered to something
+          * else (dependent on the backend), and that thing may (or may not)
+          * be handled by this or another pass.
+          */
          return num_levels;
       } else {
          /* Not an array of vectors */

Reply via email to