[all-commits] [llvm/llvm-project] 467913: [flang] Lower ASYNCHRONOUS variables and IO statem...

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Jan 31 06:54:27 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4679132a85c6c4cced2a71ef6422b793ae39598c
      https://github.com/llvm/llvm-project/commit/4679132a85c6c4cced2a71ef6422b793ae39598c
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-01-31 (Wed, 31 Jan 2024)

  Changed paths:
    M flang/include/flang/Runtime/io-api.h
    M flang/lib/Lower/CallInterface.cpp
    M flang/lib/Lower/IO.cpp
    M flang/runtime/io-api.cpp
    A flang/test/Lower/io-asynchronous.f90
    M flang/test/Lower/io-statement-1.f90

  Log Message:
  -----------
  [flang] Lower ASYNCHRONOUS variables and IO statements (#80008)

Finish plugging-in ASYNCHRONOUS IO in lowering (GetAsynchronousId was
not used yet).

Add a runtime implementation for GetAsynchronousId (only the signature
was defined). Always return zero since flang runtime "fakes"
asynchronous IO (data transfer are always complete, see
flang/docs/IORuntimeInternals.md).

Update all runtime integer argument and results for IDs to use the
AsynchronousId int alias for consistency.

In lowering, asynchronous attribute is added on the hlfir.declare of
ASYNCHRONOUS variable, but nothing else is done. This is OK given the
synchronous aspects of flang IO, but it would be safer to treat these
variable as volatile (prevent code motion of related store/loads) since
the asynchronous data change can also be done by C defined user
procedure (see 18.10.4 Asynchronous communication). Flang lowering
anyway does not give enough info for LLVM to do such code motions (the
variables that are passed in a call are not given the noescape
attribute, so LLVM will assume any later opaque call may modify the
related data and would not move load/stores of such variables
before/after calls even if it could from a pure Fortran point of view
without ASYNCHRONOUS).




More information about the All-commits mailing list