Skip to content

Commit 3ba0791

Browse files
authored
[flang][runtime] Added missing routines into CUDA build. (#90272)
Apparently, nvcc does not compile for device the routines whose definitions are not marked with device attribute (note that the forward declarations are already marked). It looks like it is different for class members, i.e. marking just the declarations is enough.
1 parent 91f251c commit 3ba0791

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

flang/runtime/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ set(supported_files
192192
environment.cpp
193193
extrema.cpp
194194
external-unit.cpp
195+
file.cpp
195196
findloc.cpp
196197
format.cpp
197198
inquiry.cpp

flang/runtime/file.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,22 +457,22 @@ std::int64_t SizeInBytes(const char *path) {
457457
return -1;
458458
}
459459
#else // defined(RT_DEVICE_COMPILATION)
460-
bool IsATerminal(int fd) {
460+
RT_API_ATTRS bool IsATerminal(int fd) {
461461
Terminator{__FILE__, __LINE__}.Crash("%s: unsupported", RT_PRETTY_FUNCTION);
462462
}
463-
bool IsExtant(const char *path) {
463+
RT_API_ATTRS bool IsExtant(const char *path) {
464464
Terminator{__FILE__, __LINE__}.Crash("%s: unsupported", RT_PRETTY_FUNCTION);
465465
}
466-
bool MayRead(const char *path) {
466+
RT_API_ATTRS bool MayRead(const char *path) {
467467
Terminator{__FILE__, __LINE__}.Crash("%s: unsupported", RT_PRETTY_FUNCTION);
468468
}
469-
bool MayWrite(const char *path) {
469+
RT_API_ATTRS bool MayWrite(const char *path) {
470470
Terminator{__FILE__, __LINE__}.Crash("%s: unsupported", RT_PRETTY_FUNCTION);
471471
}
472-
bool MayReadAndWrite(const char *path) {
472+
RT_API_ATTRS bool MayReadAndWrite(const char *path) {
473473
Terminator{__FILE__, __LINE__}.Crash("%s: unsupported", RT_PRETTY_FUNCTION);
474474
}
475-
std::int64_t SizeInBytes(const char *path) {
475+
RT_API_ATTRS std::int64_t SizeInBytes(const char *path) {
476476
Terminator{__FILE__, __LINE__}.Crash("%s: unsupported", RT_PRETTY_FUNCTION);
477477
}
478478
#endif // defined(RT_DEVICE_COMPILATION)

flang/runtime/namelist.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ bool IODEF(InputNamelist)(Cookie cookie, const NamelistGroup &group) {
596596
return true;
597597
}
598598

599-
bool IsNamelistNameOrSlash(IoStatementState &io) {
599+
RT_API_ATTRS bool IsNamelistNameOrSlash(IoStatementState &io) {
600600
if (auto *listInput{
601601
io.get_if<ListDirectedStatementState<Direction::Input>>()}) {
602602
if (listInput->inNamelistSequence()) {

0 commit comments

Comments
 (0)