aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda/src/impl/link.rs
diff options
context:
space:
mode:
Diffstat (limited to 'zluda/src/impl/link.rs')
-rw-r--r--zluda/src/impl/link.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/zluda/src/impl/link.rs b/zluda/src/impl/link.rs
index 35b156a..d66608f 100644
--- a/zluda/src/impl/link.rs
+++ b/zluda/src/impl/link.rs
@@ -67,11 +67,16 @@ pub(crate) unsafe fn complete(
hip_call! { hipCtxGetDevice(&mut dev) };
let mut props = unsafe { mem::zeroed() };
hip_call! { hipGetDeviceProperties(&mut props, dev) };
- let state: &LinkState = mem::transmute(state);
+ let state: &mut LinkState = mem::transmute(state);
let spirv_bins = state.modules.iter().map(|m| &m.binaries[..]);
let should_link_ptx_impl = state.modules.iter().find_map(|m| m.should_link_ptx_impl);
- let arch_binary = module::compile_amd(&props, spirv_bins, should_link_ptx_impl)
+ let mut arch_binary = module::compile_amd(&props, spirv_bins, should_link_ptx_impl)
.map_err(|_| hipError_t::hipErrorUnknown)?;
+ let ptr = arch_binary.as_mut_ptr();
+ let size = arch_binary.len();
+ state.result = Some(arch_binary);
+ *cubin_out = ptr as _;
+ *size_out = size;
Ok(())
}