Skip to content

Commit

Permalink
Use relative includes for our public headers (#1325)
Browse files Browse the repository at this point in the history
This ensures we are picking up the right headers and not some from other include paths.

Also we should ensure that we are properly treated as system headers when we actually have code in the header
  • Loading branch information
miscco authored Feb 14, 2024
1 parent 0e9d834 commit 6a2185a
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 24 deletions.
17 changes: 13 additions & 4 deletions libcudacxx/include/cuda/annotated_ptr
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,19 @@
#ifndef _CUDA_ANNOTATED_PTR
#define _CUDA_ANNOTATED_PTR

#include <cuda/std/cstdint>
#include <cuda/barrier>
#include <cuda/discard_memory>

#include "__cccl_config"

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
# pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
# pragma system_header
#endif // no system header

#include "barrier"
#include "discard_memory"
#include "std/cstdint"
#include "std/detail/__access_property"

_LIBCUDACXX_BEGIN_NAMESPACE_CUDA
Expand Down
10 changes: 10 additions & 0 deletions libcudacxx/include/cuda/barrier
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
#ifndef _CUDA_BARRIER
#define _CUDA_BARRIER

#include "__cccl_config"

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
# pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
# pragma system_header
#endif // no system header

#include "std/barrier"

// Forward-declare CUtensorMap for use in cp_async_bulk_tensor_* PTX wrapping
Expand Down
15 changes: 12 additions & 3 deletions libcudacxx/include/cuda/discard_memory
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
#ifndef _CUDA_DISCARD_MEMORY
#define _CUDA_DISCARD_MEMORY

#include <cuda/std/cstdint>
#include <cuda/std/detail/__config>
#include <cuda/std/detail/libcxx/include/__cuda/ptx.h>
#include "__cccl_config"

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
# pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
# pragma system_header
#endif // no system header

#include "std/cstdint"
#include "ptx"

_LIBCUDACXX_BEGIN_NAMESPACE_CUDA

Expand Down
16 changes: 13 additions & 3 deletions libcudacxx/include/cuda/functional
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,19 @@
#ifndef _CUDA_FUNCTIONAL_
#define _CUDA_FUNCTIONAL_

#include <cuda/std/type_traits>
#include <cuda/std/functional>
#include <cuda/std/utility>
#include "__cccl_config"

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
# pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
# pragma system_header
#endif // no system header

#include "std/type_traits"
#include "std/functional"
#include "std/utility"

_LIBCUDACXX_BEGIN_NAMESPACE_CUDA
namespace __detail
Expand Down
10 changes: 5 additions & 5 deletions libcudacxx/include/cuda/memory_resource
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ class resource_ref {

#ifdef LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// Needs to come first due to cuda_runtime_api
#include <cuda/stream_ref>
#include <cuda_runtime_api.h> // cuda_runtime_api needs to come first

#include <cuda/__cccl_config>
#include "__cccl_config"

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
Expand All @@ -95,8 +94,9 @@ class resource_ref {
# pragma system_header
#endif // no system header

#include <cuda/std/concepts>
#include <cuda/std/type_traits>
#include "std/concepts"
#include "std/type_traits"
#include "stream_ref"

#if _CCCL_STD_VER > 2011
_LIBCUDACXX_BEGIN_NAMESPACE_CUDA
Expand Down
10 changes: 10 additions & 0 deletions libcudacxx/include/cuda/pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@
#ifndef _CUDA_PIPELINE
#define _CUDA_PIPELINE

#include "__cccl_config"

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
# pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
# pragma system_header
#endif // no system header

#include "barrier"
#include "atomic"
#include "std/chrono"
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/std/detail/__config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef __cuda_std__
#define __cuda_std__

#include <cuda/std/detail/libcxx/include/__cccl/version.h>
#include "libcxx/include/__cccl/version.h"

#define _LIBCUDACXX_CUDA_API_VERSION CCCL_VERSION
#define _LIBCUDACXX_CUDA_API_VERSION_MAJOR CCCL_MAJOR_VERSION
Expand Down
5 changes: 0 additions & 5 deletions libcudacxx/include/cuda/std/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
#ifndef _CUDA_RANGES
#define _CUDA_RANGES

#include "concepts"
#include "initializer_list"
#include "iterator"
#include "type_traits"

#include "detail/__config"

#include "detail/__pragma_push"
Expand Down
6 changes: 3 additions & 3 deletions libcudacxx/include/cuda/stream_ref
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private:
#include <cuda_runtime_api.h> // cuda_runtime_api needs to come first
// clang-format on

#include <cuda/__cccl_config>
#include "__cccl_config"

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
Expand All @@ -52,8 +52,8 @@ private:
# pragma system_header
#endif // no system header

#include <cuda/std/array>
#include <cuda/std/type_traits>
#include "std/array"
#include "std/type_traits"

_LIBCUDACXX_BEGIN_NAMESPACE_CUDA

Expand Down

0 comments on commit 6a2185a

Please sign in to comment.