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

Cc: mesa-stable
Reviewed-by @LingMan

(cherry picked from commit 3a9b1baa80)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33113>
This commit is contained in:
Karol Herbst
2025-01-04 00:21:14 +01:00
committed by Dylan Baker
parent f65e49341b
commit 798cb57680
2 changed files with 16 additions and 3 deletions

View File

@@ -1104,7 +1104,7 @@
"description": "rusticl/kernel: take set kernel arguments into account for CL_KERNEL_LOCAL_MEM_SIZE",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View File

@@ -1713,9 +1713,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 {