Blender V4.3
hip/util.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/util.h"
9
11
12HIPContextScope::HIPContextScope(HIPDevice *device) : device(device)
13{
14 hip_device_assert(device, hipCtxPushCurrent(device->hipContext));
15}
16
17HIPContextScope::~HIPContextScope()
18{
19 hip_device_assert(device, hipCtxPopCurrent(NULL));
20}
21
22# ifndef WITH_HIP_DYNLOAD
23const char *hipewErrorString(hipError_t result)
24{
25 /* We can only give error code here without major code duplication, that
26 * should be enough since dynamic loading is only being disabled by folks
27 * who knows what they're doing anyway.
28 *
29 * NOTE: Avoid call from several threads.
30 */
31 static string error;
32 error = string_printf("%d", result);
33 return error.c_str();
34}
35
36const char *hipewCompilerPath()
37{
38 return CYCLES_HIP_HIPCC_EXECUTABLE;
39}
40
41int hipewCompilerVersion()
42{
43 return (HIP_VERSION / 100) + (HIP_VERSION % 100 / 10);
44}
45# endif
46
48
49#endif /* WITH_HIP */
#define CCL_NAMESPACE_END
#define NULL
static void error(const char *str)
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
Definition string.cpp:23