-
Notifications
You must be signed in to change notification settings - Fork 283
Add host standard library detection #6244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,52 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of libcu++, the C++ Standard Library for your entire system, | ||
// under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef __CCCL_HOST_STD_LIB_H | ||
#define __CCCL_HOST_STD_LIB_H | ||
|
||
#include <cuda/std/__cccl/compiler.h> | ||
#include <cuda/std/__cccl/preprocessor.h> | ||
#include <cuda/std/__cccl/system_header.h> | ||
|
||
#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 | ||
|
||
#define _CCCL_HOST_STD_LIB_LIBSTDCXX() 0 | ||
#define _CCCL_HOST_STD_LIB_LIBCXX() 0 | ||
#define _CCCL_HOST_STD_LIB_STL() 0 | ||
|
||
// include a minimal header | ||
#if _CCCL_HAS_INCLUDE(<version>) | ||
# include <version> | ||
#elif _CCCL_HAS_INCLUDE(<ciso646>) | ||
# include <ciso646> | ||
#endif // ^^^ _CCCL_HAS_INCLUDE(<ciso646>) ^^^ | ||
|
||
#if defined(_MSVC_STL_VERSION) | ||
# undef _CCCL_HOST_STD_LIB_STL | ||
# define _CCCL_HOST_STD_LIB_STL() 1 | ||
#elif defined(__GLIBCXX__) | ||
# undef _CCCL_HOST_STD_LIB_LIBSTDCXX | ||
# define _CCCL_HOST_STD_LIB_LIBSTDCXX() 1 | ||
#elif defined(_LIBCPP_VERSION) | ||
# undef _CCCL_HOST_STD_LIB_LIBCXX | ||
# define _CCCL_HOST_STD_LIB_LIBCXX() 1 | ||
#endif // ^^^ _LIBCPP_VERSION ^^^ | ||
|
||
#define _CCCL_HOST_STD_LIB(_X) _CCCL_HOST_STD_LIB_##_X() | ||
#define _CCCL_HAS_HOST_STD_LIB() \ | ||
(_CCCL_HOST_STD_LIB_LIBSTDCXX() || _CCCL_HOST_STD_LIB_LIBCXX() || _CCCL_HOST_STD_LIB_STL()) | ||
|
||
#endif // __CCCL_HOST_STD_LIB_H |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -31,8 +31,9 @@ | |
# include <cuda/std/__type_traits/enable_if.h> | ||
# include <cuda/std/__type_traits/is_constructible.h> | ||
|
||
// todo: find a way to get rid of this include | ||
# if !_CCCL_COMPILER(NVRTC) | ||
# include <sstream> // for std::basic_ostringstream | ||
# include <complex> // for std::complex stream operators | ||
# endif // !_CCCL_COMPILER(NVRTC) | ||
|
||
# include <cuda/std/__cccl/prologue.h> | ||
|
@@ -294,7 +295,7 @@ struct __get_complex_impl<__half> | |
} | ||
}; | ||
|
||
# if !defined(_LIBCUDACXX_HAS_NO_LOCALIZATION) && !_CCCL_COMPILER(NVRTC) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is never defined |
||
# if !_CCCL_COMPILER(NVRTC) | ||
template <class _CharT, class _Traits> | ||
::std::basic_istream<_CharT, _Traits>& operator>>(::std::basic_istream<_CharT, _Traits>& __is, complex<__half>& __x) | ||
{ | ||
|
@@ -310,7 +311,7 @@ operator<<(::std::basic_ostream<_CharT, _Traits>& __os, const complex<__half>& _ | |
{ | ||
return __os << complex<float>{__x}; | ||
} | ||
# endif // !_LIBCUDACXX_HAS_NO_LOCALIZATION && !_CCCL_COMPILER(NVRTC) | ||
# endif // !_CCCL_COMPILER(NVRTC) | ||
|
||
_CCCL_END_NAMESPACE_CUDA_STD | ||
|
||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were not working anyway, so I'd like to leave this for a different PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to know what is not woorking. Generally I would just replace the host STL detection and leave the rest in