Skip to content

Commit a174e84

Browse files
committed
[flang][runtime] Replace recursion with iterative work queue
Recursion, both direct and indirect, prevents accurate stack size calculation at link time for GPU device code. Restructure these recursive (often mutually so) routines in the Fortran runtime with new implementations based on an iterative work queue with suspendable/resumable work tickets: Assign, Initialize, initializeClone, Finalize, and Destroy. Descriptor-based I/O is now also supported. Note that derived type FINAL subroutine calls, defined assignments, and defined I/O procedures all perform callbacks into user code, which may well reenter the runtime library. This kind of recursion is not handled by this change, although it may be possible to do so in the future using thread-local work queues. The effects of this restructuring on CPU performance are yet to be measured.
1 parent b7e13ab commit a174e84

File tree

14 files changed

+1825
-1085
lines changed

14 files changed

+1825
-1085
lines changed

flang-rt/include/flang-rt/runtime/environment.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct ExecutionEnvironment {
6363
bool noStopMessage{false}; // NO_STOP_MESSAGE=1 inhibits "Fortran STOP"
6464
bool defaultUTF8{false}; // DEFAULT_UTF8
6565
bool checkPointerDeallocation{true}; // FORT_CHECK_POINTER_DEALLOCATION
66+
int internalDebugging{0}; // FLANG_RT_DEBUG
6667

6768
// CUDA related variables
6869
std::size_t cudaStackLimit{0}; // ACC_OFFLOAD_STACK_SIZE

0 commit comments

Comments
 (0)