[flang][runtime] Enable more code for offload device builds. (#67489)

I extended the "closure" of the device code containing the initial
transformational.cpp. The device side of the library should not be
complete at least for some APIs. For example, I tested with C OpenMP
code calling BesselJnX0 with a nullptr descriptor that failed with
a runtime error when executing on a GPU.

I added `--expt-relaxed-constexpr` for NVCC compiler to avoid multiple
warnings about missing `__attribute__((device))` on constexpr methods
coming from C++ header files.
This commit is contained in:
Slava Zakharin
2023-09-27 08:20:17 -07:00
committed by GitHub
parent 21c2ba4bdb
commit 4bdec5830b
12 changed files with 400 additions and 154 deletions

View File

@@ -10,7 +10,9 @@
namespace Fortran::runtime {
TypeCode::TypeCode(TypeCategory f, int kind) {
RT_OFFLOAD_API_GROUP_BEGIN
RT_API_ATTRS TypeCode::TypeCode(TypeCategory f, int kind) {
switch (f) {
case TypeCategory::Integer:
switch (kind) {
@@ -110,7 +112,7 @@ TypeCode::TypeCode(TypeCategory f, int kind) {
}
}
std::optional<std::pair<TypeCategory, int>>
RT_API_ATTRS std::optional<std::pair<TypeCategory, int>>
TypeCode::GetCategoryAndKind() const {
switch (raw_) {
case CFI_type_signed_char:
@@ -205,4 +207,7 @@ TypeCode::GetCategoryAndKind() const {
return std::nullopt;
}
}
RT_OFFLOAD_API_GROUP_END
} // namespace Fortran::runtime