[all-commits] [llvm/llvm-project] 12ba74: [flang] Do not produce result for void runtime cal...

Valentin Clement (バレンタイン クレメン) via All-commits all-commits at lists.llvm.org
Thu Jan 16 12:34:59 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 12ba74e181bd6641b532e271f3bfabf53066b1c0
      https://github.com/llvm/llvm-project/commit/12ba74e181bd6641b532e271f3bfabf53066b1c0
  Author: Valentin Clement (バレンタイン クレメン) <clementval at gmail.com>
  Date:   2025-01-16 (Thu, 16 Jan 2025)

  Changed paths:
    M flang/docs/OpenACC-descriptor-management.md
    M flang/docs/ParameterizedDerivedTypes.md
    M flang/docs/PolymorphicEntities.md
    M flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
    M flang/include/flang/Optimizer/Dialect/FIRType.h
    M flang/lib/Lower/Runtime.cpp
    M flang/lib/Optimizer/Builder/Runtime/Inquiry.cpp
    M flang/lib/Optimizer/Builder/Runtime/Intrinsics.cpp
    M flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
    M flang/lib/Optimizer/Builder/Runtime/Transformational.cpp
    M flang/test/Analysis/AliasAnalysis/ptr-component.fir
    M flang/test/Fir/CUDA/cuda-alloc-free.fir
    M flang/test/Fir/CUDA/cuda-allocate.fir
    M flang/test/Fir/CUDA/cuda-code-gen.mlir
    M flang/test/Fir/CUDA/cuda-constructor-2.f90
    M flang/test/Fir/CUDA/cuda-data-transfer.fir
    M flang/test/Fir/CUDA/cuda-global-addr.mlir
    M flang/test/Fir/abstract-result-2.fir
    M flang/test/Fir/array-value-copy-3.fir
    M flang/test/Fir/array-value-copy-4.fir
    M flang/test/Fir/boxproc-openmp.fir
    M flang/test/Fir/polymorphic.fir
    M flang/test/Fir/rebox_assumed_rank_codegen.fir
    M flang/test/Fir/tbaa-codegen2.fir
    M flang/test/HLFIR/all-lowering.fir
    M flang/test/HLFIR/any-elemental.fir
    M flang/test/HLFIR/any-lowering.fir
    M flang/test/HLFIR/assign-codegen.fir
    M flang/test/HLFIR/assumed_shape_with_value_keyword.f90
    M flang/test/HLFIR/boxchar_emboxing.f90
    M flang/test/HLFIR/bufferize-destroy-for-derived.fir
    M flang/test/HLFIR/bufferize-end-associate-for-derived.fir
    M flang/test/HLFIR/bufferize-poly-expr.fir
    M flang/test/HLFIR/bufferize01.fir
    M flang/test/HLFIR/copy-in-out-codegen.fir
    M flang/test/HLFIR/count-lowering-default-int-kinds.fir
    M flang/test/HLFIR/count-lowering.fir
    M flang/test/HLFIR/cshift-lowering.fir
    M flang/test/HLFIR/elemental-codegen.fir
    M flang/test/HLFIR/matmul-lowering.fir
    M flang/test/HLFIR/maxloc-lowering.fir
    M flang/test/HLFIR/maxval-lowering.fir
    M flang/test/HLFIR/minloc-lowering.fir
    M flang/test/HLFIR/minval-lowering.fir
    M flang/test/HLFIR/optional_dummy.f90
    M flang/test/HLFIR/order_assignments/lhs-conflicts-codegen.fir
    M flang/test/HLFIR/order_assignments/runtime-stack-temp.fir
    M flang/test/HLFIR/order_assignments/user-defined-assignment-finalization.fir
    M flang/test/HLFIR/product-lowering.fir
    M flang/test/HLFIR/sum-lowering.fir
    M flang/test/HLFIR/transpose-lowering.fir
    M flang/test/Integration/OpenMP/parallel-private-reduction-worstcase.f90
    M flang/test/Integration/OpenMP/private-global.f90
    M flang/test/Lower/CUDA/cuda-allocatable.cuf
    M flang/test/Lower/HLFIR/array-ctor-as-runtime-temp.f90
    M flang/test/Lower/HLFIR/array-ctor-character.f90
    M flang/test/Lower/HLFIR/array-ctor-derived.f90
    M flang/test/Lower/HLFIR/assumed-rank-inquiries-3.f90
    M flang/test/Lower/HLFIR/assumed-rank-inquiries.f90
    M flang/test/Lower/HLFIR/cray-pointers.f90
    M flang/test/Lower/HLFIR/function-return-as-expr.f90
    M flang/test/Lower/HLFIR/ignore-rank-unlimited-polymorphic.f90
    M flang/test/Lower/HLFIR/intentout-allocatable-components.f90
    M flang/test/Lower/HLFIR/internal-procedures-polymorphic.f90
    M flang/test/Lower/HLFIR/intrinsic-subroutines.f90
    M flang/test/Lower/HLFIR/local-end-of-scope-component-dealloc.f90
    M flang/test/Lower/HLFIR/structure-constructor.f90
    M flang/test/Lower/Intrinsics/abort.f90
    M flang/test/Lower/Intrinsics/adjustl.f90
    M flang/test/Lower/Intrinsics/adjustr.f90
    M flang/test/Lower/Intrinsics/all.f90
    M flang/test/Lower/Intrinsics/any.f90
    M flang/test/Lower/Intrinsics/bessel_jn.f90
    M flang/test/Lower/Intrinsics/bessel_yn.f90
    M flang/test/Lower/Intrinsics/count.f90
    M flang/test/Lower/Intrinsics/date_and_time.f90
    M flang/test/Lower/Intrinsics/dot_product.f90
    M flang/test/Lower/Intrinsics/eoshift.f90
    M flang/test/Lower/Intrinsics/etime-function.f90
    M flang/test/Lower/Intrinsics/etime.f90
    M flang/test/Lower/Intrinsics/execute_command_line-optional.f90
    M flang/test/Lower/Intrinsics/execute_command_line.f90
    M flang/test/Lower/Intrinsics/exit-2.f90
    M flang/test/Lower/Intrinsics/exit.f90
    M flang/test/Lower/Intrinsics/findloc.f90
    M flang/test/Lower/Intrinsics/free.f90
    M flang/test/Lower/Intrinsics/iall.f90
    M flang/test/Lower/Intrinsics/iand.f90
    M flang/test/Lower/Intrinsics/iany.f90
    M flang/test/Lower/Intrinsics/index.f90
    M flang/test/Lower/Intrinsics/iparity.f90
    M flang/test/Lower/Intrinsics/matmul.f90
    M flang/test/Lower/Intrinsics/maxloc.f90
    M flang/test/Lower/Intrinsics/maxval.f90
    M flang/test/Lower/Intrinsics/minloc.f90
    M flang/test/Lower/Intrinsics/minval.f90
    M flang/test/Lower/Intrinsics/norm2.f90
    M flang/test/Lower/Intrinsics/pack.f90
    M flang/test/Lower/Intrinsics/parity.f90
    M flang/test/Lower/Intrinsics/product.f90
    M flang/test/Lower/Intrinsics/random.f90
    M flang/test/Lower/Intrinsics/random_number_real16.f90
    M flang/test/Lower/Intrinsics/rename.f90
    M flang/test/Lower/Intrinsics/repeat.f90
    M flang/test/Lower/Intrinsics/reshape.f90
    M flang/test/Lower/Intrinsics/scan.f90
    M flang/test/Lower/Intrinsics/sleep.f90
    M flang/test/Lower/Intrinsics/spread.f90
    M flang/test/Lower/Intrinsics/storage_size.f90
    M flang/test/Lower/Intrinsics/sum.f90
    M flang/test/Lower/Intrinsics/system-optional.f90
    M flang/test/Lower/Intrinsics/system.f90
    M flang/test/Lower/Intrinsics/transfer.f90
    M flang/test/Lower/Intrinsics/transpose.f90
    M flang/test/Lower/Intrinsics/trim.f90
    M flang/test/Lower/Intrinsics/ubound01.f90
    M flang/test/Lower/Intrinsics/verify.f90
    M flang/test/Lower/OpenACC/stop-stmt-in-region.f90
    M flang/test/Lower/OpenMP/delayed-privatization-default-init.f90
    M flang/test/Lower/OpenMP/parallel-reduction-pointer-array.f90
    M flang/test/Lower/OpenMP/parallel-reduction3.f90
    M flang/test/Lower/OpenMP/private-derived-type.f90
    M flang/test/Lower/OpenMP/stop-stmt-in-region.f90
    M flang/test/Lower/allocatable-assignment.f90
    M flang/test/Lower/allocatable-polymorphic.f90
    M flang/test/Lower/allocatable-runtime.f90
    M flang/test/Lower/allocate-mold.f90
    M flang/test/Lower/allocate-source-allocatables-2.f90
    M flang/test/Lower/allocate-source-allocatables.f90
    M flang/test/Lower/allocate-source-pointers.f90
    M flang/test/Lower/array-derived-assignments.f90
    M flang/test/Lower/basic-function.f90
    M flang/test/Lower/call-by-value-attr.f90
    M flang/test/Lower/call-copy-in-out.f90
    M flang/test/Lower/default-initialization.f90
    M flang/test/Lower/derived-assignments.f90
    M flang/test/Lower/derived-type-finalization.f90
    M flang/test/Lower/derived-type-temp.f90
    M flang/test/Lower/do_concurrent_local_default_init.f90
    M flang/test/Lower/fail_image.f90
    M flang/test/Lower/forall/forall-allocatable-2.f90
    M flang/test/Lower/forall/forall-where.f90
    M flang/test/Lower/goto-statement.f90
    M flang/test/Lower/io-statement-big-unit-checks.f90
    M flang/test/Lower/nested-where.f90
    M flang/test/Lower/nullify-polymorphic.f90
    M flang/test/Lower/optional-value-caller.f90
    M flang/test/Lower/parent-component.f90
    M flang/test/Lower/pointer-association-polymorphic.f90
    M flang/test/Lower/pointer-disassociate.f90
    M flang/test/Lower/polymorphic-temp.f90
    M flang/test/Lower/polymorphic.f90
    M flang/test/Lower/select-type-2.fir
    M flang/test/Lower/stop-statement.f90
    M flang/test/Lower/structure-constructors-alloc-comp.f90
    M flang/test/Lower/structure-constructors.f90
    M flang/test/Lower/transformational-intrinsics.f90
    M flang/test/Lower/vector-subscript-io.f90
    M flang/test/Transforms/omp-reduction-cfg-conversion.fir
    M flang/test/Transforms/simplifyintrinsics.fir
    M flang/test/Transforms/stack-arrays.fir

  Log Message:
  -----------
  [flang] Do not produce result for void runtime call (#123155)

Runtime function call to a void function are producing a ssa value
because the FunctionType result is set to NoneType with is later
translated to a empty struct. This is not an issue when going to LLVM IR
but it breaks when lowering a gpu module to PTX. This patch update the
RTModel to correctly set the FunctionType result type to nothing.

This is one runtime call before this patch at the LLVM IR dialect step.
```
%45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()>
```

After the patch the call would be correctly formed
```
llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> ()
```

Without the patch it would lead to error like:
```
ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error   : Output parameter cannot be an incomplete array.
ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error   : Call has wrong number of parameters
```

The change is pretty much mechanical.



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