[all-commits] [llvm/llvm-project] 163c67: [flang][runtime] Replace recursion with iterative ...

Peter Klausler via All-commits all-commits at lists.llvm.org
Tue Jun 10 14:44:40 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 163c67ad3d1bf7af6590930d8f18700d65ad4564
      https://github.com/llvm/llvm-project/commit/163c67ad3d1bf7af6590930d8f18700d65ad4564
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2025-06-10 (Tue, 10 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

  Log Message:
  -----------
  [flang][runtime] Replace recursion with iterative work queue (#137727)

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.

The effects of this restructuring on CPU performance are yet to be
measured.



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