MLIR  20.0.0git
Macros | Functions
SyclRuntimeWrappers.cpp File Reference
#include <CL/sycl.hpp>
#include <level_zero/ze_api.h>
#include <sycl/ext/oneapi/backend/level_zero.hpp>

Go to the source code of this file.

Macros

#define SYCL_RUNTIME_EXPORT
 
#define L0_SAFE_CALL(call)
 

Functions

static sycl::device getDefaultDevice ()
 
static sycl::context getDefaultContext ()
 
static void * allocDeviceMemory (sycl::queue *queue, size_t size, bool isShared)
 
static void deallocDeviceMemory (sycl::queue *queue, void *ptr)
 
static ze_module_handle_t loadModule (const void *data, size_t dataSize)
 
static sycl::kernel * getKernel (ze_module_handle_t zeModule, const char *name)
 
static void launchKernel (sycl::queue *queue, sycl::kernel *kernel, size_t gridX, size_t gridY, size_t gridZ, size_t blockX, size_t blockY, size_t blockZ, size_t sharedMemBytes, void **params, size_t paramsCount)
 
SYCL_RUNTIME_EXPORT sycl::queue * mgpuStreamCreate ()
 
SYCL_RUNTIME_EXPORT void mgpuStreamDestroy (sycl::queue *queue)
 
SYCL_RUNTIME_EXPORT void * mgpuMemAlloc (uint64_t size, sycl::queue *queue, bool isShared)
 
SYCL_RUNTIME_EXPORT void mgpuMemFree (void *ptr, sycl::queue *queue)
 
SYCL_RUNTIME_EXPORT ze_module_handle_t mgpuModuleLoad (const void *data, size_t gpuBlobSize)
 
SYCL_RUNTIME_EXPORT sycl::kernel * mgpuModuleGetFunction (ze_module_handle_t module, const char *name)
 
SYCL_RUNTIME_EXPORT void mgpuLaunchKernel (sycl::kernel *kernel, size_t gridX, size_t gridY, size_t gridZ, size_t blockX, size_t blockY, size_t blockZ, size_t sharedMemBytes, sycl::queue *queue, void **params, void **, size_t paramsCount)
 
SYCL_RUNTIME_EXPORT void mgpuStreamSynchronize (sycl::queue *queue)
 
SYCL_RUNTIME_EXPORT void mgpuModuleUnload (ze_module_handle_t module)
 

Macro Definition Documentation

◆ L0_SAFE_CALL

#define L0_SAFE_CALL (   call)
Value:
{ \
ze_result_t status = (call); \
if (status != ZE_RESULT_SUCCESS) { \
fprintf(stdout, "L0 error %d\n", status); \
fflush(stdout); \
abort(); \
} \
}

Definition at line 40 of file SyclRuntimeWrappers.cpp.

◆ SYCL_RUNTIME_EXPORT

#define SYCL_RUNTIME_EXPORT

Definition at line 20 of file SyclRuntimeWrappers.cpp.

Function Documentation

◆ allocDeviceMemory()

static void* allocDeviceMemory ( sycl::queue *  queue,
size_t  size,
bool  isShared 
)
static

Definition at line 77 of file SyclRuntimeWrappers.cpp.

References getDefaultContext(), and getDefaultDevice().

Referenced by mgpuMemAlloc().

◆ deallocDeviceMemory()

static void deallocDeviceMemory ( sycl::queue *  queue,
void *  ptr 
)
static

Definition at line 92 of file SyclRuntimeWrappers.cpp.

Referenced by mgpuMemFree().

◆ getDefaultContext()

static sycl::context getDefaultContext ( )
static

Definition at line 72 of file SyclRuntimeWrappers.cpp.

References getDefaultDevice().

Referenced by allocDeviceMemory(), getKernel(), loadModule(), and mgpuStreamCreate().

◆ getDefaultDevice()

static sycl::device getDefaultDevice ( )
static

◆ getKernel()

static sycl::kernel* getKernel ( ze_module_handle_t  zeModule,
const char *  name 
)
static

Definition at line 114 of file SyclRuntimeWrappers.cpp.

References getDefaultContext(), and L0_SAFE_CALL.

Referenced by mgpuModuleGetFunction().

◆ launchKernel()

static void launchKernel ( sycl::queue *  queue,
sycl::kernel *  kernel,
size_t  gridX,
size_t  gridY,
size_t  gridZ,
size_t  blockX,
size_t  blockY,
size_t  blockZ,
size_t  sharedMemBytes,
void **  params,
size_t  paramsCount 
)
static

Definition at line 132 of file SyclRuntimeWrappers.cpp.

Referenced by mgpuLaunchKernel().

◆ loadModule()

static ze_module_handle_t loadModule ( const void *  data,
size_t  dataSize 
)
static

Definition at line 96 of file SyclRuntimeWrappers.cpp.

References getDefaultContext(), getDefaultDevice(), and L0_SAFE_CALL.

Referenced by mgpuModuleLoad().

◆ mgpuLaunchKernel()

SYCL_RUNTIME_EXPORT void mgpuLaunchKernel ( sycl::kernel *  kernel,
size_t  gridX,
size_t  gridY,
size_t  gridZ,
size_t  blockX,
size_t  blockY,
size_t  blockZ,
size_t  sharedMemBytes,
sycl::queue *  queue,
void **  params,
void **  ,
size_t  paramsCount 
)

Definition at line 190 of file SyclRuntimeWrappers.cpp.

References launchKernel().

◆ mgpuMemAlloc()

SYCL_RUNTIME_EXPORT void* mgpuMemAlloc ( uint64_t  size,
sycl::queue *  queue,
bool  isShared 
)

Definition at line 165 of file SyclRuntimeWrappers.cpp.

References allocDeviceMemory().

◆ mgpuMemFree()

SYCL_RUNTIME_EXPORT void mgpuMemFree ( void *  ptr,
sycl::queue *  queue 
)

Definition at line 171 of file SyclRuntimeWrappers.cpp.

References deallocDeviceMemory().

◆ mgpuModuleGetFunction()

SYCL_RUNTIME_EXPORT sycl::kernel* mgpuModuleGetFunction ( ze_module_handle_t  module,
const char *  name 
)

Definition at line 185 of file SyclRuntimeWrappers.cpp.

References getKernel().

◆ mgpuModuleLoad()

SYCL_RUNTIME_EXPORT ze_module_handle_t mgpuModuleLoad ( const void *  data,
size_t  gpuBlobSize 
)

Definition at line 180 of file SyclRuntimeWrappers.cpp.

References loadModule().

◆ mgpuModuleUnload()

SYCL_RUNTIME_EXPORT void mgpuModuleUnload ( ze_module_handle_t  module)

Definition at line 206 of file SyclRuntimeWrappers.cpp.

References L0_SAFE_CALL.

◆ mgpuStreamCreate()

SYCL_RUNTIME_EXPORT sycl::queue* mgpuStreamCreate ( )

Definition at line 151 of file SyclRuntimeWrappers.cpp.

References getDefaultContext(), and getDefaultDevice().

◆ mgpuStreamDestroy()

SYCL_RUNTIME_EXPORT void mgpuStreamDestroy ( sycl::queue *  queue)

Definition at line 160 of file SyclRuntimeWrappers.cpp.

◆ mgpuStreamSynchronize()

SYCL_RUNTIME_EXPORT void mgpuStreamSynchronize ( sycl::queue *  queue)

Definition at line 200 of file SyclRuntimeWrappers.cpp.