[all-commits] [llvm/llvm-project] 9f44d5: [flang] Simplify copy-in copy-out runtime API (#95...

jeanPerier via All-commits all-commits at lists.llvm.org
Tue Jun 18 03:04:27 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f44d5d9d0903adaa9deb35d33056202e5030cb3
      https://github.com/llvm/llvm-project/commit/9f44d5d9d0903adaa9deb35d33056202e5030cb3
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-06-18 (Tue, 18 Jun 2024)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/Runtime/Assign.h
    M flang/include/flang/Optimizer/Dialect/FIRType.h
    M flang/include/flang/Optimizer/HLFIR/HLFIROps.td
    M flang/include/flang/Runtime/assign.h
    M flang/lib/Lower/ConvertCall.cpp
    M flang/lib/Lower/ConvertExpr.cpp
    M flang/lib/Optimizer/Builder/Runtime/Assign.cpp
    M flang/lib/Optimizer/Dialect/FIRType.cpp
    M flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
    M flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
    M flang/runtime/assign.cpp
    M flang/test/HLFIR/assumed-type-actual-args.f90
    M flang/test/HLFIR/assumed_shape_with_value_keyword.f90
    M flang/test/HLFIR/copy-in-out-codegen.fir
    M flang/test/HLFIR/copy-in-out.fir
    M flang/test/HLFIR/memory-effects.fir
    M flang/test/Lower/HLFIR/call-sequence-associated-descriptors.f90
    M flang/test/Lower/HLFIR/calls-assumed-shape.f90
    M flang/test/Lower/HLFIR/calls-constant-expr-arg.f90
    M flang/test/Lower/HLFIR/calls-optional.f90
    M flang/test/Lower/HLFIR/calls-poly-to-assumed-type.f90
    M flang/test/Lower/HLFIR/poly_expr_for_nonpoly_dummy.f90
    M flang/test/Lower/call-copy-in-out.f90
    M flang/test/Lower/dummy-argument-assumed-shape-optional.f90
    M flang/test/Lower/dummy-argument-optional-2.f90
    M flang/test/Lower/optional-value-caller.f90

  Log Message:
  -----------
  [flang] Simplify copy-in copy-out runtime API (#95822)

The runtime API for copy-in copy-out currently only has an entry only
for the copy-out. This entry has a "skipInit" boolean that is never set
to false by lowering and it does not deal with the deallocation of the
temporary.

The generated code was a mix of inline code and runtime calls This is not a big deal,
but this is unneeded compiler and generated code complexity.
With assumed-rank, it is also more cumbersome to establish a
temporary descriptor.

Instead, this patch:
- Adds a CopyInAssignment API that deals with establishing the temporary
descriptor and does the copy.
- Removes unused arg to CopyOutAssign, and pushes
destruction/deallocation responsibility inside it.

Note that this runtime API are still not responsible for deciding the
need of copying-in and out. This is kept as a separate runtime call to
IsContiguous, which is easier to inline/replace by inline code with the
hope of removing the copy-in/out calls after user function inlining.
@vzakhari has already shown that always inlining all the copy part
increase Fortran compilation time due to loop optimization attempts for
loops that are known to have little optimization profitability (the
variable being copied from and to is not contiguous).



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