Conflicts:
	src/hip_hcc.cpp
	tests/src/CMakeLists.txt
Этот коммит содержится в:
Ben Sander
2016-03-14 15:01:26 -05:00
родитель 1a27e5134e 102f173396
Коммит e1617b9604
35 изменённых файлов: 764 добавлений и 100 удалений
+59 -2
Просмотреть файл
@@ -56,6 +56,16 @@ extern "C" {
#define hipEventInterprocess 0x4 ///< Event can support IPC. @warning - not supported in HIP.
#define hipHostAllocDefault 0x0
#define hipHostAllocPortable 0x1
#define hipHostAllocMapped 0x2
#define hipHostAllocWriteCombined 0x4
#define hipHostRegisterDefault 0x0
#define hipHostRegisterPortable 0x1
#define hipHostRegisterMapped 0x2
#define hipHostRegisterIoMemory 0x4
/**
* @warning On AMD devices and recent Nvidia devices, these hints and controls are ignored.
*/
@@ -247,9 +257,9 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
* @param [out] prop written with device properties
* @param [in] device which device to query for information
*
* Populates hipDeviceGetProperties with information for the specified device.
* Populates hipGetDeviceProperties with information for the specified device.
*/
hipError_t hipDeviceGetProperties(hipDeviceProp_t* prop, int device);
hipError_t hipGetDeviceProperties(hipDeviceProp_t* prop, int device);
@@ -662,6 +672,53 @@ hipError_t hipMalloc(void** ptr, size_t size) ;
*/
hipError_t hipMallocHost(void** ptr, size_t size) ;
/**
* @brief Allocate device accessible page locked host memory
*
* @param[out] ptr Pointer to the allocated host pinned memory
* @param[in] size Requested memory size
* @param[in] flags Type of host memory allocation
* @return Error code
*/
hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags) ;
/**
* @brief Get Device pointer from Host Pointer allocated through hipHostAlloc
*
* @param[out] dstPtr Device Pointer mapped to passed host pointer
* @param[in] hstPtr Host Pointer allocated through hipHostAlloc
* @param[in] size Requested memory size
* @return Error code
*/
hipError_t hipHostGetDevicePointer(void** devPtr, void* hstPtr, size_t size) ;
/**
* @brief Get flags associated with host pointer
*
* @param[out] flagsPtr Memory location to store flags
* @param[in] hostPtr Host Pointer allocated through hipHostAlloc
* @return Error code
*/
hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr) ;
/**
* @brief Pin host memory
*
* @param[out] hostPtr Pointer to host memory to be pinned
* @param[in] sizeBytes size of the host memory
* @param[in] flags Type of pinning the the host memory
* @return Error code
*/
hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags) ;
/**
* @brief Un-pin host pointer
*
* @param[in] hostPtr Pinned Host Pointer
* @return Error code
*/
hipError_t hipHostUnregister(void* hostPtr) ;
/**
* @brief Free memory allocated by the hcc hip memory allocation API.
+1
Просмотреть файл
@@ -97,6 +97,7 @@ typedef struct hipDeviceProp_t {
int pciDeviceID; ///< PCI Device ID.
size_t maxSharedMemoryPerMultiProcessor; ///< Maximum Shared Memory Per Multiprocessor.
int isMultiGpuBoard; ///< 1 if device is on a multi-GPU board, 0 if not.
int canMapHostMemory; ///< Check whether HIP can map host memory
} hipDeviceProp_t;
+30 -1
Просмотреть файл
@@ -50,6 +50,13 @@ hipMemcpyHostToHost
} hipTextureFilterMode;*/
#define hipFilterModePoint cudaFilterModePoint
#define hipHostAllocDefault cudaHostAllocDefault
#define hipHostAllocPortable cudaHostAllocPortable
#define hipHostAllocMapped cudaHostAllocMapped
#define hipHostAllocWriteCombined cudaHostAllocWriteCombined
#define hipHostRegisterPortable cudaHostRegisterPortable
#define hipHostRegisterMapped cudaHostRegisterMapped
typedef cudaEvent_t hipEvent_t;
typedef cudaStream_t hipStream_t;
@@ -115,6 +122,27 @@ inline static hipError_t hipFree(void* ptr) {
inline static hipError_t hipMallocHost(void** ptr, size_t size) {
return hipCUDAErrorTohipError(cudaMallocHost(ptr, size));
}
inline static hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags){
return hipCUDAErrorTohipError(cudaHostAlloc(ptr, size, flags));
}
inline static hipError_t hipHostGetDevicePointer(void** devPtr, void* hostPtr, unsigned int flags){
return hipCUDAErrorTohipError(cudaHostGetDevicePointer(devPtr, hostPtr, flags));
}
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));
}
@@ -154,7 +182,7 @@ inline static hipError_t hipMemset(void* devPtr,int value, size_t count) {
return hipCUDAErrorTohipError(cudaMemset(devPtr, value, count));
}
inline static hipError_t hipDeviceGetProperties(hipDeviceProp_t *p_prop, int device)
inline static hipError_t hipGetDeviceProperties(hipDeviceProp_t *p_prop, int device)
{
cudaDeviceProp cdprop;
cudaError_t cerror;
@@ -177,6 +205,7 @@ inline static hipError_t hipDeviceGetProperties(hipDeviceProp_t *p_prop, int dev
p_prop->l2CacheSize = cdprop.l2CacheSize ;
p_prop->maxThreadsPerMultiProcessor = cdprop.maxThreadsPerMultiProcessor ;
p_prop->computeMode = cdprop.computeMode ;
p_prop->canMapHostMemory = cdprop.canMapHostMemory;
// Same as clock-rate:
p_prop->clockInstructionRate = cdprop.clockRate;