aboutsummaryrefslogtreecommitdiffhomepage
path: root/zluda/src
diff options
context:
space:
mode:
Diffstat (limited to 'zluda/src')
-rw-r--r--zluda/src/impl/memory.rs12
-rw-r--r--zluda/src/impl/mod.rs2
-rw-r--r--zluda/src/lib.rs1
3 files changed, 13 insertions, 2 deletions
diff --git a/zluda/src/impl/memory.rs b/zluda/src/impl/memory.rs
index b23afa9..3843776 100644
--- a/zluda/src/impl/memory.rs
+++ b/zluda/src/impl/memory.rs
@@ -1,7 +1,9 @@
use hip_runtime_sys::*;
pub(crate) fn alloc_v2(dptr: *mut hipDeviceptr_t, bytesize: usize) -> hipError_t {
- unsafe { hipMalloc(dptr.cast(), bytesize) }
+ unsafe { hipMalloc(dptr.cast(), bytesize) }?;
+ // TODO: parametrize for non-Geekbench
+ unsafe { hipMemsetD8(*dptr, 0, bytesize) }
}
pub(crate) fn free_v2(dptr: hipDeviceptr_t) -> hipError_t {
@@ -23,3 +25,11 @@ pub(crate) fn copy_hto_d_v2(
) -> hipError_t {
unsafe { hipMemcpyHtoD(dst_device, src_host.cast_mut(), byte_count) }
}
+
+pub(crate) fn get_address_range_v2(
+ pbase: *mut hipDeviceptr_t,
+ psize: *mut usize,
+ dptr: hipDeviceptr_t,
+) -> hipError_t {
+ unsafe { hipMemGetAddressRange(pbase, psize, dptr) }
+}
diff --git a/zluda/src/impl/mod.rs b/zluda/src/impl/mod.rs
index 7b4afc5..766b4a5 100644
--- a/zluda/src/impl/mod.rs
+++ b/zluda/src/impl/mod.rs
@@ -162,7 +162,7 @@ impl<T: ZludaObject> LiveCheck<T> {
}
fn as_handle(&self) -> T::CudaHandle {
- unsafe { mem::transmute_copy(self) }
+ unsafe { mem::transmute_copy(&self) }
}
fn wrap(data: T) -> *mut Self {
diff --git a/zluda/src/lib.rs b/zluda/src/lib.rs
index bda67e1..1568f47 100644
--- a/zluda/src/lib.rs
+++ b/zluda/src/lib.rs
@@ -71,6 +71,7 @@ cuda_base::cuda_function_declarations!(
cuModuleLoadData,
cuModuleUnload,
cuPointerGetAttribute,
+ cuMemGetAddressRange_v2,
],
implemented_in_function <= [
cuLaunchKernel,