Replace calls to ihipInit with use of HIP_INIT_API macro
Change-Id: Iabf7df79f0238a8ddffea4607fe945df36642850
This commit is contained in:
@@ -466,6 +466,17 @@ inline std::ostream& operator<<(std::ostream& os, const ihipStream_t& s)
|
||||
return os;
|
||||
}
|
||||
|
||||
inline std::ostream & operator<<(std::ostream& os, const dim3& s)
|
||||
{
|
||||
os << '{';
|
||||
os << s.x;
|
||||
os << ',';
|
||||
os << s.y;
|
||||
os << ',';
|
||||
os << s.z;
|
||||
os << '}';
|
||||
return os;
|
||||
}
|
||||
|
||||
//----
|
||||
// Internal event structure:
|
||||
|
||||
@@ -121,7 +121,6 @@ typedef struct dim3 {
|
||||
} dim3;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Memory copy types
|
||||
*
|
||||
|
||||
+6
-6
@@ -61,7 +61,7 @@ hipError_t hipGetDeviceCount(int *count)
|
||||
*/
|
||||
hipError_t hipDeviceSetCacheConfig ( hipFuncCache cacheConfig )
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(cacheConfig);
|
||||
|
||||
// Nop, AMD does not support variable cache configs.
|
||||
|
||||
@@ -75,7 +75,7 @@ hipError_t hipDeviceSetCacheConfig ( hipFuncCache cacheConfig )
|
||||
*/
|
||||
hipError_t hipDeviceGetCacheConfig ( hipFuncCache *cacheConfig )
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(cacheConfig);
|
||||
|
||||
*cacheConfig = hipFuncCachePreferNone;
|
||||
|
||||
@@ -89,7 +89,7 @@ hipError_t hipDeviceGetCacheConfig ( hipFuncCache *cacheConfig )
|
||||
*/
|
||||
hipError_t hipFuncSetCacheConfig ( hipFuncCache cacheConfig )
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(cacheConfig);
|
||||
|
||||
// Nop, AMD does not support variable cache configs.
|
||||
|
||||
@@ -104,7 +104,7 @@ hipError_t hipFuncSetCacheConfig ( hipFuncCache cacheConfig )
|
||||
*/
|
||||
hipError_t hipDeviceSetSharedMemConfig ( hipSharedMemConfig config )
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(config);
|
||||
|
||||
// Nop, AMD does not support variable shared mem configs.
|
||||
|
||||
@@ -119,7 +119,7 @@ hipError_t hipDeviceSetSharedMemConfig ( hipSharedMemConfig config )
|
||||
*/
|
||||
hipError_t hipDeviceGetSharedMemConfig ( hipSharedMemConfig * pConfig )
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(pConfig);
|
||||
|
||||
*pConfig = hipSharedMemBankSizeFourByte;
|
||||
|
||||
@@ -184,7 +184,7 @@ hipError_t hipDeviceReset(void)
|
||||
*/
|
||||
hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(attr, device);
|
||||
|
||||
hipError_t e = hipSuccess;
|
||||
|
||||
|
||||
+5
-5
@@ -69,7 +69,7 @@ hipError_t hipEventCreate(hipEvent_t* event)
|
||||
//---
|
||||
hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(event, stream);
|
||||
|
||||
ihipEvent_t *eh = event._handle;
|
||||
if (eh && eh->_state != hipEventStatusUnitialized) {
|
||||
@@ -104,7 +104,7 @@ hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream)
|
||||
//---
|
||||
hipError_t hipEventDestroy(hipEvent_t event)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(event);
|
||||
|
||||
event._handle->_state = hipEventStatusUnitialized;
|
||||
|
||||
@@ -119,7 +119,7 @@ hipError_t hipEventDestroy(hipEvent_t event)
|
||||
//---
|
||||
hipError_t hipEventSynchronize(hipEvent_t event)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(event);
|
||||
|
||||
ihipEvent_t *eh = event._handle;
|
||||
|
||||
@@ -148,7 +148,7 @@ hipError_t hipEventSynchronize(hipEvent_t event)
|
||||
//---
|
||||
hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(ms, start, stop);
|
||||
|
||||
ihipEvent_t *start_eh = start._handle;
|
||||
ihipEvent_t *stop_eh = stop._handle;
|
||||
@@ -193,7 +193,7 @@ hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop)
|
||||
//---
|
||||
hipError_t hipEventQuery(hipEvent_t event)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(event);
|
||||
|
||||
ihipEvent_t *eh = event._handle;
|
||||
|
||||
|
||||
+8
-8
@@ -1113,7 +1113,7 @@ void decKernelCnt(){
|
||||
// Allows runtime to track some information about the stream.
|
||||
hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, dim3 block, grid_launch_parm *lp)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(stream, grid, block, lp);
|
||||
stream = ihipSyncAndResolveStream(stream);
|
||||
#if USE_GRID_LAUNCH_20
|
||||
lp->grid_dim.x = grid.x;
|
||||
@@ -1143,7 +1143,7 @@ hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, dim3 block, grid_
|
||||
}
|
||||
hipStream_t ihipPreLaunchKernel(hipStream_t stream, size_t grid, dim3 block, grid_launch_parm *lp)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(stream, grid, block, lp);
|
||||
stream = ihipSyncAndResolveStream(stream);
|
||||
#if USE_GRID_LAUNCH_20
|
||||
lp->grid_dim.x = grid;
|
||||
@@ -1174,7 +1174,7 @@ hipStream_t ihipPreLaunchKernel(hipStream_t stream, size_t grid, dim3 block, gri
|
||||
|
||||
hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, size_t block, grid_launch_parm *lp)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(stream, grid, block, lp);
|
||||
stream = ihipSyncAndResolveStream(stream);
|
||||
#if USE_GRID_LAUNCH_20
|
||||
lp->grid_dim.x = grid.x;
|
||||
@@ -1205,7 +1205,7 @@ hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, size_t block, gri
|
||||
|
||||
hipStream_t ihipPreLaunchKernel(hipStream_t stream, size_t grid, size_t block, grid_launch_parm *lp)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(stream, grid, block, lp);
|
||||
stream = ihipSyncAndResolveStream(stream);
|
||||
#if USE_GRID_LAUNCH_20
|
||||
lp->grid_dim.x = grid;
|
||||
@@ -1253,8 +1253,8 @@ void ihipPostLaunchKernel(hipStream_t stream, grid_launch_parm &lp)
|
||||
// HIP API Implementation
|
||||
//
|
||||
// Implementor notes:
|
||||
// _ All functions should call ihipInit as first action:
|
||||
// std::call_once(hip_initialized, ihipInit);
|
||||
// _ All functions should call HIP_INIT_API as first action:
|
||||
// HIP_INIT_API(<function_arguments>);
|
||||
//
|
||||
// - ALl functions should use ihipLogStatus to return error code (not return error directly).
|
||||
//=================================================================================================
|
||||
@@ -1629,7 +1629,7 @@ void ihipStream_t::copyAsync(void* dst, const void* src, size_t sizeBytes, unsig
|
||||
//---
|
||||
hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(deviceId, acc);
|
||||
|
||||
ihipDevice_t *d = ihipGetDevice(deviceId);
|
||||
hipError_t err;
|
||||
@@ -1649,7 +1649,7 @@ hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc)
|
||||
//---
|
||||
hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(stream, av);
|
||||
|
||||
if (stream == hipStreamNull ) {
|
||||
ihipDevice_t *device = ihipGetTlsDefaultDevice();
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ THE SOFTWARE.
|
||||
*/
|
||||
hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(attributes, ptr);
|
||||
|
||||
hipError_t e = hipSuccess;
|
||||
|
||||
@@ -85,7 +85,7 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr)
|
||||
*/
|
||||
hipError_t hipHostGetDevicePointer(void **devicePointer, void *hostPointer, unsigned flags)
|
||||
{
|
||||
std::call_once(hip_initialized, ihipInit);
|
||||
HIP_INIT_API(devicePointer, hostPointer, flags);
|
||||
|
||||
hipError_t e = hipSuccess;
|
||||
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user