-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GT_ASSUME for NVCC and Enable GT_ASSUME on Recent GCC Versions (#…
…1789) - Fixes non-functional `GT_ASSUME` on NVCC due to `__has_builtin(__builtin_assume)` returning 0. - Adds a test to check correctly defined device-side `GT_ASSUME` on NVCC. - Enables `GT_ASSUME` based on C++-23 `[[assume(x)]]` on recent versions of GCC.
- Loading branch information
Showing
3 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* GridTools | ||
* | ||
* Copyright (c) 2014-2023, ETH Zurich | ||
* All rights reserved. | ||
* | ||
* Please, refer to the LICENSE file in the root directory. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
#include <string_view> | ||
|
||
#include <boost/preprocessor/stringize.hpp> | ||
|
||
#include <gridtools/common/defs.hpp> | ||
|
||
#if defined(__NVCC__) && defined(__CUDA_ARCH__) && \ | ||
(__CUDACC_VER_MAJOR__ == 11 && __CUDACC_VER_MINOR__ >= 2 || __CUDACC__VER_MAJOR__ > 11) | ||
|
||
#if !defined(GT_ASSUME) | ||
#error "GT_ASSUME is undefined" | ||
#else | ||
static_assert(std::string_view(BOOST_PP_STRINGIZE(GT_ASSUME(x))) == | ||
std::string_view(BOOST_PP_STRINGIZE(__builtin_assume(x))), | ||
BOOST_PP_STRINGIZE(GT_ASSUME(x)) " != " BOOST_PP_STRINGIZE(__builtin_assume(x))); | ||
#endif | ||
|
||
#endif |