[INFRA] Import NVIDIA/CCCL upstream as optimization reference library
CCCL (CUDA C++ Core Libraries) provides: - CUB: device/block/warp-level GPU primitives (reduce, scan, sort, topk) - Thrust: high-level parallel algorithms (transform_reduce, sort, scan) - libcudacxx: CUDA C++ standard library (atomics, barriers, memory) - cudax: experimental features (memory resources, allocators) - Tuning policies: per-SM hardware-specific algorithm parameters Competition optimization vectors mapped to CCCL: - Output TPS (83% weight): warp_reduce, block_reduce, device_topk - Input TPS (14% weight): device_scan, block_load, prefetch - Cache TPS (3% weight): prefix caching strategy patterns - Memory (0.9 util): pooled/cached/buddy allocators Source: https://github.com/NVIDIA/cccl (shallow clone, HEAD only) License: Apache-2.0
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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 _CUDA_STD___CHARCONV_CHARS_FORMAT_H
|
||||
#define _CUDA_STD___CHARCONV_CHARS_FORMAT_H
|
||||
|
||||
#include <cuda/std/detail/__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 <cuda/std/__utility/to_underlying.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
enum class chars_format
|
||||
{
|
||||
// We intentionally don't use `to_underlying(std::chars_format::XXX)` for XXX values because we want to avoid the risk
|
||||
// of the value mismatch between host's standard library and our definitions for NVRTC
|
||||
scientific = 0x1,
|
||||
fixed = 0x2,
|
||||
hex = 0x4,
|
||||
general = fixed | scientific,
|
||||
};
|
||||
|
||||
[[nodiscard]] _CCCL_API constexpr chars_format operator~(chars_format __v) noexcept
|
||||
{
|
||||
return chars_format(~::cuda::std::to_underlying(__v));
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API constexpr chars_format operator&(chars_format __lhs, chars_format __rhs) noexcept
|
||||
{
|
||||
return chars_format(::cuda::std::to_underlying(__lhs) & ::cuda::std::to_underlying(__rhs));
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API constexpr chars_format operator|(chars_format __lhs, chars_format __rhs) noexcept
|
||||
{
|
||||
return chars_format(::cuda::std::to_underlying(__lhs) | ::cuda::std::to_underlying(__rhs));
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API constexpr chars_format operator^(chars_format __lhs, chars_format __rhs) noexcept
|
||||
{
|
||||
return chars_format(::cuda::std::to_underlying(__lhs) ^ ::cuda::std::to_underlying(__rhs));
|
||||
}
|
||||
|
||||
_CCCL_API constexpr chars_format& operator&=(chars_format& __lhs, chars_format __rhs) noexcept
|
||||
{
|
||||
__lhs = __lhs & __rhs;
|
||||
return __lhs;
|
||||
}
|
||||
|
||||
_CCCL_API constexpr chars_format& operator|=(chars_format& __lhs, chars_format __rhs) noexcept
|
||||
{
|
||||
__lhs = __lhs | __rhs;
|
||||
return __lhs;
|
||||
}
|
||||
|
||||
_CCCL_API constexpr chars_format& operator^=(chars_format& __lhs, chars_format __rhs) noexcept
|
||||
{
|
||||
__lhs = __lhs ^ __rhs;
|
||||
return __lhs;
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CHARCONV_CHARS_FORMAT_H
|
||||
@@ -0,0 +1,171 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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 _CUDA_STD___CHARCONV_FROM_CHARS_H
|
||||
#define _CUDA_STD___CHARCONV_FROM_CHARS_H
|
||||
|
||||
#include <cuda/std/detail/__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 <cuda/__cmath/neg.h>
|
||||
#include <cuda/__cmath/uabs.h>
|
||||
#include <cuda/std/__charconv/chars_format.h>
|
||||
#include <cuda/std/__charconv/from_chars_result.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__cstddef/types.h>
|
||||
#include <cuda/std/__limits/numeric_limits.h>
|
||||
#include <cuda/std/__type_traits/always_false.h>
|
||||
#include <cuda/std/__type_traits/conditional.h>
|
||||
#include <cuda/std/__type_traits/is_floating_point.h>
|
||||
#include <cuda/std/__type_traits/is_integer.h>
|
||||
#include <cuda/std/__type_traits/is_same.h>
|
||||
#include <cuda/std/__type_traits/is_signed.h>
|
||||
#include <cuda/std/__type_traits/make_unsigned.h>
|
||||
#include <cuda/std/cstdint>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
struct __from_chars_char_to_value_result
|
||||
{
|
||||
bool __valid_;
|
||||
int __value_;
|
||||
};
|
||||
|
||||
[[nodiscard]] _CCCL_API constexpr __from_chars_char_to_value_result
|
||||
__from_chars_char_to_value(char __c, int __base) noexcept
|
||||
{
|
||||
if (__base <= 10)
|
||||
{
|
||||
return {'0' <= __c && __c < '0' + __base, __c - '0'};
|
||||
}
|
||||
else if ('0' <= __c && __c <= '9')
|
||||
{
|
||||
return {true, __c - '0'};
|
||||
}
|
||||
else if ('a' <= __c && __c < 'a' + __base - 10)
|
||||
{
|
||||
return {true, __c - 'a' + 10};
|
||||
}
|
||||
else
|
||||
{
|
||||
return {'A' <= __c && __c < 'A' + __base - 10, __c - 'A' + 10};
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr from_chars_result
|
||||
__from_chars_int_generic(const char* __first, const char* __last, _Tp& __value, int __base) noexcept
|
||||
{
|
||||
bool __overflow = false;
|
||||
const char* __it = __first;
|
||||
for (; __it != __last; ++__it)
|
||||
{
|
||||
const auto __digit = ::cuda::std::__from_chars_char_to_value(*__it, __base);
|
||||
if (!__digit.__valid_)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!__overflow)
|
||||
{
|
||||
const auto __new_value = static_cast<_Tp>(__value * _Tp(__base) + _Tp(__digit.__value_));
|
||||
if (__new_value < __value)
|
||||
{
|
||||
__overflow = true;
|
||||
}
|
||||
__value = __new_value;
|
||||
}
|
||||
}
|
||||
return {__it, (__overflow) ? errc::result_out_of_range : ((__it == __first) ? errc::invalid_argument : errc{})};
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Tp)
|
||||
_CCCL_REQUIRES(__cccl_is_integer_v<_Tp>)
|
||||
[[nodiscard]] _CCCL_API constexpr from_chars_result
|
||||
from_chars(const char* __first, const char* __last, _Tp& __value, int __base = 10) noexcept
|
||||
{
|
||||
_CCCL_ASSERT(__base >= 2 && __base <= 36, "base must be in the range [2, 36]");
|
||||
_CCCL_ASSERT(__first <= __last, "input range must be a valid range");
|
||||
|
||||
make_unsigned_t<_Tp> __result{};
|
||||
from_chars_result __ret{};
|
||||
|
||||
if constexpr (is_signed_v<_Tp>)
|
||||
{
|
||||
bool __neg = (__first < __last && *__first == '-');
|
||||
__ret = ::cuda::std::__from_chars_int_generic(__first + __neg, __last, __result, __base);
|
||||
if (__ret.ec == errc{})
|
||||
{
|
||||
const auto __max = ::cuda::uabs((__neg) ? numeric_limits<_Tp>::min() : numeric_limits<_Tp>::max());
|
||||
if (__result > __max)
|
||||
{
|
||||
__ret.ec = errc::result_out_of_range;
|
||||
}
|
||||
if (__neg)
|
||||
{
|
||||
__result = ::cuda::neg(__result);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__ret = ::cuda::std::__from_chars_int_generic(__first, __last, __result, __base);
|
||||
}
|
||||
|
||||
if (__ret.ec == errc{})
|
||||
{
|
||||
__value = static_cast<_Tp>(__result);
|
||||
}
|
||||
else if (__ret.ec == errc::invalid_argument)
|
||||
{
|
||||
__ret.ptr = __first;
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API constexpr from_chars_result
|
||||
from_chars(const char* __first, const char* __last, char& __value, int __base = 10) noexcept
|
||||
{
|
||||
using _Tp = conditional_t<is_signed_v<char>, signed char, unsigned char>;
|
||||
_Tp __value_tmp{};
|
||||
const auto __ret = ::cuda::std::from_chars(__first, __last, __value_tmp, __base);
|
||||
if (__ret.ec == errc{})
|
||||
{
|
||||
__value = static_cast<char>(__value_tmp);
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Tp)
|
||||
_CCCL_REQUIRES(is_floating_point_v<_Tp>)
|
||||
[[nodiscard]] _CCCL_API constexpr from_chars_result
|
||||
from_chars(const char* __first, const char* __last, _Tp& __value, chars_format __fmt = chars_format::general) noexcept
|
||||
{
|
||||
static_assert(::cuda::std::__always_false_v<_Tp>,
|
||||
"cuda::std::from_chars for floating point types is not yet implemented");
|
||||
(void) __first;
|
||||
(void) __last;
|
||||
(void) __value;
|
||||
(void) __fmt;
|
||||
return {};
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CHARCONV_FROM_CHARS_H
|
||||
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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 _CUDA_STD___CHARCONV_FROM_CHARS_RESULT_H
|
||||
#define _CUDA_STD___CHARCONV_FROM_CHARS_RESULT_H
|
||||
|
||||
#include <cuda/std/detail/__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 <cuda/std/__system_error/errc.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT from_chars_result
|
||||
{
|
||||
const char* ptr;
|
||||
errc ec;
|
||||
|
||||
_CCCL_API constexpr explicit operator bool() const noexcept
|
||||
{
|
||||
return ec == errc{};
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API friend constexpr bool
|
||||
operator==(const from_chars_result& __lhs, const from_chars_result& __rhs) noexcept
|
||||
{
|
||||
return __lhs.ptr == __rhs.ptr && __lhs.ec == __rhs.ec;
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API friend constexpr bool
|
||||
operator!=(const from_chars_result& __lhs, const from_chars_result& __rhs) noexcept
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
};
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CHARCONV_FROM_CHARS_RESULT_H
|
||||
246
cccl_upstream/libcudacxx/include/cuda/std/__charconv/to_chars.h
Normal file
246
cccl_upstream/libcudacxx/include/cuda/std/__charconv/to_chars.h
Normal file
@@ -0,0 +1,246 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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 _CUDA_STD___CHARCONV_TO_CHARS_H
|
||||
#define _CUDA_STD___CHARCONV_TO_CHARS_H
|
||||
|
||||
#include <cuda/std/detail/__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 <cuda/__cmath/ceil_div.h>
|
||||
#include <cuda/__cmath/ilog.h>
|
||||
#include <cuda/__cmath/pow2.h>
|
||||
#include <cuda/__cmath/uabs.h>
|
||||
#include <cuda/std/__bit/countl.h>
|
||||
#include <cuda/std/__charconv/chars_format.h>
|
||||
#include <cuda/std/__charconv/to_chars_result.h>
|
||||
#include <cuda/std/__concepts/concept_macros.h>
|
||||
#include <cuda/std/__cstddef/types.h>
|
||||
#include <cuda/std/__type_traits/always_false.h>
|
||||
#include <cuda/std/__type_traits/conditional.h>
|
||||
#include <cuda/std/__type_traits/is_floating_point.h>
|
||||
#include <cuda/std/__type_traits/is_integer.h>
|
||||
#include <cuda/std/__type_traits/is_same.h>
|
||||
#include <cuda/std/__type_traits/is_signed.h>
|
||||
#include <cuda/std/__type_traits/make_unsigned.h>
|
||||
#include <cuda/std/__type_traits/num_bits.h>
|
||||
#include <cuda/std/cstdint>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
[[nodiscard]] _CCCL_API constexpr char __to_chars_value_to_char(int __v, int __base) noexcept
|
||||
{
|
||||
_CCCL_ASSERT(__v >= 0 && __v < __base, "value must be in the range [0, base)");
|
||||
const int __offset = (__base < 10 || __v < 10) ? '0' : ('a' - 10);
|
||||
return static_cast<char>(__offset + __v);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr int __to_chars_int_width(_Tp __v, int __base) noexcept
|
||||
{
|
||||
using _Up = ::cuda::std::conditional_t<sizeof(_Tp) >= sizeof(uint32_t), make_unsigned_t<_Tp>, uint32_t>;
|
||||
|
||||
auto __uv = static_cast<_Up>(__v);
|
||||
|
||||
const auto __ubase = static_cast<_Up>(__base);
|
||||
const auto __ubase_2 = __ubase * __ubase;
|
||||
const auto __ubase_3 = __ubase_2 * __ubase;
|
||||
const auto __ubase_4 = __ubase_2 * __ubase_2;
|
||||
|
||||
int __r = 0;
|
||||
while (true)
|
||||
{
|
||||
if (__uv < __ubase)
|
||||
{
|
||||
__r += 1;
|
||||
break;
|
||||
}
|
||||
else if (__uv < __ubase_2)
|
||||
{
|
||||
__r += 2;
|
||||
break;
|
||||
}
|
||||
else if (__uv < __ubase_3)
|
||||
{
|
||||
__r += 3;
|
||||
break;
|
||||
}
|
||||
else if (__uv < __ubase_4)
|
||||
{
|
||||
__r += 4;
|
||||
break;
|
||||
}
|
||||
|
||||
__uv /= __ubase_4;
|
||||
__r += 4;
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <int _Base, class _Tp>
|
||||
[[nodiscard]] _CCCL_API constexpr int __to_chars_int_width(_Tp __v) noexcept
|
||||
{
|
||||
if constexpr (::cuda::is_power_of_two(_Base))
|
||||
{
|
||||
// For bases that are powers of 2, we can count leading zeros to compute the width more efficiently.
|
||||
constexpr auto __base_ilog2 = ::cuda::ilog2(_Base);
|
||||
|
||||
// If value == 0 still need one digit, so we always set the least significant bit.
|
||||
return ::cuda::ceil_div(__num_bits_v<_Tp> - ::cuda::std::countl_zero(static_cast<_Tp>(__v | 1)), __base_ilog2);
|
||||
}
|
||||
else if constexpr (_Base == 10)
|
||||
{
|
||||
return (__v > 1) ? ::cuda::ceil_ilog10(__v) : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ::cuda::std::__to_chars_int_width(__v, _Base);
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_CCCL_API constexpr void __to_chars_int_generic(char* __last, _Tp __value, int __base) noexcept
|
||||
{
|
||||
do
|
||||
{
|
||||
const int __c = __value % __base;
|
||||
*--__last = ::cuda::std::__to_chars_value_to_char(__c, __base);
|
||||
__value /= static_cast<_Tp>(__base);
|
||||
} while (__value != 0);
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Tp)
|
||||
_CCCL_REQUIRES(__cccl_is_integer_v<_Tp>)
|
||||
[[nodiscard]] _CCCL_API constexpr to_chars_result
|
||||
to_chars(char* __first, char* __last, _Tp __value, int __base = 10) noexcept
|
||||
{
|
||||
_CCCL_ASSERT(__base >= 2 && __base <= 36, "base must be in the range [2, 36]");
|
||||
_CCCL_ASSERT(__first <= __last, "output range must be a valid range");
|
||||
|
||||
if constexpr (is_signed_v<_Tp>)
|
||||
{
|
||||
if (__value < _Tp{0} && __first < __last)
|
||||
{
|
||||
*__first++ = '-';
|
||||
}
|
||||
return ::cuda::std::to_chars(__first, __last, ::cuda::uabs(__value), __base);
|
||||
}
|
||||
else
|
||||
{
|
||||
const ptrdiff_t __cap = __last - __first;
|
||||
|
||||
int __n{};
|
||||
switch (__base)
|
||||
{
|
||||
case 2:
|
||||
__n = ::cuda::std::__to_chars_int_width<2>(__value);
|
||||
break;
|
||||
case 4:
|
||||
__n = ::cuda::std::__to_chars_int_width<4>(__value);
|
||||
break;
|
||||
case 8:
|
||||
__n = ::cuda::std::__to_chars_int_width<8>(__value);
|
||||
break;
|
||||
case 10:
|
||||
__n = ::cuda::std::__to_chars_int_width<10>(__value);
|
||||
break;
|
||||
case 16:
|
||||
__n = ::cuda::std::__to_chars_int_width<16>(__value);
|
||||
break;
|
||||
case 32:
|
||||
__n = ::cuda::std::__to_chars_int_width<32>(__value);
|
||||
break;
|
||||
default:
|
||||
__n = ::cuda::std::__to_chars_int_width(__value, __base);
|
||||
break;
|
||||
}
|
||||
|
||||
if (__n > __cap)
|
||||
{
|
||||
return {__last, errc::value_too_large};
|
||||
}
|
||||
|
||||
char* __new_last = __first + __n;
|
||||
|
||||
::cuda::std::__to_chars_int_generic(__new_last, __value, __base);
|
||||
|
||||
return {__new_last, errc{}};
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API constexpr to_chars_result
|
||||
to_chars(char* __first, char* __last, char __value, int __base = 10) noexcept
|
||||
{
|
||||
if constexpr (is_signed_v<char>)
|
||||
{
|
||||
return ::cuda::std::to_chars(__first, __last, static_cast<signed char>(__value), __base);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ::cuda::std::to_chars(__first, __last, static_cast<unsigned char>(__value), __base);
|
||||
}
|
||||
}
|
||||
|
||||
_CCCL_API constexpr to_chars_result to_chars(char*, char*, bool, int = 10) noexcept = delete;
|
||||
|
||||
_CCCL_TEMPLATE(class _Tp)
|
||||
_CCCL_REQUIRES(is_floating_point_v<_Tp>)
|
||||
[[nodiscard]] _CCCL_API constexpr to_chars_result to_chars(char* __first, char* __last, _Tp __value) noexcept
|
||||
{
|
||||
static_assert(::cuda::std::__always_false_v<_Tp>,
|
||||
"cuda::std::to_chars for floating point types is not yet implemented");
|
||||
(void) __first;
|
||||
(void) __last;
|
||||
(void) __value;
|
||||
return {};
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Tp)
|
||||
_CCCL_REQUIRES(is_floating_point_v<_Tp>)
|
||||
[[nodiscard]] _CCCL_API constexpr to_chars_result
|
||||
to_chars(char* __first, char* __last, _Tp __value, chars_format __fmt) noexcept
|
||||
{
|
||||
static_assert(::cuda::std::__always_false_v<_Tp>,
|
||||
"cuda::std::to_chars for floating point types is not yet implemented");
|
||||
(void) __first;
|
||||
(void) __last;
|
||||
(void) __value;
|
||||
(void) __fmt;
|
||||
return {};
|
||||
}
|
||||
|
||||
_CCCL_TEMPLATE(class _Tp)
|
||||
_CCCL_REQUIRES(is_floating_point_v<_Tp>)
|
||||
[[nodiscard]] _CCCL_API constexpr to_chars_result
|
||||
to_chars(char* __first, char* __last, _Tp __value, chars_format __fmt, int __prec) noexcept
|
||||
{
|
||||
static_assert(::cuda::std::__always_false_v<_Tp>,
|
||||
"cuda::std::to_chars for floating point types is not yet implemented");
|
||||
(void) __first;
|
||||
(void) __last;
|
||||
(void) __value;
|
||||
(void) __fmt;
|
||||
(void) __prec;
|
||||
return {};
|
||||
}
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CHARCONV_TO_CHARS_H
|
||||
@@ -0,0 +1,56 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, 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 _CUDA_STD___CHARCONV_TO_CHARS_RESULT_H
|
||||
#define _CUDA_STD___CHARCONV_TO_CHARS_RESULT_H
|
||||
|
||||
#include <cuda/std/detail/__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 <cuda/std/__system_error/errc.h>
|
||||
|
||||
#include <cuda/std/__cccl/prologue.h>
|
||||
|
||||
_CCCL_BEGIN_NAMESPACE_CUDA_STD
|
||||
|
||||
struct _CCCL_TYPE_VISIBILITY_DEFAULT to_chars_result
|
||||
{
|
||||
char* ptr;
|
||||
errc ec;
|
||||
|
||||
_CCCL_API constexpr explicit operator bool() const noexcept
|
||||
{
|
||||
return ec == errc{};
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API friend constexpr bool
|
||||
operator==(const to_chars_result& __lhs, const to_chars_result& __rhs) noexcept
|
||||
{
|
||||
return __lhs.ptr == __rhs.ptr && __lhs.ec == __rhs.ec;
|
||||
}
|
||||
|
||||
[[nodiscard]] _CCCL_API friend constexpr bool
|
||||
operator!=(const to_chars_result& __lhs, const to_chars_result& __rhs) noexcept
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
};
|
||||
|
||||
_CCCL_END_NAMESPACE_CUDA_STD
|
||||
|
||||
#include <cuda/std/__cccl/epilogue.h>
|
||||
|
||||
#endif // _CUDA_STD___CHARCONV_TO_CHARS_RESULT_H
|
||||
Reference in New Issue
Block a user