Blender  V3.3
kernel/device/oneapi/kernel.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2021-2022 Intel Corporation */
3 
4 #pragma once
5 
6 #ifdef WITH_ONEAPI
7 
8 # include <stddef.h>
9 
10 /* NOTE(@nsirgien): Should match underlying type in the declaration inside "kernel/types.h"
11  * TODO: use kernel/types.h directly. */
12 enum DeviceKernel : int;
13 
14 # ifndef CYCLES_KERNEL_ONEAPI_EXPORT
15 # ifdef _WIN32
16 # if defined(ONEAPI_EXPORT)
17 # define CYCLES_KERNEL_ONEAPI_EXPORT extern __declspec(dllexport)
18 # else
19 # define CYCLES_KERNEL_ONEAPI_EXPORT extern __declspec(dllimport)
20 # endif
21 # else
22 # define CYCLES_KERNEL_ONEAPI_EXPORT
23 # endif
24 # endif
25 
26 class SyclQueue;
27 
28 typedef void (*OneAPIDeviceIteratorCallback)(const char *id,
29  const char *name,
30  int num,
31  void *user_ptr);
32 
33 typedef void (*OneAPIErrorCallback)(const char *error, void *user_ptr);
34 
35 struct KernelContext {
36  /* Queue, associated with selected device */
37  SyclQueue *queue;
38  /* Pointer to USM device memory with all global/constant allocation on this device */
39  void *kernel_globals;
40 };
41 
42 /* Use extern C linking so that the symbols can be easily load from the dynamic library at runtime.
43  */
44 # ifdef __cplusplus
45 extern "C" {
46 # endif
47 
48 # define DLL_INTERFACE_CALL(function, return_type, ...) \
49  CYCLES_KERNEL_ONEAPI_EXPORT return_type function(__VA_ARGS__);
51 # undef DLL_INTERFACE_CALL
52 
53 # ifdef __cplusplus
54 }
55 # endif
56 
57 #endif /* WITH_ONEAPI */
SyclQueue * queue
SyclQueue void void size_t num_bytes void
SyclQueue void void size_t num_bytes SyclQueue void * kernel_globals
DeviceKernel
static void error(const char *str)
Definition: meshlaplacian.c:51