alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
include
alpaka
core
Unreachable.hpp
Go to the documentation of this file.
1
/* Copyright 2022 Jan Stephan, Jeffrey Kelling
2
* SPDX-License-Identifier: MPL-2.0
3
*/
4
5
#pragma once
6
7
#include "
alpaka/core/config.hpp
"
8
9
//! Before CUDA 11.5 nvcc is unable to correctly identify return statements in 'if constexpr' branches. It will issue
10
//! a false warning about a missing return statement unless it is told that the following code section is unreachable.
11
//!
12
//! \param x A dummy value for the expected return type of the calling function.
13
#if (ALPAKA_COMP_NVCC && ALPAKA_ARCH_PTX)
14
# if ALPAKA_LANG_CUDA >= ALPAKA_VERSION_NUMBER(11, 3, 0)
15
# define ALPAKA_UNREACHABLE(...) __builtin_unreachable()
16
# else
17
# define ALPAKA_UNREACHABLE(...) return __VA_ARGS__
18
# endif
19
#elif ALPAKA_COMP_MSVC
20
# define ALPAKA_UNREACHABLE(...) __assume(false)
21
#elif ALPAKA_COMP_GNUC || ALPAKA_COMP_CLANG
22
# define ALPAKA_UNREACHABLE(...) __builtin_unreachable()
23
#else
24
# define ALPAKA_UNREACHABLE(...)
25
#endif
config.hpp
Generated on
for alpaka by
1.16.1