Blender  V3.3
hip/util.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifdef WITH_HIP
5 
6 # include "device/hip/util.h"
7 # include "device/hip/device_impl.h"
8 
10 
11 HIPContextScope::HIPContextScope(HIPDevice *device) : device(device)
12 {
13  hip_device_assert(device, hipCtxPushCurrent(device->hipContext));
14 }
15 
16 HIPContextScope::~HIPContextScope()
17 {
18  hip_device_assert(device, hipCtxPopCurrent(NULL));
19 }
20 
21 # ifndef WITH_HIP_DYNLOAD
22 const char *hipewErrorString(hipError_t result)
23 {
24  /* We can only give error code here without major code duplication, that
25  * should be enough since dynamic loading is only being disabled by folks
26  * who knows what they're doing anyway.
27  *
28  * NOTE: Avoid call from several threads.
29  */
30  static string error;
31  error = string_printf("%d", result);
32  return error.c_str();
33 }
34 
35 const char *hipewCompilerPath()
36 {
37  return CYCLES_HIP_HIPCC_EXECUTABLE;
38 }
39 
40 int hipewCompilerVersion()
41 {
42  return (HIP_VERSION / 100) + (HIP_VERSION % 100 / 10);
43 }
44 # endif
45 
47 
48 #endif /* WITH_HIP */
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
static void error(const char *str)
Definition: meshlaplacian.c:51
CCL_NAMESPACE_BEGIN string string_printf(const char *format,...)
Definition: string.cpp:22