clover/nir: Lower function_temp to scratch.
authorKarol Herbst <kherbst@redhat.com>
Sun, 16 Aug 2020 15:43:18 +0000 (17:43 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 1 Sep 2020 18:47:30 +0000 (18:47 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6433>

src/gallium/frontends/clover/nir/invocation.cpp

index 8d53f594c44f25972e55b6ab3c0cbb7f5952c909..6801b607feb3050b0a8ca42c35aeec8a33f89726 100644 (file)
@@ -226,7 +226,8 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
          offset += glsl_get_cl_size(var->type);
       }
 
-      NIR_PASS_V(nir, nir_lower_vars_to_explicit_types, nir_var_mem_shared,
+      NIR_PASS_V(nir, nir_lower_vars_to_explicit_types,
+                 nir_var_mem_shared | nir_var_function_temp,
                  glsl_get_cl_type_size_align);
 
       /* use offsets for uniform and shared memory */
@@ -236,9 +237,14 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
       NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_shared,
                  spirv_options.shared_addr_format);
 
+      NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_function_temp,
+                 spirv_options.temp_addr_format);
+
       NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_global,
                  spirv_options.global_addr_format);
 
+      NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_all, NULL);
+
       if (compiler_options->lower_int64_options)
          NIR_PASS_V(nir, nir_lower_int64);