clover/nir: Use nir_var_mem_constant for __constant memory
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 19 Aug 2020 16:34:21 +0000 (11:34 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 1 Sep 2020 20:50:04 +0000 (20:50 +0000)
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6379>

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

index c916190f3a2811fe08d79860760e52ffaebdf6c1..924651433330e8acd732593c19fd8525d88e547b 100644 (file)
@@ -140,10 +140,12 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
       spirv_options.shared_addr_format = nir_address_format_32bit_offset;
       spirv_options.global_addr_format = nir_address_format_32bit_global;
       spirv_options.temp_addr_format = nir_address_format_32bit_offset;
+      spirv_options.constant_addr_format = nir_address_format_32bit_global;
    } else {
       spirv_options.shared_addr_format = nir_address_format_32bit_offset_as_64bit;
       spirv_options.global_addr_format = nir_address_format_64bit_global;
       spirv_options.temp_addr_format = nir_address_format_32bit_offset_as_64bit;
+      spirv_options.constant_addr_format = nir_address_format_64bit_global;
    }
    spirv_options.caps.address = true;
    spirv_options.caps.float64 = true;
@@ -152,7 +154,6 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
    spirv_options.caps.int64 = true;
    spirv_options.caps.kernel = true;
    spirv_options.caps.int64_atomics = dev.has_int64_atomics();
-   spirv_options.constant_as_global = true;
    spirv_options.debug.func = &debug_function;
    spirv_options.debug.private_data = &r_log;
 
@@ -234,6 +235,8 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
       NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_uniform,
                  nir_address_format_32bit_offset);
 
+      NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_constant,
+                 spirv_options.constant_addr_format);
       NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_shared,
                  spirv_options.shared_addr_format);