Blender V4.3
device/hip/kernel.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#ifdef WITH_HIP
6
7# include "device/hip/kernel.h"
9
11
12void HIPDeviceKernels::load(HIPDevice *device)
13{
14 hipModule_t hipModule = device->hipModule;
15
16 for (int i = 0; i < (int)DEVICE_KERNEL_NUM; i++) {
17 HIPDeviceKernel &kernel = kernels_[i];
18
19 /* No mega-kernel used for GPU. */
21 continue;
22 }
23
24 const std::string function_name = std::string("kernel_gpu_") +
26 hip_device_assert(device,
27 hipModuleGetFunction(&kernel.function, hipModule, function_name.c_str()));
28
29 if (kernel.function) {
30 hip_device_assert(device, hipFuncSetCacheConfig(kernel.function, hipFuncCachePreferL1));
31
32 hip_device_assert(
33 device,
34 hipModuleOccupancyMaxPotentialBlockSize(
35 &kernel.min_blocks, &kernel.num_threads_per_block, kernel.function, 0, 0));
36 }
37 else {
38 LOG(ERROR) << "Unable to load kernel " << function_name;
39 }
40 }
41
42 loaded = true;
43}
44
45const HIPDeviceKernel &HIPDeviceKernels::get(DeviceKernel kernel) const
46{
47 return kernels_[(int)kernel];
48}
49
50bool HIPDeviceKernels::available(DeviceKernel kernel) const
51{
52 return kernels_[(int)kernel].function != nullptr;
53}
54
56
57#endif /* WITH_HIP */
#define CCL_NAMESPACE_END
const char * device_kernel_as_string(DeviceKernel kernel)
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
@ DEVICE_KERNEL_INTEGRATOR_MEGAKERNEL
@ DEVICE_KERNEL_NUM
#define LOG(severity)
Definition log.h:33