[all-commits] [llvm/llvm-project] 2bf3cc: [flang] Restructure runtime to avoid recursion (re...

Peter Klausler via All-commits all-commits at lists.llvm.org
Mon Jun 16 14:37:23 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2bf3ccabfa37ee1b2d74da7b370cdb16a5cc8ac0
      https://github.com/llvm/llvm-project/commit/2bf3ccabfa37ee1b2d74da7b370cdb16a5cc8ac0
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2025-06-16 (Mon, 16 Jun 2025)

  Changed paths:
    M flang-rt/include/flang-rt/runtime/environment.h
    M flang-rt/include/flang-rt/runtime/stat.h
    M flang-rt/include/flang-rt/runtime/type-info.h
    A flang-rt/include/flang-rt/runtime/work-queue.h
    M flang-rt/lib/runtime/CMakeLists.txt
    M flang-rt/lib/runtime/assign.cpp
    M flang-rt/lib/runtime/derived.cpp
    M flang-rt/lib/runtime/descriptor-io.cpp
    M flang-rt/lib/runtime/descriptor-io.h
    M flang-rt/lib/runtime/environment.cpp
    M flang-rt/lib/runtime/namelist.cpp
    M flang-rt/lib/runtime/tools.cpp
    M flang-rt/lib/runtime/type-info.cpp
    A flang-rt/lib/runtime/work-queue.cpp
    M flang-rt/unittests/Runtime/ExternalIOTest.cpp
    M flang/docs/Extensions.md
    M flang/include/flang/Runtime/assign.h
    M flang/include/flang/Semantics/tools.h
    M flang/lib/Semantics/runtime-type-info.cpp
    M flang/lib/Semantics/tools.cpp
    M flang/module/__fortran_type_info.f90
    M flang/test/Lower/volatile-openmp.f90
    M flang/test/Semantics/typeinfo01.f90
    M flang/test/Semantics/typeinfo03.f90
    M flang/test/Semantics/typeinfo04.f90
    M flang/test/Semantics/typeinfo05.f90
    M flang/test/Semantics/typeinfo06.f90
    M flang/test/Semantics/typeinfo07.f90
    M flang/test/Semantics/typeinfo08.f90
    M flang/test/Semantics/typeinfo11.f90
    A flang/test/Semantics/typeinfo12.f90
    M flang/test/Semantics/typeinfo13.f90

  Log Message:
  -----------
  [flang] Restructure runtime to avoid recursion (relanding) (#143993)

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.

Default derived type I/O is also recursive, but already disabled. It can
be added to this new framework later if the overall approach succeeds.

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.

(Relanding this patch after reverting initial attempt due to some test
failures that needed some time to analyze and fix.)

Fixes https://github.com/llvm/llvm-project/issues/142481.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list