mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 16:50:10 +01:00
rusticl/program: implement CL_INVALID_PROGRAM_EXECUTABLE check in clGetProgramInfo
Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33892>
This commit is contained in:
parent
ee787b64ed
commit
b2f3933c8d
2 changed files with 26 additions and 0 deletions
|
|
@ -25,6 +25,22 @@ use std::sync::Arc;
|
|||
unsafe impl CLInfo<cl_program_info> for cl_program {
|
||||
fn query(&self, q: cl_program_info, v: CLInfoValue) -> CLResult<CLInfoRes> {
|
||||
let prog = Program::ref_from_raw(*self)?;
|
||||
|
||||
// CL_INVALID_PROGRAM_EXECUTABLE if param_name is CL_PROGRAM_NUM_KERNELS,
|
||||
// CL_PROGRAM_KERNEL_NAMES, CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT, or
|
||||
// CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT and a successful program executable has not been
|
||||
// built for at least one device in the list of devices associated with program.
|
||||
if matches!(
|
||||
q,
|
||||
CL_PROGRAM_NUM_KERNELS
|
||||
| CL_PROGRAM_KERNEL_NAMES
|
||||
| CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT
|
||||
| CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT
|
||||
) && !prog.build_info().has_successful_build()
|
||||
{
|
||||
return Err(CL_INVALID_PROGRAM_EXECUTABLE);
|
||||
}
|
||||
|
||||
match q {
|
||||
CL_PROGRAM_BINARIES => {
|
||||
let input = v.input::<*mut u8>()?;
|
||||
|
|
|
|||
|
|
@ -219,6 +219,10 @@ impl ProgramBuild {
|
|||
|
||||
nir.unwrap()
|
||||
}
|
||||
|
||||
pub fn has_successful_build(&self) -> bool {
|
||||
self.builds.values().any(|b| b.is_success())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -231,6 +235,12 @@ pub struct ProgramDevBuild {
|
|||
pub kernels: HashMap<String, Arc<NirKernelBuilds>>,
|
||||
}
|
||||
|
||||
impl ProgramDevBuild {
|
||||
fn is_success(&self) -> bool {
|
||||
self.status == CL_BUILD_SUCCESS as cl_build_status
|
||||
}
|
||||
}
|
||||
|
||||
fn prepare_options(options: &str, dev: &Device) -> Vec<CString> {
|
||||
let mut options = options.to_owned();
|
||||
if !options.contains("-cl-std=") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue