MLIR 22.0.0git
RocmRuntimeWrappers.cpp File Reference
#include <cassert>
#include <numeric>
#include "mlir/ExecutionEngine/CRunnerUtils.h"
#include "llvm/ADT/ArrayRef.h"
#include "hip/hip_runtime.h"

Go to the source code of this file.

Macros

#define HIP_REPORT_IF_ERROR(expr)

Functions

hipModule_t mgpuModuleLoad (void *data, size_t)
hipModule_t mgpuModuleLoadJIT (void *data, int optLevel)
void mgpuModuleUnload (hipModule_t module)
hipFunction_t mgpuModuleGetFunction (hipModule_t module, const char *name)
void mgpuLaunchKernel (hipFunction_t function, intptr_t gridX, intptr_t gridY, intptr_t gridZ, intptr_t blockX, intptr_t blockY, intptr_t blockZ, int32_t smem, hipStream_t stream, void **params, void **extra, size_t)
hipStream_t mgpuStreamCreate ()
void mgpuStreamDestroy (hipStream_t stream)
void mgpuStreamSynchronize (hipStream_t stream)
void mgpuStreamWaitEvent (hipStream_t stream, hipEvent_t event)
hipEvent_t mgpuEventCreate ()
void mgpuEventDestroy (hipEvent_t event)
void mgpuEventSynchronize (hipEvent_t event)
void mgpuEventRecord (hipEvent_t event, hipStream_t stream)
voidmgpuMemAlloc (uint64_t sizeBytes, hipStream_t, bool)
void mgpuMemFree (void *ptr, hipStream_t)
void mgpuMemcpy (void *dst, void *src, size_t sizeBytes, hipStream_t stream)
void mgpuMemset32 (void *dst, int value, size_t count, hipStream_t stream)
void mgpuMemset16 (void *dst, int short value, size_t count, hipStream_t stream)
void mgpuMemHostRegister (void *ptr, uint64_t sizeBytes)
 Helper functions for writing mlir example code.
void mgpuMemHostRegisterMemRef (int64_t rank, StridedMemRefType< char, 1 > *descriptor, int64_t elementSizeBytes)
void mgpuMemHostUnregister (void *ptr)
void mgpuMemHostUnregisterMemRef (int64_t rank, StridedMemRefType< char, 1 > *descriptor, int64_t elementSizeBytes)
template<typename T>
void mgpuMemGetDevicePointer (T *hostPtr, T **devicePtr)
StridedMemRefType< float, 1 > mgpuMemGetDeviceMemRef1dFloat (float *allocated, float *aligned, int64_t offset, int64_t size, int64_t stride)
StridedMemRefType< int32_t, 1 > mgpuMemGetDeviceMemRef1dInt32 (int32_t *allocated, int32_t *aligned, int64_t offset, int64_t size, int64_t stride)
void mgpuSetDefaultDevice (int32_t device)

Variables

static thread_local int32_t defaultDevice = 0

Macro Definition Documentation

◆ HIP_REPORT_IF_ERROR

#define HIP_REPORT_IF_ERROR ( expr)

Function Documentation

◆ mgpuEventCreate()

hipEvent_t mgpuEventCreate ( )

Definition at line 89 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuEventDestroy()

void mgpuEventDestroy ( hipEvent_t event)

Definition at line 95 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuEventRecord()

void mgpuEventRecord ( hipEvent_t event,
hipStream_t stream )

Definition at line 103 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuEventSynchronize()

void mgpuEventSynchronize ( hipEvent_t event)

Definition at line 99 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuLaunchKernel()

void mgpuLaunchKernel ( hipFunction_t function,
intptr_t gridX,
intptr_t gridY,
intptr_t gridZ,
intptr_t blockX,
intptr_t blockY,
intptr_t blockZ,
int32_t smem,
hipStream_t stream,
void ** params,
void ** extra,
size_t  )

Definition at line 60 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuMemAlloc()

void * mgpuMemAlloc ( uint64_t sizeBytes,
hipStream_t ,
bool  )

Definition at line 107 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuMemcpy()

void mgpuMemcpy ( void * dst,
void * src,
size_t sizeBytes,
hipStream_t stream )

Definition at line 118 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuMemFree()

void mgpuMemFree ( void * ptr,
hipStream_t  )

Definition at line 114 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuMemGetDeviceMemRef1dFloat()

StridedMemRefType< float, 1 > mgpuMemGetDeviceMemRef1dFloat ( float * allocated,
float * aligned,
int64_t offset,
int64_t size,
int64_t stride )

Definition at line 192 of file RocmRuntimeWrappers.cpp.

References mgpuMemGetDevicePointer().

◆ mgpuMemGetDeviceMemRef1dInt32()

StridedMemRefType< int32_t, 1 > mgpuMemGetDeviceMemRef1dInt32 ( int32_t * allocated,
int32_t * aligned,
int64_t offset,
int64_t size,
int64_t stride )

Definition at line 200 of file RocmRuntimeWrappers.cpp.

References mgpuMemGetDevicePointer().

◆ mgpuMemGetDevicePointer()

template<typename T>
void mgpuMemGetDevicePointer ( T * hostPtr,
T ** devicePtr )

◆ mgpuMemHostRegister()

void mgpuMemHostRegister ( void * ptr,
uint64_t sizeBytes )

Helper functions for writing mlir example code.

Definition at line 140 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

Referenced by mgpuMemHostRegisterMemRef().

◆ mgpuMemHostRegisterMemRef()

void mgpuMemHostRegisterMemRef ( int64_t rank,
StridedMemRefType< char, 1 > * descriptor,
int64_t elementSizeBytes )

◆ mgpuMemHostUnregister()

void mgpuMemHostUnregister ( void * ptr)

Definition at line 170 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

Referenced by mgpuMemHostUnregisterMemRef().

◆ mgpuMemHostUnregisterMemRef()

void mgpuMemHostUnregisterMemRef ( int64_t rank,
StridedMemRefType< char, 1 > * descriptor,
int64_t elementSizeBytes )

◆ mgpuMemset16()

void mgpuMemset16 ( void * dst,
int short value,
size_t count,
hipStream_t stream )

Definition at line 130 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuMemset32()

void mgpuMemset32 ( void * dst,
int value,
size_t count,
hipStream_t stream )

Definition at line 124 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuModuleGetFunction()

hipFunction_t mgpuModuleGetFunction ( hipModule_t module,
const char * name )

Definition at line 50 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuModuleLoad()

hipModule_t mgpuModuleLoad ( void * data,
size_t  )

Definition at line 35 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuModuleLoadJIT()

hipModule_t mgpuModuleLoadJIT ( void * data,
int optLevel )

Definition at line 41 of file RocmRuntimeWrappers.cpp.

◆ mgpuModuleUnload()

void mgpuModuleUnload ( hipModule_t module)

Definition at line 46 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuSetDefaultDevice()

void mgpuSetDefaultDevice ( int32_t device)

Definition at line 207 of file RocmRuntimeWrappers.cpp.

References defaultDevice, and HIP_REPORT_IF_ERROR.

◆ mgpuStreamCreate()

hipStream_t mgpuStreamCreate ( )

Definition at line 71 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuStreamDestroy()

void mgpuStreamDestroy ( hipStream_t stream)

Definition at line 77 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuStreamSynchronize()

void mgpuStreamSynchronize ( hipStream_t stream)

Definition at line 81 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

◆ mgpuStreamWaitEvent()

void mgpuStreamWaitEvent ( hipStream_t stream,
hipEvent_t event )

Definition at line 85 of file RocmRuntimeWrappers.cpp.

References HIP_REPORT_IF_ERROR.

Variable Documentation

◆ defaultDevice

thread_local int32_t defaultDevice = 0
static

Definition at line 33 of file RocmRuntimeWrappers.cpp.