mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-03 06:40:21 +00:00
Fix more missing stuff in the host code
This commit is contained in:
parent
502b0c957e
commit
1f1b770a51
5 changed files with 17 additions and 6 deletions
Binary file not shown.
|
@ -25,16 +25,16 @@ extern "C"
|
||||||
return (uint32_t)__ockl_get_local_size(member);
|
return (uint32_t)__ockl_get_local_size(member);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t __ockl_get_global_id(uint32_t) __device__;
|
size_t __ockl_get_group_id(uint32_t) __device__;
|
||||||
uint32_t FUNC(sreg_ctaid)(uint8_t member)
|
uint32_t FUNC(sreg_ctaid)(uint8_t member)
|
||||||
{
|
{
|
||||||
return (uint32_t)__ockl_get_global_id(member);
|
return (uint32_t)__ockl_get_group_id(member);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t __ockl_get_global_size(uint32_t) __device__;
|
size_t __ockl_get_num_groups(uint32_t) __device__;
|
||||||
uint32_t FUNC(sreg_nctaid)(uint8_t member)
|
uint32_t FUNC(sreg_nctaid)(uint8_t member)
|
||||||
{
|
{
|
||||||
return (uint32_t)__ockl_get_global_size(member);
|
return (uint32_t)__ockl_get_num_groups(member);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t __ockl_bfe_u32(uint32_t, uint32_t, uint32_t) __attribute__((device));
|
uint32_t __ockl_bfe_u32(uint32_t, uint32_t, uint32_t) __attribute__((device));
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use hip_runtime_sys::*;
|
use hip_runtime_sys::*;
|
||||||
|
|
||||||
pub(crate) fn alloc_v2(dptr: *mut hipDeviceptr_t, bytesize: usize) -> hipError_t {
|
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 {
|
pub(crate) fn free_v2(dptr: hipDeviceptr_t) -> hipError_t {
|
||||||
|
@ -23,3 +25,11 @@ pub(crate) fn copy_hto_d_v2(
|
||||||
) -> hipError_t {
|
) -> hipError_t {
|
||||||
unsafe { hipMemcpyHtoD(dst_device, src_host.cast_mut(), byte_count) }
|
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) }
|
||||||
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ impl<T: ZludaObject> LiveCheck<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_handle(&self) -> T::CudaHandle {
|
fn as_handle(&self) -> T::CudaHandle {
|
||||||
unsafe { mem::transmute_copy(self) }
|
unsafe { mem::transmute_copy(&self) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wrap(data: T) -> *mut Self {
|
fn wrap(data: T) -> *mut Self {
|
||||||
|
|
|
@ -71,6 +71,7 @@ cuda_base::cuda_function_declarations!(
|
||||||
cuModuleLoadData,
|
cuModuleLoadData,
|
||||||
cuModuleUnload,
|
cuModuleUnload,
|
||||||
cuPointerGetAttribute,
|
cuPointerGetAttribute,
|
||||||
|
cuMemGetAddressRange_v2,
|
||||||
],
|
],
|
||||||
implemented_in_function <= [
|
implemented_in_function <= [
|
||||||
cuLaunchKernel,
|
cuLaunchKernel,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue