nir/lower_vars_to_scratch: calculate threshold-limited variable size separately
ir3's lowering of variables to scratch memory has to treat 8-bit values as 16-bit ones when comparing such value's size against the given threshold since those values are handled through 16-bit half-registers. But those values can still use natural 8-bit size and alignment for storing inside scratch memory. nir_lower_vars_to_scratch now accepts two size-and-alignment functions, one used for calculating the variable size and the other for calculating the size and alignment needed for storing inside scratch memory. Non-ir3 uses of this pass can just duplicate the currently-used function. ir3 provides a separate variable-size function that special-cases 8-bit types. Signed-off-by: Zan Dobersek <zdobersek@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29875>
This commit is contained in:
@@ -3293,7 +3293,7 @@ agx_preprocess_nir(nir_shader *nir, const nir_shader *libagx)
|
||||
|
||||
/* Lower large arrays to scratch and small arrays to csel */
|
||||
NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 16,
|
||||
glsl_get_natural_size_align_bytes);
|
||||
glsl_get_natural_size_align_bytes, glsl_get_natural_size_align_bytes);
|
||||
NIR_PASS(_, nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0);
|
||||
NIR_PASS(_, nir, nir_split_var_copies);
|
||||
NIR_PASS(_, nir, nir_lower_global_vars_to_local);
|
||||
|
||||
Reference in New Issue
Block a user