Merge branch 'privatestaging' of https://github.com/AMDComputeLibraries/HIP-privatestaging into privatestaging
This commit is contained in:
@@ -55,6 +55,9 @@ hipMemcpyHostToHost
|
||||
#define hipHostAllocMapped cudaHostAllocMapped
|
||||
#define hipHostAllocWriteCombined cudaHostAllocWriteCombined
|
||||
|
||||
#define hipHostRegisterPortable cudaHostRegisterPortable
|
||||
#define hipHostRegisterMapped cudaHostRegisterMapped
|
||||
|
||||
typedef cudaEvent_t hipEvent_t;
|
||||
typedef cudaStream_t hipStream_t;
|
||||
//typedef cudaChannelFormatDesc hipChannelFormatDesc;
|
||||
@@ -132,6 +135,14 @@ inline static hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr){
|
||||
return hipCUDAErrorTohipError(cudaHostGetFlags(flagsPtr, hostPtr));
|
||||
}
|
||||
|
||||
inline static hipError_t hipHostRegister(void* ptr, size_t size, unsigned int flags){
|
||||
return hipCUDAErrorTohipError(cudaHostRegister(ptr, size, flags));
|
||||
}
|
||||
|
||||
inline static hipError_t hipHostUnregister(void* ptr){
|
||||
return hipCUDAErrorTohipError(cudaHostUnregister(ptr));
|
||||
}
|
||||
|
||||
inline static hipError_t hipFreeHost(void* ptr) {
|
||||
return hipCUDAErrorTohipError(cudaFreeHost(ptr));
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ make_hip_executable (hipMultiThreadStreams2 hipMultiThreadStreams2.cpp)
|
||||
make_hip_executable (hipHostAlloc hipHostAlloc.cpp)
|
||||
make_hip_executable (hipStreamL5 hipStreamL5.cpp)
|
||||
make_hip_executable (hipHostGetFlags hipHostGetFlags.cpp)
|
||||
make_hip_executable (hipHostRegister hipHostRegister.cpp)
|
||||
target_link_libraries(hipMathFunctionsHost m)
|
||||
|
||||
make_test(hip_ballot " " )
|
||||
@@ -152,7 +153,7 @@ make_test(hipMemcpy " " )
|
||||
make_test(hipMemcpyAsync " " )
|
||||
make_test(hipHostGetFlags " ")
|
||||
make_test(hipHcc " " )
|
||||
|
||||
make_test(hipHostRegister " ")
|
||||
make_test(hipStreamL5 " ")
|
||||
|
||||
make_hipify_test(specialFunc.cu )
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#include"test_common.h"
|
||||
|
||||
__global__ void Inc(hipLaunchParm lp, float *Ad){
|
||||
int tx = hipThreadIdx_x + hipBlockIdx_x * hipBlockDim_x;
|
||||
Ad[tx] = Ad[tx] + float(1);
|
||||
}
|
||||
|
||||
int main(){
|
||||
float *A, *Ad;
|
||||
const size_t size = N * sizeof(float);
|
||||
A = (float*)malloc(size);
|
||||
HIPCHECK(hipHostRegister(A, size, 0));
|
||||
|
||||
for(int i=0;i<N;i++){
|
||||
A[i] = float(1);
|
||||
}
|
||||
|
||||
HIPCHECK(hipMalloc(&Ad, size));
|
||||
|
||||
HIPCHECK(hipMemcpy(Ad, A, size, hipMemcpyHostToDevice));
|
||||
|
||||
hipLaunchKernel(HIP_KERNEL_NAME(Inc), dim3(N/512), dim3(512), 0, 0, Ad);
|
||||
HIPCHECK(hipDeviceSynchronize());
|
||||
|
||||
HIPCHECK(hipMemcpy(A, Ad, size, hipMemcpyDeviceToHost));
|
||||
|
||||
HIPASSERT(A[10] == 2.0f);
|
||||
HIPCHECK(hipHostUnregister(A));
|
||||
passed();
|
||||
}
|
||||
Reference in New Issue
Block a user