diff options
author | Andrzej Janik <[email protected]> | 2021-08-07 18:10:53 +0200 |
---|---|---|
committer | Andrzej Janik <[email protected]> | 2021-08-07 18:10:53 +0200 |
commit | 4b4ba902192f5655eaa012eb7a2f985129ab8167 (patch) | |
tree | a6f7ed3f9cdf21f007391d75fa92b77ed0c3629d | |
parent | 44decaf396e70051aa9c49b94d9db84c11b60084 (diff) | |
download | ZLUDA-4b4ba902192f5655eaa012eb7a2f985129ab8167.tar.gz ZLUDA-4b4ba902192f5655eaa012eb7a2f985129ab8167.zip |
Persist AMD kernels for later debug
-rw-r--r-- | zluda/src/impl/module.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/zluda/src/impl/module.rs b/zluda/src/impl/module.rs index 54acb14..c13f987 100644 --- a/zluda/src/impl/module.rs +++ b/zluda/src/impl/module.rs @@ -182,7 +182,7 @@ impl SpirvModule { let status = linker_cmd.status()?; assert!(status.success()); let mut ptx_lib_bitcode = NamedTempFile::new_in(&dir)?; - let mut compiled_binary = NamedTempFile::new_in(&dir)?; + let compiled_binary = NamedTempFile::new_in(&dir)?; let mut cland_exe = PathBuf::from(Self::AMDGPU); cland_exe.push("bin"); cland_exe.push("clang"); @@ -207,8 +207,12 @@ impl SpirvModule { let status = compiler_cmd.status()?; assert!(status.success()); let mut result = Vec::new(); - let mut compiled_binary = File::open(compiled_binary.path())?; + let compiled_bin_path = compiled_binary.path(); + let mut compiled_binary = File::open(compiled_bin_path)?; compiled_binary.read_to_end(&mut result)?; + let mut persistent = PathBuf::from("/tmp/zluda"); + persistent.push(compiled_bin_path.file_name().unwrap()); + std::fs::copy(compiled_bin_path, persistent)?; Ok(result) } |