Blender V4.3
device/cpu/compat.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/* Release kernel has too much false-positive maybe-uninitialized warnings,
8 * which makes it possible to miss actual warnings.
9 */
10#if (defined(__GNUC__) && !defined(__clang__)) && defined(NDEBUG)
11# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
12# pragma GCC diagnostic ignored "-Wuninitialized"
13#endif
14
15#include "util/half.h"
16#include "util/math.h"
17#include "util/simd.h"
18#include "util/texture.h"
19#include "util/types.h"
20
21/* On x86_64, versions of GLIBC < 2.16 have an issue where `expf` is
22 * much slower than the double version. This was fixed in GLIBC 2.16. */
23#if !defined(__KERNEL_GPU__) && defined(__x86_64__) && defined(__x86_64__) && \
24 defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
25 (__GLIBC__ <= 2 && __GLIBC_MINOR__ < 16)
26# define expf(x) ((float)exp((double)(x)))
27#endif
28
30
31/* Assertions inside the kernel only work for the CPU device, so we wrap it in
32 * a macro which is empty for other devices */
33
34#define kernel_assert(cond) assert(cond)
35
#define CCL_NAMESPACE_END