Blender V4.3
device/cuda/kernel.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#ifdef WITH_CUDA
8
9# include "device/kernel.h"
10
11# ifdef WITH_CUDA_DYNLOAD
12# include "cuew.h"
13# else
14# include <cuda.h>
15# endif
16
18
19class CUDADevice;
20
21/* CUDA kernel and associate occupancy information. */
22class CUDADeviceKernel {
23 public:
24 CUfunction function = nullptr;
25
26 int num_threads_per_block = 0;
27 int min_blocks = 0;
28};
29
30/* Cache of CUDA kernels for each DeviceKernel. */
31class CUDADeviceKernels {
32 public:
33 void load(CUDADevice *device);
34 const CUDADeviceKernel &get(DeviceKernel kernel) const;
35 bool available(DeviceKernel kernel) const;
36
37 protected:
38 CUDADeviceKernel kernels_[DEVICE_KERNEL_NUM];
39 bool loaded = false;
40};
41
43
44#endif /* WITH_CUDA */
#define CCL_NAMESPACE_END
DeviceKernel
@ DEVICE_KERNEL_NUM
void load(const VolumeGridData &grid)
std::shared_ptr< const T > get(const GenericKey &key, FunctionRef< std::unique_ptr< T >()> compute_fn)