Blender V4.3
kernel/device/oneapi/kernel.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2021-2022 Intel Corporation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#ifdef WITH_ONEAPI
8
9# include <stddef.h>
10
11/* NOTE(@nsirgien): Should match underlying type in the declaration inside "kernel/types.h"
12 * TODO: use kernel/types.h directly. */
13enum DeviceKernel : int;
14
15# ifndef CYCLES_KERNEL_ONEAPI_EXPORT
16# ifdef _WIN32
17# if defined(ONEAPI_EXPORT)
18# define CYCLES_KERNEL_ONEAPI_EXPORT extern __declspec(dllexport)
19# else
20# define CYCLES_KERNEL_ONEAPI_EXPORT extern __declspec(dllimport)
21# endif
22# else
23# define CYCLES_KERNEL_ONEAPI_EXPORT extern __attribute__((visibility("default")))
24# endif
25# endif
26
27class SyclQueue;
28
29typedef void (*OneAPIErrorCallback)(const char *error, void *user_ptr);
30
31struct KernelContext {
32 /* Queue, associated with selected device */
33 SyclQueue *queue;
34 /* Pointer to USM device memory with all global/constant allocation on this device */
35 void *kernel_globals;
36 /* We needs this additional data for some kernels. */
37 int scene_max_shaders;
38};
39
40/* Use extern C linking so that the symbols can be easily load from the dynamic library at runtime.
41 */
42# ifdef __cplusplus
43extern "C" {
44# endif
45
46CYCLES_KERNEL_ONEAPI_EXPORT bool oneapi_run_test_kernel(SyclQueue *queue_);
47CYCLES_KERNEL_ONEAPI_EXPORT bool oneapi_zero_memory_on_device(SyclQueue *queue_,
48 void *device_pointer,
49 size_t num_bytes);
50CYCLES_KERNEL_ONEAPI_EXPORT void oneapi_set_error_cb(OneAPIErrorCallback cb, void *user_ptr);
51CYCLES_KERNEL_ONEAPI_EXPORT size_t oneapi_suggested_gpu_kernel_size(const DeviceKernel kernel);
52CYCLES_KERNEL_ONEAPI_EXPORT bool oneapi_enqueue_kernel(KernelContext *context,
53 int kernel,
54 size_t global_size,
55 size_t local_size,
56 const unsigned int kernel_features,
57 bool use_hardware_raytracing,
58 void **args);
59CYCLES_KERNEL_ONEAPI_EXPORT bool oneapi_load_kernels(SyclQueue *queue,
60 const unsigned int kernel_features,
61 bool use_hardware_raytracing);
62# ifdef __cplusplus
63}
64
65# endif
66#endif /* WITH_ONEAPI */
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
DeviceKernel
static void error(const char *str)