Blender V5.3
device/hip/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_HIP
8
9# include "device/kernel.h"
10
11# ifdef WITH_HIP_DYNLOAD
12# include "hipew.h"
13# endif
14
16
17class HIPDevice;
18
19/* HIP kernel and associate occupancy information. */
20class HIPDeviceKernel {
21 public:
22 hipFunction_t function = nullptr;
23
24 int num_threads_per_block = 0;
25 int min_blocks = 0;
26};
27
28/* Cache of HIP kernels for each DeviceKernel. */
29class HIPDeviceKernels {
30 public:
31 void load_all(HIPDevice *device, hipModule_t hip_module);
32 void load_raytrace(HIPDevice *device, hipModule_t hip_module);
33
34 const HIPDeviceKernel &get(DeviceKernel kernel) const;
35 bool available(DeviceKernel kernel) const;
36
37 protected:
38 bool load_kernel(HIPDevice *device, hipModule_t hip_module, DeviceKernel kernel);
39
40 HIPDeviceKernel kernels_[DEVICE_KERNEL_NUM];
41};
42
44
45#endif /* WITH_HIP */
#define CCL_NAMESPACE_END
DeviceKernel
@ DEVICE_KERNEL_NUM
std::shared_ptr< const T > get(const GenericKey &key, FunctionRef< std::unique_ptr< T >()> compute_fn)