From 87147e2b097b09d58267e6584cb96de43173bbf3 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 22 Nov 2022 23:00:46 +0100 Subject: [PATCH] rusticl/kernel: set has_variable_shared_mem on the nir Signed-off-by: Karol Herbst Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/frontends/rusticl/core/kernel.rs | 6 ++++++ src/gallium/frontends/rusticl/mesa/compiler/nir.rs | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/gallium/frontends/rusticl/core/kernel.rs b/src/gallium/frontends/rusticl/core/kernel.rs index fc102f183e6..2810f240888 100644 --- a/src/gallium/frontends/rusticl/core/kernel.rs +++ b/src/gallium/frontends/rusticl/core/kernel.rs @@ -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); diff --git a/src/gallium/frontends/rusticl/mesa/compiler/nir.rs b/src/gallium/frontends/rusticl/mesa/compiler/nir.rs index 7063b67334c..a7cfb6c8beb 100644 --- a/src/gallium/frontends/rusticl/mesa/compiler/nir.rs +++ b/src/gallium/frontends/rusticl/mesa/compiler/nir.rs @@ -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,