File tree Expand file tree Collapse file tree 5 files changed +23
-32
lines changed Expand file tree Collapse file tree 5 files changed +23
-32
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,21 @@ class Terminator {
115115RT_API_ATTRS void NotifyOtherImagesOfNormalEnd ();
116116RT_API_ATTRS void NotifyOtherImagesOfFailImageStatement ();
117117RT_API_ATTRS void NotifyOtherImagesOfErrorTermination ();
118+
119+ #if defined(RT_DEVICE_COMPILATION)
120+ // / Trap the execution on the device.
121+ [[noreturn]] void RT_API_ATTRS DeviceTrap () {
122+ #if defined(__CUDACC__)
123+ // NVCC supports __trap().
124+ __trap ();
125+ #elif defined(__clang__)
126+ // Clang supports __builtin_trap().
127+ __builtin_trap ();
128+ #else
129+ #error "unsupported compiler"
130+ #endif
131+ }
132+ #endif
118133} // namespace Fortran::runtime
119134
120135namespace Fortran ::runtime::io {
Original file line number Diff line number Diff line change 2323
2424extern " C" {
2525
26- static void DescribeIEEESignaledExceptions () {
26+ [[maybe_unused]] static void DescribeIEEESignaledExceptions () {
2727#ifdef fetestexcept // a macro in some environments; omit std::
2828 auto excepts{fetestexcept (FE_ALL_EXCEPT)};
2929#else
@@ -82,15 +82,7 @@ static void CloseAllExternalUnits(const char *why) {
8282 }
8383 std::printf (" \n " );
8484 }
85- #if defined(__CUDACC__)
86- // NVCC supports __trap().
87- __trap ();
88- #elif defined(__clang__)
89- // Clang supports __builtin_trap().
90- __builtin_trap ();
91- #else
92- #error "unsupported compiler"
93- #endif
85+ Fortran::runtime::DeviceTrap ();
9486#else
9587 CloseAllExternalUnits (" STOP statement" );
9688 if (Fortran::runtime::executionEnvironment.noStopMessage && code == 0 ) {
@@ -119,17 +111,7 @@ static void CloseAllExternalUnits(const char *why) {
119111 " Fortran %s: %s\n " , isErrorStop ? " ERROR STOP" : " STOP" , code);
120112 }
121113 }
122- if (isErrorStop) {
123- #if defined(__CUDACC__)
124- // NVCC supports __trap().
125- __trap ();
126- #elif defined(__clang__)
127- // Clang supports __builtin_trap().
128- __builtin_trap ();
129- #else
130- #error "unsupported compiler"
131- #endif
132- }
114+ Fortran::runtime::DeviceTrap ();
133115#else
134116 CloseAllExternalUnits (" STOP statement" );
135117 if (!quiet) {
Original file line number Diff line number Diff line change @@ -75,15 +75,7 @@ RT_API_ATTRS void Terminator::CrashHeader() const {
7575#endif
7676 NotifyOtherImagesOfErrorTermination ();
7777#if defined(RT_DEVICE_COMPILATION)
78- #if defined(__CUDACC__)
79- // NVCC supports __trap().
80- __trap ();
81- #elif defined(__clang__)
82- // Clang supports __builtin_trap().
83- __builtin_trap ();
84- #else
85- #error "unsupported compiler"
86- #endif
78+ DeviceTrap ();
8779#else
8880 std::abort ();
8981#endif
Original file line number Diff line number Diff line change 1717#ifndef FORTRAN_COMMON_ENUM_CLASS_H_
1818#define FORTRAN_COMMON_ENUM_CLASS_H_
1919
20- #include " flang/Common/variant.h"
2120#include < array>
2221#include < string>
2322
Original file line number Diff line number Diff line change 1616
1717#include " flang/Common/api-attrs.h"
1818
19- #if RT_USE_LIBCUDACXX && defined(RT_DEVICE_COMPILATION)
19+ #if RT_USE_LIBCUDACXX
2020#include < cuda/std/complex>
21+ #endif
22+
23+ #if RT_USE_LIBCUDACXX && defined(RT_DEVICE_COMPILATION)
2124namespace Fortran ::runtime::rtcmplx {
2225using cuda::std::complex ;
2326using cuda::std::conj;
You can’t perform that action at this time.
0 commit comments