aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2021-09-29 21:49:47 +0000
committerAndrzej Janik <[email protected]>2021-09-29 21:49:47 +0000
commit816365e7df5d0bf6464f7718553d845e72637eff (patch)
treeefe16a5592b22f45584e994fefb5a7bb8b7550f4 /zluda
parent0172dc58e52f2ac1e4d01951002a94a69b3589d0 (diff)
downloadZLUDA-816365e7df5d0bf6464f7718553d845e72637eff.tar.gz
ZLUDA-816365e7df5d0bf6464f7718553d845e72637eff.zip
Fix shared munging pass and add fix cuModuleLoadData
Diffstat (limited to 'zluda')
-rw-r--r--zluda/src/impl/module.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/zluda/src/impl/module.rs b/zluda/src/impl/module.rs
index 9732ec9..24fa88a 100644
--- a/zluda/src/impl/module.rs
+++ b/zluda/src/impl/module.rs
@@ -54,20 +54,16 @@ impl SpirvModule {
}
pub(crate) fn load(module: *mut CUmodule, fname: *const i8) -> Result<(), hipError_t> {
- let length = (0..)
- .position(|i| unsafe { *fname.add(i) == 0 })
- .ok_or(hipError_t::hipErrorInvalidValue)?;
- let file_name = CStr::from_bytes_with_nul(unsafe { slice::from_raw_parts(fname as _, length) })
- .map_err(|_| hipError_t::hipErrorInvalidValue)?;
- let valid_file_name = file_name
+ let file_name = unsafe { CStr::from_ptr(fname) }
.to_str()
.map_err(|_| hipError_t::hipErrorInvalidValue)?;
- let mut file = File::open(valid_file_name).map_err(|_| hipError_t::hipErrorFileNotFound)?;
+ let mut file = File::open(file_name).map_err(|_| hipError_t::hipErrorFileNotFound)?;
let mut file_buffer = Vec::new();
file.read_to_end(&mut file_buffer)
.map_err(|_| hipError_t::hipErrorUnknown)?;
- drop(file);
- load_data(module, file_buffer.as_ptr() as _)
+ let result = load_data(module, file_buffer.as_ptr() as _);
+ drop(file_buffer);
+ result
}
pub(crate) fn load_data(
@@ -201,6 +197,8 @@ pub(crate) fn compile_amd<'a>(
.arg("-nogpulib")
.arg("-mno-wavefrontsize64")
.arg("-O3")
+ .arg("-Xclang")
+ .arg("-O3")
.arg("-Xlinker")
.arg("--no-undefined")
.arg("-target")