Skip to content

Commit 0a65b5c

Browse files
committed
Move cccl global logic into a __cccl_config
We just reused the libcu++ config, but going forward we want to move more common parts into a unified config.
1 parent ea631db commit 0a65b5c

File tree

10 files changed

+84
-32
lines changed

10 files changed

+84
-32
lines changed

cub/cub/config.cuh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#pragma once
3434

3535
// For `_CCCL_IMPLICIT_SYSTEM_HEADER`
36-
#include <cuda/std/detail/__config>
36+
#include <cuda/__cccl_config>
3737

3838
_CCCL_IMPLICIT_SYSTEM_HEADER
3939

cub/cub/detail/detect_cuda_runtime.cuh

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#pragma once
3535

3636
// We cannot use `cub/config.cuh` here due to circular dependencies
37-
#include <cuda/std/detail/__config>
37+
#include <cuda/__cccl_config>
3838

3939
_CCCL_IMPLICIT_SYSTEM_HEADER
4040

cub/cub/util_compiler.cuh

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#pragma once
3434

3535
// For `_CCCL_IMPLICIT_SYSTEM_HEADER`
36-
#include <cuda/std/detail/__config>
36+
#include <cuda/__cccl_config>
3737

3838
_CCCL_IMPLICIT_SYSTEM_HEADER
3939

cub/cub/util_cpp_dialect.cuh

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
3131

3232
#pragma once
3333

34-
#include "config.cuh"
34+
#include <cuda/__cccl_config>
3535

3636
_CCCL_IMPLICIT_SYSTEM_HEADER
3737

38+
#include "util_compiler.cuh"
39+
3840
// Deprecation warnings may be silenced by defining the following macros. These
3941
// may be combined.
4042
// - CUB_IGNORE_DEPRECATED_CPP_DIALECT:

cub/cub/version.cuh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#pragma once
3737

3838
// For `_CCCL_IMPLICIT_SYSTEM_HEADER`
39-
#include <cuda/std/detail/__config>
39+
#include <cuda/__cccl_config>
4040

4141
_CCCL_IMPLICIT_SYSTEM_HEADER
4242

libcudacxx/include/cuda/__cccl_config

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of libcu++, the C++ Standard Library for your entire system,
4+
// under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
8+
//
9+
//===----------------------------------------------------------------------===//
10+
11+
#ifndef _CUDA__CCCL_CONFIG
12+
#define _CUDA__CCCL_CONFIG
13+
14+
#include "std/detail/libcxx/include/__cccl_config"
15+
16+
#endif // _CUDA__CCCL_CONFIG

libcudacxx/include/cuda/std/detail/libcxx/include/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(files
66
__bsd_locale_defaults.h
77
__bsd_locale_fallbacks.h
88
__errc
9+
__cccl_config
910
__concepts/__concept_macros.h
1011
__concepts/_One_of.h
1112
__concepts/arithmetic.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of libcu++, the C++ Standard Library for your entire system,
4+
// under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
8+
//
9+
//===----------------------------------------------------------------------===//
10+
11+
#ifndef __CCCL_CONFIG
12+
#define __CCCL_CONFIG
13+
14+
// Determine the host compiler
15+
#if defined(__NVCOMPILER)
16+
# define _CCCL_COMPILER_NVHPC
17+
#elif defined(__clang__)
18+
# define _CCCL_COMPILER_CLANG
19+
#elif defined(__GNUC__)
20+
# define _CCCL_COMPILER_GCC
21+
#elif defined(_MSC_VER)
22+
# define _CCCL_COMPILER_MSVC
23+
#elif defined(__IBMCPP__)
24+
# define _CCCL_COMPILER_IBM
25+
#elif defined(__CUDACC_RTC__)
26+
# define _CCCL_COMPILER_NVRTC
27+
#endif
28+
29+
// Ensure cccl headers are treated as system headers when possible
30+
#if defined(_CCCL_NO_SYSTEM_HEADER)
31+
# define _CCCL_IMPLICIT_SYSTEM_HEADER
32+
#elif defined(_CCCL_COMPILER_MSVC) \
33+
&& defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING)
34+
# define _CCCL_IMPLICIT_SYSTEM_HEADER
35+
#elif defined(_CCCL_COMPILER_NVRTC)
36+
# define _CCCL_IMPLICIT_SYSTEM_HEADER
37+
#elif defined(_LIBCUDACXX_DISABLE_PRAGMA_GCC_SYSTEM_HEADER)
38+
# define _CCCL_IMPLICIT_SYSTEM_HEADER
39+
#else
40+
# if defined(_CCCL_COMPILER_GCC)
41+
# define _CCCL_IMPLICIT_SYSTEM_HEADER _Pragma("GCC system_header")
42+
# elif defined(_CCCL_COMPILER_CLANG)
43+
# define _CCCL_IMPLICIT_SYSTEM_HEADER _Pragma("clang system_header")
44+
# elif defined(_CCCL_COMPILER_MSVC)
45+
# define _CCCL_IMPLICIT_SYSTEM_HEADER __pragma(system_header)
46+
# elif defined(_CCCL_COMPILER_NVHPC)
47+
# define _CCCL_IMPLICIT_SYSTEM_HEADER _Pragma("GCC system_header")
48+
# else
49+
# define _CCCL_IMPLICIT_SYSTEM_HEADER
50+
# endif
51+
#endif
52+
53+
_CCCL_IMPLICIT_SYSTEM_HEADER
54+
55+
#endif // __CCCL_CONFIG

libcudacxx/include/cuda/std/detail/libcxx/include/__config

+4-26
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#ifndef _LIBCUDACXX_CONFIG
1111
#define _LIBCUDACXX_CONFIG
1212

13+
#include "__cccl_config"
14+
15+
_CCCL_IMPLICIT_SYSTEM_HEADER
16+
1317
#if defined(__NVCOMPILER)
1418
# define _LIBCUDACXX_COMPILER_NVHPC
1519
#elif defined(__clang__)
@@ -83,32 +87,6 @@
8387
# endif // !_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING
8488
#endif // _LIBCUDACXX_COMPILER_MSVC
8589

86-
// allow disabling use as system header for testing
87-
#if defined(_CCCL_NO_SYSTEM_HEADER)
88-
# define _CCCL_IMPLICIT_SYSTEM_HEADER
89-
#elif defined(_LIBCUDACXX_COMPILER_MSVC) \
90-
&& defined(_LIBCUDACXX_DISABLE_PRAGMA_MSVC_WARNING)
91-
# define _CCCL_IMPLICIT_SYSTEM_HEADER
92-
#elif defined(_LIBCUDACXX_COMPILER_NVRTC)
93-
# define _CCCL_IMPLICIT_SYSTEM_HEADER
94-
#elif defined(_LIBCUDACXX_DISABLE_PRAGMA_GCC_SYSTEM_HEADER)
95-
# define _CCCL_IMPLICIT_SYSTEM_HEADER
96-
#else
97-
# if defined(_LIBCUDACXX_COMPILER_GCC)
98-
# define _CCCL_IMPLICIT_SYSTEM_HEADER _Pragma("GCC system_header")
99-
# elif defined(_LIBCUDACXX_COMPILER_CLANG)
100-
# define _CCCL_IMPLICIT_SYSTEM_HEADER _Pragma("clang system_header")
101-
# elif defined(_LIBCUDACXX_COMPILER_MSVC)
102-
# define _CCCL_IMPLICIT_SYSTEM_HEADER __pragma(system_header)
103-
# elif defined(_LIBCUDACXX_COMPILER_NVHPC)
104-
# define _CCCL_IMPLICIT_SYSTEM_HEADER _Pragma("GCC system_header")
105-
# else
106-
# define _CCCL_IMPLICIT_SYSTEM_HEADER
107-
# endif
108-
#endif
109-
110-
_CCCL_IMPLICIT_SYSTEM_HEADER
111-
11290
#ifdef __cplusplus
11391

11492
// __config may be included in `extern "C"` contexts, switch back to include <nv/target>

thrust/thrust/detail/config/config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#pragma once
2222

2323
// Include libcu++ config to get _CCCL_IMPLICIT_SYSTEM_HEADER
24-
#include <cuda/std/detail/__config>
24+
#include <cuda/__cccl_config>
2525

2626
_CCCL_IMPLICIT_SYSTEM_HEADER
2727

0 commit comments

Comments
 (0)