rusticl/kernel: fix clGetKernelInfo CL_KERNEL_ATTRIBUTES for non source programs

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19008>
This commit is contained in:
Karol Herbst 2023-02-13 12:04:10 +01:00 committed by Marge Bot
parent 771f7c1d91
commit 2a0b58434d
2 changed files with 12 additions and 1 deletions

View file

@ -803,7 +803,14 @@ fn convert_spirv_to_nir(
assert!(attributes_string_set.len() == 1);
let args = args_set.into_iter().next().unwrap();
let internal_args = internal_args_set.into_iter().next().unwrap();
let attributes_string = attributes_string_set.into_iter().next().unwrap();
// spec: For kernels not created from OpenCL C source and the clCreateProgramWithSource API call
// the string returned from this query [CL_KERNEL_ATTRIBUTES] will be empty.
let attributes_string = if p.is_src() {
attributes_string_set.into_iter().next().unwrap()
} else {
String::new()
};
(nirs, args, internal_args, attributes_string)
}

View file

@ -591,4 +591,8 @@ impl Program {
pub fn is_binary(&self) -> bool {
self.src.to_bytes().is_empty() && self.il.is_empty()
}
pub fn is_src(&self) -> bool {
!self.src.to_bytes().is_empty()
}
}