aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda_dump/src
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2021-04-12 00:42:35 +0200
committerAndrzej Janik <[email protected]>2021-04-12 00:42:35 +0200
commitfedf88180a5e8e2731e9bf016a39293f137d91fd (patch)
tree3d34e02f28a272ead1121e333f02287d3a9a6a4f /zluda_dump/src
parent96f95d59ce23497f00340c5b7ba6cac41d6de69f (diff)
downloadZLUDA-fedf88180a5e8e2731e9bf016a39293f137d91fd.tar.gz
ZLUDA-fedf88180a5e8e2731e9bf016a39293f137d91fd.zip
Dump all modules, even if not enqueued
Diffstat (limited to 'zluda_dump/src')
-rw-r--r--zluda_dump/src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/zluda_dump/src/lib.rs b/zluda_dump/src/lib.rs
index 7387dcc..768d6f1 100644
--- a/zluda_dump/src/lib.rs
+++ b/zluda_dump/src/lib.rs
@@ -184,6 +184,17 @@ unsafe fn record_module_image(module: CUmodule, image: &str) {
},
);
}
+ if let Err(e) = try_dump_module_image(image) {
+ os_log!("Errors when saving module: {:?}, {}", module, e);
+ }
+}
+
+unsafe fn try_dump_module_image(image: &str) -> Result<(), Box<dyn Error>> {
+ let mut dump_path = get_dump_dir()?;
+ dump_path.push(format!("module_{:04}.ptx", MODULES.as_ref().unwrap().len()));
+ let mut file = File::create(dump_path)?;
+ file.write_all(image.as_bytes())?;
+ Ok(())
}
unsafe fn to_str<T>(image: *const T) -> Option<&'static str> {