Blender
V4.5
intern
cycles
util
debug.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
#include <cassert>
8
9
#include "
bvh/params.h
"
10
11
CCL_NAMESPACE_BEGIN
12
13
/* Global storage for all sort of flags used to fine-tune behavior of particular
14
* areas for the development purposes, without officially exposing settings to
15
* the interface.
16
*/
17
class
DebugFlags
{
18
public
:
19
/* Descriptor of CPU feature-set to be used. */
20
struct
CPU
{
21
CPU
();
22
23
/* Reset flags to their defaults. */
24
void
reset
();
25
26
/* Flags describing which instructions sets are allowed for use. */
27
bool
avx2
=
true
;
28
bool
sse42
=
true
;
29
30
/* Check functions to see whether instructions up to the given one
31
* are allowed for use.
32
*/
33
bool
has_avx2
()
34
{
35
return
has_sse42
() &&
avx2
;
36
}
37
bool
has_sse42
()
38
{
39
return
sse42
;
40
}
41
42
/* Requested BVH layout.
43
*
44
* By default the fastest will be used. For debugging the BVH used by other
45
* CPUs and GPUs can be selected here instead.
46
*/
47
BVHLayout
bvh_layout
=
BVH_LAYOUT_AUTO
;
48
};
49
50
/* Descriptor of CUDA feature-set to be used. */
51
struct
CUDA
{
52
CUDA
();
53
54
/* Reset flags to their defaults. */
55
void
reset
();
56
57
/* Whether adaptive feature based runtime compile is enabled or not.
58
* Requires the CUDA Toolkit and only works on Linux at the moment. */
59
bool
adaptive_compile
=
false
;
60
};
61
62
/* Descriptor of HIP feature-set to be used. */
63
struct
HIP
{
64
HIP
();
65
66
/* Reset flags to their defaults. */
67
void
reset
();
68
69
/* Whether adaptive feature based runtime compile is enabled or not. */
70
bool
adaptive_compile
=
false
;
71
};
72
73
/* Descriptor of OptiX feature-set to be used. */
74
struct
OptiX
{
75
OptiX
();
76
77
/* Reset flags to their defaults. */
78
void
reset
();
79
80
/* Load OptiX module with debug capabilities. Will lower logging verbosity level, enable
81
* validations, and lower optimization level. */
82
bool
use_debug
=
false
;
83
};
84
85
/* Descriptor of Metal feature-set to be used. */
86
struct
Metal
{
87
Metal
();
88
89
/* Reset flags to their defaults. */
90
void
reset
();
91
92
/* Whether adaptive feature based runtime compile is enabled or not. */
93
bool
adaptive_compile
=
false
;
94
95
/* Whether local atomic sorting is enabled or not. */
96
bool
use_local_atomic_sort
=
true
;
97
98
/* Whether nanovdb is enabled or not. */
99
bool
use_nanovdb
=
true
;
100
101
/* Whether async PSO creation is enabled or not. */
102
bool
use_async_pso_creation
=
true
;
103
104
/* Whether to use per-component motion interpolation.
105
*/
106
bool
use_metalrt_pcmi
=
true
;
107
};
108
109
/* Get instance of debug flags registry. */
110
static
DebugFlags
&
get
()
111
{
112
static
DebugFlags
instance;
113
return
instance;
114
}
115
116
/* Reset flags to their defaults. */
117
void
reset
();
118
119
/* Requested CPU flags. */
120
CPU
cpu
;
121
122
/* Requested CUDA flags. */
123
CUDA
cuda
;
124
125
/* Requested OptiX flags. */
126
OptiX
optix
;
127
128
/* Requested HIP flags. */
129
HIP
hip
;
130
131
/* Requested Metal flags. */
132
Metal
metal
;
133
134
private
:
135
DebugFlags
() =
default
;
136
137
public
:
138
explicit
DebugFlags
(
const
DebugFlags
&
/*other*/
) =
delete
;
139
void
operator=
(
const
DebugFlags
&
/*other*/
) =
delete
;
140
};
141
142
using
DebugFlagsRef
=
DebugFlags
&;
143
using
DebugFlagsConstRef
=
const
DebugFlags
&;
144
145
inline
DebugFlags
&
DebugFlags
()
146
{
147
return
DebugFlags::get
();
148
}
149
150
CCL_NAMESPACE_END
DebugFlags
Definition
debug.h:17
DebugFlags::get
static DebugFlags & get()
Definition
debug.h:110
DebugFlags::cpu
CPU cpu
Definition
debug.h:120
DebugFlags::reset
void reset()
Definition
debug.cpp:99
DebugFlags::optix
OptiX optix
Definition
debug.h:126
DebugFlags::cuda
CUDA cuda
Definition
debug.h:123
DebugFlags::hip
HIP hip
Definition
debug.h:129
DebugFlags::DebugFlags
DebugFlags(const DebugFlags &)=delete
DebugFlags::operator=
void operator=(const DebugFlags &)=delete
DebugFlags::metal
Metal metal
Definition
debug.h:132
DebugFlags
DebugFlags & DebugFlags()
Definition
debug.h:145
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition
device/cuda/compat.h:10
KernelBVHLayout
KernelBVHLayout
Definition
kernel/types.h:1386
BVH_LAYOUT_AUTO
@ BVH_LAYOUT_AUTO
Definition
kernel/types.h:1405
CCL_NAMESPACE_BEGIN
Definition
python.cpp:37
params.h
DebugFlags::CPU
Definition
debug.h:20
DebugFlags::CPU::CPU
CPU()
Definition
debug.cpp:13
DebugFlags::CPU::has_avx2
bool has_avx2()
Definition
debug.h:33
DebugFlags::CPU::avx2
bool avx2
Definition
debug.h:27
DebugFlags::CPU::sse42
bool sse42
Definition
debug.h:28
DebugFlags::CPU::reset
void reset()
Definition
debug.cpp:18
DebugFlags::CPU::bvh_layout
BVHLayout bvh_layout
Definition
debug.h:47
DebugFlags::CPU::has_sse42
bool has_sse42()
Definition
debug.h:37
DebugFlags::CUDA
Definition
debug.h:51
DebugFlags::CUDA::adaptive_compile
bool adaptive_compile
Definition
debug.h:59
DebugFlags::CUDA::reset
void reset()
Definition
debug.cpp:52
DebugFlags::CUDA::CUDA
CUDA()
Definition
debug.cpp:37
DebugFlags::HIP
Definition
debug.h:63
DebugFlags::HIP::adaptive_compile
bool adaptive_compile
Definition
debug.h:70
DebugFlags::HIP::reset
void reset()
Definition
debug.cpp:59
DebugFlags::HIP::HIP
HIP()
Definition
debug.cpp:42
DebugFlags::Metal
Definition
debug.h:86
DebugFlags::Metal::use_async_pso_creation
bool use_async_pso_creation
Definition
debug.h:102
DebugFlags::Metal::use_metalrt_pcmi
bool use_metalrt_pcmi
Definition
debug.h:106
DebugFlags::Metal::reset
void reset()
Definition
debug.cpp:66
DebugFlags::Metal::Metal
Metal()
Definition
debug.cpp:47
DebugFlags::Metal::adaptive_compile
bool adaptive_compile
Definition
debug.h:93
DebugFlags::Metal::use_nanovdb
bool use_nanovdb
Definition
debug.h:99
DebugFlags::Metal::use_local_atomic_sort
bool use_local_atomic_sort
Definition
debug.h:96
DebugFlags::OptiX
Definition
debug.h:74
DebugFlags::OptiX::OptiX
OptiX()
Definition
debug.cpp:89
DebugFlags::OptiX::use_debug
bool use_debug
Definition
debug.h:82
DebugFlags::OptiX::reset
void reset()
Definition
debug.cpp:94
Generated on Fri Apr 3 2026 06:33:18 for Blender by
doxygen
1.11.0