rusticl/kernel: set has_variable_shared_mem on the nir

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19855>
This commit is contained in:
Karol Herbst 2022-11-22 23:00:46 +01:00 committed by Marge Bot
parent 0e5722cd22
commit 87147e2b09
2 changed files with 17 additions and 0 deletions

View file

@ -688,6 +688,12 @@ fn lower_and_optimize_nir_late(
* other things we depend on
*/
KernelArg::assign_locations(args, &mut res, nir);
/* update the has_variable_shared_mem info as we might have DCEed all of them */
nir.set_has_variable_shared_mem(
args.iter()
.any(|arg| arg.kind == KernelArgType::MemLocal && !arg.dead),
);
dev.screen.finalize_nir(nir);
nir.pass0(nir_opt_dce);

View file

@ -186,6 +186,17 @@ impl NirShader {
}
}
pub fn set_has_variable_shared_mem(&mut self, val: bool) {
unsafe {
self.nir
.as_mut()
.info
.anon_1
.cs
.set_has_variable_shared_mem(val)
}
}
pub fn variables_with_mode(
&mut self,
mode: nir_variable_mode,