mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 02:40:11 +01:00
rusticl/kernel: recalculate scratch and shared memory after opts
Turns out we have to do it regardless as opts after explicit_types could
get rid of even more scratch and shared memory.
Fixes: ea023ff5cd ("rusticl/kernel: no need to reset the scratch size anymore")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27634>
This commit is contained in:
parent
ad5fbc4407
commit
53df391d27
2 changed files with 29 additions and 0 deletions
|
|
@ -634,6 +634,24 @@ fn lower_and_optimize_nir(
|
|||
opt_nir(nir, dev, true);
|
||||
nir_pass!(nir, nir_lower_memcpy);
|
||||
|
||||
// we might have got rid of more function_temp or shared memory
|
||||
nir.reset_scratch_size();
|
||||
nir.reset_shared_size();
|
||||
nir_pass!(
|
||||
nir,
|
||||
nir_remove_dead_variables,
|
||||
nir_variable_mode::nir_var_function_temp | nir_variable_mode::nir_var_mem_shared,
|
||||
&dv_opts,
|
||||
);
|
||||
nir_pass!(
|
||||
nir,
|
||||
nir_lower_vars_to_explicit_types,
|
||||
nir_variable_mode::nir_var_function_temp
|
||||
| nir_variable_mode::nir_var_mem_shared
|
||||
| nir_variable_mode::nir_var_mem_generic,
|
||||
Some(glsl_get_cl_type_size_align),
|
||||
);
|
||||
|
||||
nir_pass!(
|
||||
nir,
|
||||
nir_lower_explicit_io,
|
||||
|
|
|
|||
|
|
@ -308,10 +308,21 @@ impl NirShader {
|
|||
unsafe { (*self.nir.as_ptr()).info.num_textures }
|
||||
}
|
||||
|
||||
pub fn reset_scratch_size(&mut self) {
|
||||
unsafe {
|
||||
(*self.nir.as_ptr()).scratch_size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn scratch_size(&self) -> u32 {
|
||||
unsafe { (*self.nir.as_ptr()).scratch_size }
|
||||
}
|
||||
|
||||
pub fn reset_shared_size(&mut self) {
|
||||
unsafe {
|
||||
(*self.nir.as_ptr()).info.shared_size = 0;
|
||||
}
|
||||
}
|
||||
pub fn shared_size(&self) -> u32 {
|
||||
unsafe { (*self.nir.as_ptr()).info.shared_size }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue