-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[flang][runtime] Prepare enabling PRINT of integer32 for device. #86247
Conversation
This commit adds required files into the offload build closure, which means adding RT_API_ATTRS and other markers. The implementation does not work for CUDA yet, because of std::variant,swap,reverse usage. These issues will be resolved separately (e.g. by using libcudacxx header files).
@llvm/pr-subscribers-flang-runtime Author: Slava Zakharin (vzakhari) ChangesThis commit adds required files into the offload build closure, The implementation does not work for CUDA yet, because of Patch is 161.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/86247.diff 52 Files Affected:
diff --git a/flang/include/flang/Common/real.h b/flang/include/flang/Common/real.h
index 50aab7d89a597e..9ca58bed2dd7c2 100644
--- a/flang/include/flang/Common/real.h
+++ b/flang/include/flang/Common/real.h
@@ -13,6 +13,7 @@
// The various representations are distinguished by their binary precisions
// (number of explicit significand bits and any implicit MSB in the fraction).
+#include "flang/Runtime/api-attrs.h"
#include <cinttypes>
namespace Fortran::common {
@@ -119,6 +120,7 @@ template <int BINARY_PRECISION> class RealDetails {
}
public:
+ RT_OFFLOAD_VAR_GROUP_BEGIN
static constexpr int binaryPrecision{BINARY_PRECISION};
static constexpr int bits{BitsForBinaryPrecision(binaryPrecision)};
static constexpr bool isImplicitMSB{binaryPrecision != 64 /*x87*/};
@@ -138,6 +140,7 @@ template <int BINARY_PRECISION> class RealDetails {
static constexpr int maxHexadecimalConversionDigits{
MaxHexadecimalConversionDigits(binaryPrecision)};
+ RT_OFFLOAD_VAR_GROUP_END
static_assert(binaryPrecision > 0);
static_assert(exponentBits > 1);
diff --git a/flang/include/flang/Common/restorer.h b/flang/include/flang/Common/restorer.h
index 4d5f5e4e2c818d..36bf11d09bbb99 100644
--- a/flang/include/flang/Common/restorer.h
+++ b/flang/include/flang/Common/restorer.h
@@ -19,11 +19,13 @@
#ifndef FORTRAN_COMMON_RESTORER_H_
#define FORTRAN_COMMON_RESTORER_H_
#include "idioms.h"
+#include "flang/Runtime/api-attrs.h"
namespace Fortran::common {
template <typename A> class Restorer {
public:
- explicit Restorer(A &p, A original) : p_{p}, original_{std::move(original)} {}
- ~Restorer() { p_ = std::move(original_); }
+ explicit RT_API_ATTRS Restorer(A &p, A original)
+ : p_{p}, original_{std::move(original)} {}
+ RT_API_ATTRS ~Restorer() { p_ = std::move(original_); }
// Inhibit any recreation of this restorer that would result in two restorers
// trying to restore the same reference.
@@ -38,13 +40,14 @@ template <typename A> class Restorer {
};
template <typename A, typename B>
-common::IfNoLvalue<Restorer<A>, B> ScopedSet(A &to, B &&from) {
+RT_API_ATTRS common::IfNoLvalue<Restorer<A>, B> ScopedSet(A &to, B &&from) {
A original{std::move(to)};
to = std::move(from);
return Restorer<A>{to, std::move(original)};
}
template <typename A, typename B>
-common::IfNoLvalue<Restorer<A>, B> ScopedSet(A &to, const B &from) {
+RT_API_ATTRS common::IfNoLvalue<Restorer<A>, B> ScopedSet(
+ A &to, const B &from) {
A original{std::move(to)};
to = from;
return Restorer<A>{to, std::move(original)};
diff --git a/flang/include/flang/Common/uint128.h b/flang/include/flang/Common/uint128.h
index 03e44eb6997d5b..55841c0d9b9028 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/flang/include/flang/Common/uint128.h
@@ -20,6 +20,7 @@
#endif
#include "leading-zero-bit-count.h"
+#include "flang/Runtime/api-attrs.h"
#include <cstdint>
#include <type_traits>
@@ -260,7 +261,9 @@ template <bool IS_SIGNED = false> class Int128 {
return LeadingZeroBitCount(high_);
}
}
+ RT_VAR_GROUP_BEGIN
static constexpr std::uint64_t topBit{std::uint64_t{1} << 63};
+ RT_VAR_GROUP_END
#if FLANG_LITTLE_ENDIAN
std::uint64_t low_{0}, high_{0};
#elif FLANG_BIG_ENDIAN
diff --git a/flang/include/flang/Common/visit.h b/flang/include/flang/Common/visit.h
index f733b726189c88..9d9048c8f4bf10 100644
--- a/flang/include/flang/Common/visit.h
+++ b/flang/include/flang/Common/visit.h
@@ -21,6 +21,7 @@
#ifndef FORTRAN_COMMON_VISIT_H_
#define FORTRAN_COMMON_VISIT_H_
+#include "flang/Runtime/api-attrs.h"
#include <type_traits>
#include <variant>
@@ -29,7 +30,7 @@ namespace log2visit {
template <std::size_t LOW, std::size_t HIGH, typename RESULT, typename VISITOR,
typename... VARIANT>
-inline RESULT Log2VisitHelper(
+inline RT_API_ATTRS RESULT Log2VisitHelper(
VISITOR &&visitor, std::size_t which, VARIANT &&...u) {
if constexpr (LOW + 7 >= HIGH) {
switch (which - LOW) {
@@ -61,7 +62,7 @@ inline RESULT Log2VisitHelper(
}
template <typename VISITOR, typename... VARIANT>
-inline auto visit(VISITOR &&visitor, VARIANT &&...u)
+inline RT_API_ATTRS auto visit(VISITOR &&visitor, VARIANT &&...u)
-> decltype(visitor(std::get<0>(std::forward<VARIANT>(u))...)) {
using Result = decltype(visitor(std::get<0>(std::forward<VARIANT>(u))...));
if constexpr (sizeof...(u) == 1) {
diff --git a/flang/include/flang/Decimal/binary-floating-point.h b/flang/include/flang/Decimal/binary-floating-point.h
index d1992819f85aa6..1c8829550043de 100644
--- a/flang/include/flang/Decimal/binary-floating-point.h
+++ b/flang/include/flang/Decimal/binary-floating-point.h
@@ -14,6 +14,7 @@
#include "flang/Common/real.h"
#include "flang/Common/uint128.h"
+#include "flang/Runtime/api-attrs.h"
#include <cinttypes>
#include <climits>
#include <cstring>
@@ -47,9 +48,11 @@ class BinaryFloatingPointNumber : public common::RealDetails<BINARY_PRECISION> {
using RawType = common::HostUnsignedIntType<bits>;
static_assert(CHAR_BIT * sizeof(RawType) >= bits);
+ RT_OFFLOAD_VAR_GROUP_BEGIN
static constexpr RawType significandMask{(RawType{1} << significandBits) - 1};
- constexpr BinaryFloatingPointNumber() {} // zero
+ constexpr RT_API_ATTRS BinaryFloatingPointNumber() {} // zero
+ RT_OFFLOAD_VAR_GROUP_END
constexpr BinaryFloatingPointNumber(
const BinaryFloatingPointNumber &that) = default;
constexpr BinaryFloatingPointNumber(
@@ -58,26 +61,30 @@ class BinaryFloatingPointNumber : public common::RealDetails<BINARY_PRECISION> {
const BinaryFloatingPointNumber &that) = default;
constexpr BinaryFloatingPointNumber &operator=(
BinaryFloatingPointNumber &&that) = default;
- constexpr explicit BinaryFloatingPointNumber(RawType raw) : raw_{raw} {}
+ constexpr explicit RT_API_ATTRS BinaryFloatingPointNumber(RawType raw)
+ : raw_{raw} {}
- RawType raw() const { return raw_; }
+ RT_API_ATTRS RawType raw() const { return raw_; }
- template <typename A> explicit constexpr BinaryFloatingPointNumber(A x) {
+ template <typename A>
+ explicit constexpr RT_API_ATTRS BinaryFloatingPointNumber(A x) {
static_assert(sizeof raw_ <= sizeof x);
std::memcpy(reinterpret_cast<void *>(&raw_),
reinterpret_cast<const void *>(&x), sizeof raw_);
}
- constexpr int BiasedExponent() const {
+ constexpr RT_API_ATTRS int BiasedExponent() const {
return static_cast<int>(
(raw_ >> significandBits) & ((1 << exponentBits) - 1));
}
- constexpr int UnbiasedExponent() const {
+ constexpr RT_API_ATTRS int UnbiasedExponent() const {
int biased{BiasedExponent()};
return biased - exponentBias + (biased == 0);
}
- constexpr RawType Significand() const { return raw_ & significandMask; }
- constexpr RawType Fraction() const {
+ constexpr RT_API_ATTRS RawType Significand() const {
+ return raw_ & significandMask;
+ }
+ constexpr RT_API_ATTRS RawType Fraction() const {
RawType sig{Significand()};
if (isImplicitMSB && BiasedExponent() > 0) {
sig |= RawType{1} << significandBits;
@@ -85,10 +92,10 @@ class BinaryFloatingPointNumber : public common::RealDetails<BINARY_PRECISION> {
return sig;
}
- constexpr bool IsZero() const {
+ constexpr RT_API_ATTRS bool IsZero() const {
return (raw_ & ((RawType{1} << (bits - 1)) - 1)) == 0;
}
- constexpr bool IsNaN() const {
+ constexpr RT_API_ATTRS bool IsNaN() const {
auto expo{BiasedExponent()};
auto sig{Significand()};
if constexpr (bits == 80) { // x87
@@ -102,7 +109,7 @@ class BinaryFloatingPointNumber : public common::RealDetails<BINARY_PRECISION> {
return expo == maxExponent && sig != 0;
}
}
- constexpr bool IsInfinite() const {
+ constexpr RT_API_ATTRS bool IsInfinite() const {
if constexpr (bits == 80) { // x87
return BiasedExponent() == maxExponent &&
Significand() == ((significandMask >> 1) + 1);
@@ -110,27 +117,30 @@ class BinaryFloatingPointNumber : public common::RealDetails<BINARY_PRECISION> {
return BiasedExponent() == maxExponent && Significand() == 0;
}
}
- constexpr bool IsMaximalFiniteMagnitude() const {
+ constexpr RT_API_ATTRS bool IsMaximalFiniteMagnitude() const {
return BiasedExponent() == maxExponent - 1 &&
Significand() == significandMask;
}
- constexpr bool IsNegative() const { return ((raw_ >> (bits - 1)) & 1) != 0; }
+ constexpr RT_API_ATTRS bool IsNegative() const {
+ return ((raw_ >> (bits - 1)) & 1) != 0;
+ }
- constexpr void Negate() { raw_ ^= RawType{1} << (bits - 1); }
+ constexpr RT_API_ATTRS void Negate() { raw_ ^= RawType{1} << (bits - 1); }
// For calculating the nearest neighbors of a floating-point value
- constexpr void Previous() {
+ constexpr RT_API_ATTRS void Previous() {
RemoveExplicitMSB();
--raw_;
InsertExplicitMSB();
}
- constexpr void Next() {
+ constexpr RT_API_ATTRS void Next() {
RemoveExplicitMSB();
++raw_;
InsertExplicitMSB();
}
- static constexpr BinaryFloatingPointNumber Infinity(bool isNegative) {
+ static constexpr RT_API_ATTRS BinaryFloatingPointNumber Infinity(
+ bool isNegative) {
RawType result{RawType{maxExponent} << significandBits};
if (isNegative) {
result |= RawType{1} << (bits - 1);
@@ -139,7 +149,8 @@ class BinaryFloatingPointNumber : public common::RealDetails<BINARY_PRECISION> {
}
// Returns true when the result is exact
- constexpr bool RoundToBits(int keepBits, enum FortranRounding mode) {
+ constexpr RT_API_ATTRS bool RoundToBits(
+ int keepBits, enum FortranRounding mode) {
if (IsNaN() || IsInfinite() || keepBits >= binaryPrecision) {
return true;
}
@@ -180,12 +191,12 @@ class BinaryFloatingPointNumber : public common::RealDetails<BINARY_PRECISION> {
}
private:
- constexpr void RemoveExplicitMSB() {
+ constexpr RT_API_ATTRS void RemoveExplicitMSB() {
if constexpr (!isImplicitMSB) {
raw_ = (raw_ & (significandMask >> 1)) | ((raw_ & ~significandMask) >> 1);
}
}
- constexpr void InsertExplicitMSB() {
+ constexpr RT_API_ATTRS void InsertExplicitMSB() {
if constexpr (!isImplicitMSB) {
constexpr RawType mask{significandMask >> 1};
raw_ = (raw_ & mask) | ((raw_ & ~mask) << 1);
diff --git a/flang/include/flang/Decimal/decimal.h b/flang/include/flang/Decimal/decimal.h
index f0997fb63df018..aeda01c44fa6f6 100644
--- a/flang/include/flang/Decimal/decimal.h
+++ b/flang/include/flang/Decimal/decimal.h
@@ -12,6 +12,7 @@
#ifndef FORTRAN_DECIMAL_DECIMAL_H_
#define FORTRAN_DECIMAL_DECIMAL_H_
+#include "flang/Runtime/api-attrs.h"
#include <stddef.h>
#ifdef __cplusplus
@@ -65,27 +66,27 @@ enum DecimalConversionFlags {
#ifdef __cplusplus
template <int PREC>
-ConversionToDecimalResult ConvertToDecimal(char *, size_t,
+RT_API_ATTRS ConversionToDecimalResult ConvertToDecimal(char *, size_t,
DecimalConversionFlags, int digits, enum FortranRounding rounding,
BinaryFloatingPointNumber<PREC> x);
-extern template ConversionToDecimalResult ConvertToDecimal<8>(char *, size_t,
- enum DecimalConversionFlags, int, enum FortranRounding,
+extern template RT_API_ATTRS ConversionToDecimalResult ConvertToDecimal<8>(
+ char *, size_t, enum DecimalConversionFlags, int, enum FortranRounding,
BinaryFloatingPointNumber<8>);
-extern template ConversionToDecimalResult ConvertToDecimal<11>(char *, size_t,
- enum DecimalConversionFlags, int, enum FortranRounding,
+extern template RT_API_ATTRS ConversionToDecimalResult ConvertToDecimal<11>(
+ char *, size_t, enum DecimalConversionFlags, int, enum FortranRounding,
BinaryFloatingPointNumber<11>);
-extern template ConversionToDecimalResult ConvertToDecimal<24>(char *, size_t,
- enum DecimalConversionFlags, int, enum FortranRounding,
+extern template RT_API_ATTRS ConversionToDecimalResult ConvertToDecimal<24>(
+ char *, size_t, enum DecimalConversionFlags, int, enum FortranRounding,
BinaryFloatingPointNumber<24>);
-extern template ConversionToDecimalResult ConvertToDecimal<53>(char *, size_t,
- enum DecimalConversionFlags, int, enum FortranRounding,
+extern template RT_API_ATTRS ConversionToDecimalResult ConvertToDecimal<53>(
+ char *, size_t, enum DecimalConversionFlags, int, enum FortranRounding,
BinaryFloatingPointNumber<53>);
-extern template ConversionToDecimalResult ConvertToDecimal<64>(char *, size_t,
- enum DecimalConversionFlags, int, enum FortranRounding,
+extern template RT_API_ATTRS ConversionToDecimalResult ConvertToDecimal<64>(
+ char *, size_t, enum DecimalConversionFlags, int, enum FortranRounding,
BinaryFloatingPointNumber<64>);
-extern template ConversionToDecimalResult ConvertToDecimal<113>(char *, size_t,
- enum DecimalConversionFlags, int, enum FortranRounding,
+extern template RT_API_ATTRS ConversionToDecimalResult ConvertToDecimal<113>(
+ char *, size_t, enum DecimalConversionFlags, int, enum FortranRounding,
BinaryFloatingPointNumber<113>);
template <int PREC> struct ConversionToBinaryResult {
@@ -94,20 +95,20 @@ template <int PREC> struct ConversionToBinaryResult {
};
template <int PREC>
-ConversionToBinaryResult<PREC> ConvertToBinary(const char *&,
+RT_API_ATTRS ConversionToBinaryResult<PREC> ConvertToBinary(const char *&,
enum FortranRounding = RoundNearest, const char *end = nullptr);
-extern template ConversionToBinaryResult<8> ConvertToBinary<8>(
+extern template RT_API_ATTRS ConversionToBinaryResult<8> ConvertToBinary<8>(
const char *&, enum FortranRounding, const char *end);
-extern template ConversionToBinaryResult<11> ConvertToBinary<11>(
+extern template RT_API_ATTRS ConversionToBinaryResult<11> ConvertToBinary<11>(
const char *&, enum FortranRounding, const char *end);
-extern template ConversionToBinaryResult<24> ConvertToBinary<24>(
+extern template RT_API_ATTRS ConversionToBinaryResult<24> ConvertToBinary<24>(
const char *&, enum FortranRounding, const char *end);
-extern template ConversionToBinaryResult<53> ConvertToBinary<53>(
+extern template RT_API_ATTRS ConversionToBinaryResult<53> ConvertToBinary<53>(
const char *&, enum FortranRounding, const char *end);
-extern template ConversionToBinaryResult<64> ConvertToBinary<64>(
+extern template RT_API_ATTRS ConversionToBinaryResult<64> ConvertToBinary<64>(
const char *&, enum FortranRounding, const char *end);
-extern template ConversionToBinaryResult<113> ConvertToBinary<113>(
+extern template RT_API_ATTRS ConversionToBinaryResult<113> ConvertToBinary<113>(
const char *&, enum FortranRounding, const char *end);
} // namespace Fortran::decimal
extern "C" {
@@ -116,21 +117,21 @@ extern "C" {
#define NS(x) x
#endif /* C++ */
-struct NS(ConversionToDecimalResult)
+RT_API_ATTRS struct NS(ConversionToDecimalResult)
ConvertFloatToDecimal(char *, size_t, enum NS(DecimalConversionFlags),
int digits, enum NS(FortranRounding), float);
-struct NS(ConversionToDecimalResult)
+RT_API_ATTRS struct NS(ConversionToDecimalResult)
ConvertDoubleToDecimal(char *, size_t, enum NS(DecimalConversionFlags),
int digits, enum NS(FortranRounding), double);
-struct NS(ConversionToDecimalResult)
+RT_API_ATTRS struct NS(ConversionToDecimalResult)
ConvertLongDoubleToDecimal(char *, size_t, enum NS(DecimalConversionFlags),
int digits, enum NS(FortranRounding), long double);
-enum NS(ConversionResultFlags)
+RT_API_ATTRS enum NS(ConversionResultFlags)
ConvertDecimalToFloat(const char **, float *, enum NS(FortranRounding));
-enum NS(ConversionResultFlags)
+RT_API_ATTRS enum NS(ConversionResultFlags)
ConvertDecimalToDouble(const char **, double *, enum NS(FortranRounding));
-enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
+RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
const char **, long double *, enum NS(FortranRounding));
#undef NS
#ifdef __cplusplus
diff --git a/flang/include/flang/Runtime/api-attrs.h b/flang/include/flang/Runtime/api-attrs.h
index fc3eb42e1b73f5..050d2366b8e165 100644
--- a/flang/include/flang/Runtime/api-attrs.h
+++ b/flang/include/flang/Runtime/api-attrs.h
@@ -102,7 +102,7 @@
* to appear as part of a C++ decl-specifier.
*/
#ifndef RT_CONST_VAR_ATTRS
-#if defined(__CUDACC__) || defined(__CUDA__)
+#if (defined(__CUDACC__) || defined(__CUDA__)) && defined(__CUDA_ARCH__)
#define RT_CONST_VAR_ATTRS __constant__
#else
#define RT_CONST_VAR_ATTRS
diff --git a/flang/include/flang/Runtime/io-api.h b/flang/include/flang/Runtime/io-api.h
index 556cc20c5a121e..1b6c4f5d6a65ca 100644
--- a/flang/include/flang/Runtime/io-api.h
+++ b/flang/include/flang/Runtime/io-api.h
@@ -51,13 +51,21 @@ constexpr InquiryKeywordHash HashInquiryKeyword(const char *p) {
return hash;
}
-const char *InquiryKeywordHashDecode(
+RT_API_ATTRS const char *InquiryKeywordHashDecode(
char *buffer, std::size_t, InquiryKeywordHash);
extern "C" {
#define IONAME(name) RTNAME(io##name)
+#ifndef IODECL
+#define IODECL(name) RT_API_ATTRS IONAME(name)
+#endif
+
+#ifndef IODEF
+#define IODEF(name) RT_API_ATTRS IONAME(name)
+#endif
+
// These functions initiate data transfer statements (READ, WRITE, PRINT).
// Example: PRINT *, 666 is implemented as the series of calls:
// Cookie cookie{BeginExternalListOutput(DefaultOutputUnit,
@@ -139,7 +147,7 @@ enum Iostat IONAME(CheckUnitNumberInRange128)(common::int128_t unit,
const char *sourceFile = nullptr, int sourceLine = 0);
// External synchronous I/O initiation
-Cookie IONAME(BeginExternalListOutput)(ExternalUnit = DefaultOutputUnit,
+Cookie IODECL(BeginExternalListOutput)(ExternalUnit = DefaultOutputUnit,
const char *sourceFile = nullptr, int sourceLine = 0);
Cookie IONAME(BeginExternalListInput)(ExternalUnit = DefaultInputUnit,
const char *sourceFile = nullptr, int sourceLine = 0);
@@ -253,7 +261,7 @@ bool IONAME(InputDescriptor)(Cookie, const Descriptor &);
// Formatted (including list directed) I/O data items
bool IONAME(OutputInteger8)(Cookie, std::int8_t);
bool IONAME(OutputInteger16)(Cookie, std::int16_t);
-bool IONAME(OutputInteger32)(Cookie, std::int32_t);
+bool IODECL(OutputInteger32)(Cookie, std::int32_t);
bool IONAME(OutputInteger64)(Cookie, std::int64_t);
bool IONAME(OutputInteger128)(Cookie, common::int128_t);
bool IONAME(InputInteger)(Cookie, std::int64_t &, int kind = 8);
@@ -357,7 +365,7 @@ bool IONAME(InquireInteger64)(
// returned is guaranteed to only be one of the problems that the
// EnableHandlers() call has indicated should be handled in compiled code
// rather than by terminating the image.
-enum Iostat IONAME(EndIoStatement)(Cookie);
+enum Iostat IODECL(EndIoStatement)(Cookie);
} // extern "C"
} // namespace Fortran::runtime::io
diff --git a/flang/include/flang/Runtime/iostat.h b/flang/include/flang/Runtime/iostat.h
index afce509cf1f564..c3ec8cae858163 100644
--- a/flang/include/flang/Runtime/iostat.h
+++ b/flang/include/flang/Runtime/iostat.h
@@ -11,6 +11,7 @@
#ifndef FORTRAN_RUNTIME_IOSTAT_H_
#define FORTRAN_RUNTIME_IOSTAT_H_
+#include "flang/Runtime/api-attrs.h"
#include "flang/Runtime/magic-numbers.h"
namespace Fortran::runtime::io {
@@ -88,7 +89,7 @@ enum Iostat {
IostatNonExternalDefinedUnformattedIo,
};
-const char *IostatErrorString(int);
+RT_API_ATTRS const char *IostatErrorString(int);
} // namespace Fortran::runtime::io
#endif // FORTRAN_RUNTIME_IOSTAT_H_
diff --git a/flang/include/flang/Runtime/memory.h b/flang/include/flang/Runtime/memory.h
index e24c509f4e90cb..0f2e7c3904f580 100644
--- a/flang/include/flang/Runtime/memory.h
+++ b/flang/include/flang/Runtime/memory.h
@@ -79,6 +79,8 @@ template <typename A> class OwningPtr {
return p;
}
+ RT_DIAG_PUSH
+ RT_DIAG_DISABLE_CALL_HOST_FROM_DEVICE_WARN
// Replace the pointer.
RT_API_ATTRS void reset(pointer_type p = pointer_type{}) {
std::swap(ptr_, p);
@@ -90,6 +92,7 @@ template <typename A> class OwningPtr {
// Exchange the pointer with another object.
RT_API_ATTRS void swap(OwningPtr &other) { std::swap(ptr_, other.ptr_); }
+ RT_DIAG_POP
// Get the stored pointer.
RT_API_ATTRS pointer_type get() const { return ptr_; }
@@ -128,9 +131,12 @@ inline RT_API_ATTRS bool operator!=(std::nullptr_t, const OwningPtr<X> &x) {
template <typename A> class SizedNew {
public:
- explicit SizedN...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
✅ With the latest revision this PR passed the Python code formatter. |
This commit adds required files into the offload build closure,
which means adding RT_API_ATTRS and other markers.
The implementation does not work for CUDA yet, because of
std::variant,swap,reverse usage. These issues will be resolved
separately (e.g. by using libcudacxx header files).