aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2021-09-17 01:25:34 +0000
committerAndrzej Janik <[email protected]>2021-09-17 01:25:34 +0000
commitc37223fe673f2f45a533e338b74ae9325748588a (patch)
treea075a97808091f4cd3ede5d37ff17e7a7d2931e8
parent62ce1fd3a9138a3dcbf83b6b1c800b3ac6de3e2a (diff)
downloadZLUDA-c37223fe673f2f45a533e338b74ae9325748588a.tar.gz
ZLUDA-c37223fe673f2f45a533e338b74ae9325748588a.zip
Set linking output
-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(())
}