mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-07-31 21:38:39 +00:00
Use raw interop for building programs
This commit is contained in:
parent
407664600a
commit
44decaf396
1 changed files with 20 additions and 2 deletions
|
@ -135,7 +135,7 @@ impl SpirvModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
fn compile_amd1(
|
fn compile_amd(
|
||||||
device_name: &str,
|
device_name: &str,
|
||||||
spirv_il: &[u8],
|
spirv_il: &[u8],
|
||||||
ptx_lib: Option<(&'static [u8], &'static [u8])>,
|
ptx_lib: Option<(&'static [u8], &'static [u8])>,
|
||||||
|
@ -276,7 +276,25 @@ impl SpirvModule {
|
||||||
let ocl_program = if is_amd {
|
let ocl_program = if is_amd {
|
||||||
let binary_prog =
|
let binary_prog =
|
||||||
Self::compile_amd(device_name, byte_il, self.should_link_ptx_impl).unwrap();
|
Self::compile_amd(device_name, byte_il, self.should_link_ptx_impl).unwrap();
|
||||||
ocl_core::create_program_with_binary(ctx, &[dev], &[&binary_prog[..]])?
|
let device = dev.as_raw();
|
||||||
|
let binary_len = binary_prog.len();
|
||||||
|
let binary = binary_prog.as_ptr();
|
||||||
|
let mut binary_status = 0;
|
||||||
|
let mut errcode_ret = 0;
|
||||||
|
let program = unsafe {
|
||||||
|
ocl_core::ffi::clCreateProgramWithBinary(
|
||||||
|
ctx.as_ptr(),
|
||||||
|
1,
|
||||||
|
&device,
|
||||||
|
&binary_len,
|
||||||
|
&binary,
|
||||||
|
&mut binary_status,
|
||||||
|
&mut errcode_ret,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
assert_eq!(binary_status, 0, "clCreateProgramWithBinary");
|
||||||
|
assert_eq!(errcode_ret, 0, "clCreateProgramWithBinary");
|
||||||
|
unsafe { ocl_core::Program::from_raw_create_ptr(program) }
|
||||||
} else {
|
} else {
|
||||||
Self::compile_intel(
|
Self::compile_intel(
|
||||||
ctx,
|
ctx,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue