rusticl/kernel: take set kernel arguments into account for CL_KERNEL_LOCAL_MEM_SIZE

Cc: mesa-stable
Reviewed-by @LingMan

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32875>
This commit is contained in:
Karol Herbst
2025-01-04 00:21:14 +01:00
committed by Marge Bot
parent bd1a042046
commit 3a9b1baa80

View File

@@ -1717,9 +1717,22 @@ impl Kernel {
}
pub fn local_mem_size(&self, dev: &Device) -> cl_ulong {
// TODO include args
// TODO: take alignment into account?
// this is purely informational so it shouldn't even matter
self.builds.get(dev).unwrap()[NirKernelVariant::Default].shared_size as cl_ulong
let local =
self.builds.get(dev).unwrap()[NirKernelVariant::Default].shared_size as cl_ulong;
let args: cl_ulong = self
.arg_values()
.iter()
.map(|arg| match arg {
Some(KernelArgValue::LocalMem(val)) => *val as cl_ulong,
// If the local memory size, for any pointer argument to the kernel declared with
// the __local address qualifier, is not specified, its size is assumed to be 0.
_ => 0,
})
.sum();
local + args
}
pub fn has_svm_devs(&self) -> bool {