|
MLIR 23.0.0git
|
#include "mlir/ExecutionEngine/CRunnerUtils.h"#include <cstdio>#include "cuda.h"#include "cuda_bf16.h"#include "cuda_fp16.h"Go to the source code of this file.
Classes | |
| class | ScopedContext |
Macros | |
| #define | MLIR_CUDA_WRAPPERS_EXPORT __attribute__((visibility("default"))) |
| #define | CUDA_REPORT_IF_ERROR(expr) |
| #define | CUSPARSE_REPORT_IF_ERROR(expr) |
| #define | debug_print(fmt, ...) |
Variables | |
| static thread_local int32_t | defaultDevice = 0 |
| #define CUDA_REPORT_IF_ERROR | ( | expr | ) |
Definition at line 37 of file CudaRuntimeWrappers.cpp.
Referenced by getDefaultCuDevice(), mgpuEventCreate(), mgpuEventDestroy(), mgpuEventRecord(), mgpuEventSynchronize(), mgpuLaunchKernel(), mgpuMemAlloc(), mgpuMemcpy(), mgpuMemFree(), mgpuMemHostRegister(), mgpuMemHostUnregister(), mgpuMemset16(), mgpuMemset32(), mgpuModuleGetFunction(), mgpuModuleLoad(), mgpuModuleLoadJIT(), mgpuModuleUnload(), mgpuStreamCreate(), mgpuStreamDestroy(), mgpuStreamSynchronize(), mgpuStreamWaitEvent(), ScopedContext::ScopedContext(), and ScopedContext::~ScopedContext().
| #define CUSPARSE_REPORT_IF_ERROR | ( | expr | ) |
Definition at line 48 of file CudaRuntimeWrappers.cpp.
| #define debug_print | ( | fmt, | |
| ... ) |
Definition at line 66 of file CudaRuntimeWrappers.cpp.
Referenced by mgpuLaunchKernel().
| #define MLIR_CUDA_WRAPPERS_EXPORT __attribute__((visibility("default"))) |
Definition at line 34 of file CudaRuntimeWrappers.cpp.
Referenced by mgpuEventCreate(), mgpuEventDestroy(), mgpuEventRecord(), mgpuEventSynchronize(), mgpuMemFree(), mgpuMemHostUnregister(), mgpuModuleUnload(), mgpuSetDefaultDevice(), mgpuStreamCreate(), mgpuStreamDestroy(), and mgpuStreamWaitEvent().
|
static |
Definition at line 74 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and defaultDevice.
Referenced by mgpuLaunchKernel(), and ScopedContext::ScopedContext().
|
static |
Helper method that checks environment value for debugging.
Definition at line 60 of file CudaRuntimeWrappers.cpp.
| MLIR_CUDA_WRAPPERS_EXPORT CUevent mgpuEventCreate | ( | ) |
Definition at line 219 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuEventDestroy | ( | CUevent | event | ) |
Definition at line 226 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuEventRecord | ( | CUevent | event, |
| CUstream | stream ) |
Definition at line 234 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuEventSynchronize | ( | CUevent | event | ) |
Definition at line 230 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuLaunchKernel | ( | CUfunction | function, |
| intptr_t | gridX, | ||
| intptr_t | gridY, | ||
| intptr_t | gridZ, | ||
| intptr_t | blockX, | ||
| intptr_t | blockY, | ||
| intptr_t | blockZ, | ||
| int32_t | smem, | ||
| CUstream | stream, | ||
| void ** | params, | ||
| void ** | extra, | ||
| size_t | ) |
Definition at line 167 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, debug_print, defaultDevice, and getDefaultCuDevice().
| MLIR_CUDA_WRAPPERS_EXPORT void * mgpuMemAlloc | ( | uint64_t | sizeBytes, |
| CUstream | stream, | ||
| bool | isHostShared ) |
Definition at line 240 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuMemcpy | ( | void * | dst, |
| void * | src, | ||
| size_t | sizeBytes, | ||
| CUstream | stream ) |
Definition at line 261 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuMemFree | ( | void * | ptr, |
| CUstream | ) |
Definition at line 255 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuMemHostRegister | ( | void * | ptr, |
| uint64_t | sizeBytes ) |
Helper functions for writing mlir example code.
Definition at line 286 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR.
Referenced by mgpuMemHostRegisterMemRef().
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuMemHostRegisterMemRef | ( | int64_t | rank, |
| StridedMemRefType< char, 1 > * | descriptor, | ||
| int64_t | elementSizeBytes ) |
Registers a memref with the CUDA runtime.
descriptor is a pointer to a ranked memref descriptor struct of rank rank. Helpful until we have transfer functions implemented.
Definition at line 295 of file CudaRuntimeWrappers.cpp.
References StridedMemRefType< T, N >::data, mgpuMemHostRegister(), StridedMemRefType< T, N >::offset, and StridedMemRefType< T, N >::sizes.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuMemHostUnregister | ( | void * | ptr | ) |
Definition at line 320 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
Referenced by mgpuMemHostUnregisterMemRef().
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuMemHostUnregisterMemRef | ( | int64_t | rank, |
| StridedMemRefType< char, 1 > * | descriptor, | ||
| int64_t | elementSizeBytes ) |
Unregisters a memref with the CUDA runtime.
descriptor is a pointer to a ranked memref descriptor struct of rank rank
Definition at line 328 of file CudaRuntimeWrappers.cpp.
References StridedMemRefType< T, N >::data, mgpuMemHostUnregister(), and StridedMemRefType< T, N >::offset.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuMemset16 | ( | void * | dst, |
| unsigned short | value, | ||
| size_t | count, | ||
| CUstream | stream ) |
Definition at line 274 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuMemset32 | ( | void * | dst, |
| unsigned int | value, | ||
| size_t | count, | ||
| CUstream | stream ) |
Definition at line 268 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR.
| MLIR_CUDA_WRAPPERS_EXPORT CUfunction mgpuModuleGetFunction | ( | CUmodule | module, |
| const char * | name ) |
Definition at line 157 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR.
| MLIR_CUDA_WRAPPERS_EXPORT CUmodule mgpuModuleLoad | ( | void * | data, |
| size_t | ) |
Definition at line 120 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR.
| MLIR_CUDA_WRAPPERS_EXPORT CUmodule mgpuModuleLoadJIT | ( | void * | data, |
| int | optLevel, | ||
| size_t | ) |
Definition at line 128 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and result.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuModuleUnload | ( | CUmodule | module | ) |
Definition at line 148 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, MLIR_CUDA_WRAPPERS_EXPORT, and result.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuSetDefaultDevice | ( | int32_t | device | ) |
Definition at line 335 of file CudaRuntimeWrappers.cpp.
References defaultDevice, and MLIR_CUDA_WRAPPERS_EXPORT.
| MLIR_CUDA_WRAPPERS_EXPORT CUstream mgpuStreamCreate | ( | ) |
Definition at line 198 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuStreamDestroy | ( | CUstream | stream | ) |
Definition at line 205 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuStreamSynchronize | ( | CUstream | stream | ) |
Definition at line 210 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR.
| MLIR_CUDA_WRAPPERS_EXPORT void mgpuStreamWaitEvent | ( | CUstream | stream, |
| CUevent | event ) |
Definition at line 214 of file CudaRuntimeWrappers.cpp.
References CUDA_REPORT_IF_ERROR, and MLIR_CUDA_WRAPPERS_EXPORT.
|
static |
Definition at line 57 of file CudaRuntimeWrappers.cpp.
Referenced by getDefaultCuDevice(), mgpuLaunchKernel(), and mgpuSetDefaultDevice().