0
0
mirror of https://github.com/llvm/llvm-project.git synced 2025-04-18 04:56:44 +00:00

5688 Commits

Author SHA1 Message Date
Slava Zakharin
ce0c472791 Revert "Reland [flang] Generalized simplification of HLFIR reduction ops. ()"
This reverts commit 32311a6b68d3de4642599abe14922c686bdb30fc.
2025-04-17 17:26:55 -07:00
Slava Zakharin
32311a6b68 Reland [flang] Generalized simplification of HLFIR reduction ops. ()
This change generalizes SumAsElemental inlining in
SimplifyHLFIRIntrinsics pass so that it can be applied
to ALL, ANY, COUNT, MAXLOC, MAXVAL, MINLOC, MINVAL, SUM.

This change makes the special handling of the reduction
operations in OptimizedBufferization redundant: once HLFIR
operations are inlined, the hlfir.elemental inlining should
do the rest of the job.
2025-04-17 16:19:47 -07:00
Slava Zakharin
f39242ceed
Revert "[flang] Generalized simplification of HLFIR reduction ops." ()
Reverts 
2025-04-17 15:47:46 -07:00
Slava Zakharin
655b9db7b9
[flang] Generalized simplification of HLFIR reduction ops. ()
This change generalizes SumAsElemental inlining in
SimplifyHLFIRIntrinsics pass so that it can be applied
to ALL, ANY, COUNT, MAXLOC, MAXVAL, MINLOC, MINVAL, SUM.

This change makes the special handling of the reduction
operations in OptimizedBufferization redundant: once HLFIR
operations are inlined, the hlfir.elemental inlining should
do the rest of the job.
2025-04-17 15:42:48 -07:00
Razvan Lupusoru
91c2607aac
[flang][acc] Avoid implicitly privatizing IVs already privatized ()
When generating `acc.loop`, the IV was always implicitly privatized.
However, if the user explicitly privatized it, the IR generated wasn't
quite right.

For example:
```
  !$acc loop private(i)
  do i = 1, n
    a(i) = b(i)
  end do
```

The IR generated looked like:
```
    %65 = acc.private varPtr(%19#0 : !fir.ref<i32>) -> !fir.ref<i32>
{implicit = true, name = "i"}
    %66:2 = hlfir.declare %65 {uniq_name = "_QFEi"} : (!fir.ref<i32>) ->
(!fir.ref<i32>, !fir.ref<i32>)
    %67 = acc.private varPtr(%66#0 : !fir.ref<i32>) -> !fir.ref<i32>
{name = "i"}
    acc.loop  private(@privatization_ref_i32 -> %65 : !fir.ref<i32>,
@privatization_ref_i32 -> %67 : !fir.ref<i32>) control(%arg0 : i32) =
(%c1_i32_46 : i32) to (%c10_i32_47 : i32)  step (%c1_i32_48 : i32) {
      fir.store %arg0 to %66#0 : !fir.ref<i32>
```

In order to fix this, we first process all of the clauses. Then when
attempting to generate implicit private IV, we look for an already
existing data clause operation.

The result is the following IR:
```
    %65 = acc.private varPtr(%19#0 : !fir.ref<i32>) -> !fir.ref<i32>
{name = "i"}
    %66:2 = hlfir.declare %65 {uniq_name = "_QFEi"} : (!fir.ref<i32>) ->
(!fir.ref<i32>, !fir.ref<i32>)
    acc.loop  private(@privatization_ref_i32 -> %65 : !fir.ref<i32>)
control(%arg0 : i32) = (%c1_i32_46 : i32) to (%c10_i32_47 : i32)  step
(%c1_i32_48 : i32) {
      fir.store %arg0 to %66#0 : !fir.ref<i32>
```
2025-04-17 13:11:52 -07:00
Valentin Clement (バレンタイン クレメン)
91f9f0fa1e
[flang][cuda] Update cuf.kernel_launch stream and conversion ()
Update `cuf.kernel_launch` to take the stream as a reference. Update the
conversion to insert the `cuf.stream_cast` op so the stream can be set
as dependency.
2025-04-17 12:55:08 -07:00
Slava Zakharin
da959c92c5
[flang] Fixed out-of-bounds access in SimplifyIntrinsics. ()
When the mask is scalar, it is incorrect to cast it to
!fir.box<!fir.array<1xlogical<>>>, because the coordinate
operation will try to read the dim-1 stride from the box
to get the address of the first element. Even though
the stride value will be multiplied by 0, and does not matter,
it is still a read past the allocated box object.
Instead, we should just use box_addr to get the address
of the scalar mask.
2025-04-17 11:46:06 -07:00
Daniel Chen
e2c382346f
[flang] Add 32-bit AIX target specific in order to build 32-bit flang-rt () 2025-04-17 14:26:36 -04:00
Valentin Clement (バレンタイン クレメン)
9ee4fdf499
[flang][cuda] Introduce stream cast op ()
Cast a stream object reference as a GPU async token. This is useful to
be able to connect the stream representation of CUDA Fortran and the
async mechanism of the GPU dialect.
This op will later become a no op.
2025-04-17 07:25:48 -07:00
Tom Eccles
c5e112eed7
[flang][OpenMP][Semantics] Disallow NOWAIT and ORDERED with CANCEL ()
NOWAIT was a tricky one because the clause can be on either the start or
the end directive. I couldn't find a convenient way to access the end
directive from the CANCEL directive nested inside of the construct, but
there are convenient ways to access the start directive. I have added a
list to the start directive context containing the clauses from the end
directive.
2025-04-17 10:08:07 +01:00
Asher Mancinelli
f3bf844d2f
[flang] Unwrap sequence types when checking for descriptor members ()
The TBAA generation gives conservative TBAA metadata when handling an
access of a record type with a descriptor member, since the access may
be a regular data access OR another descriptor. Array members were being
incorrectly identified as non-descriptor-members, and were giving
incorrect TBAA metadata which led to bugs showing up in the optimizer
when LLVM encountered mismatching TBAA.

`fir::isRecordWithDescriptorMember` now unwraps sequence types before
checking for descriptor members.
2025-04-16 17:15:15 -07:00
David Truby
e64305096a
[flang] Complete alignment of -x language modes with gfortran () 2025-04-16 23:26:20 +01:00
Kareem Ergawy
30990c09c9
Revert "[flang][fir] Lower do concurrent loop nests to fir.do_concurrent ()" ()
This reverts commit 04b87e15e40f8857e29ade8321b8b67691545a50.

The reasons for reverting is that the following:
1. I still need need to upstream some part of the do concurrent to
OpenMP pass from our downstream implementation and taking this in
downstream will make things more difficult.
2. I still need to work on a solution for modeling locality specifiers
on `hlfir.do_concurrent` ops. I would prefer to do that and merge the
entire stack together instead of having a partial solution.

After merging the revert I will reopen the origianl PR and keep it
updated against main until I finish the above.
2025-04-16 07:20:27 -05:00
Kareem Ergawy
04b87e15e4
[flang][fir] Lower do concurrent loop nests to fir.do_concurrent ()
Adds support for lowering `do concurrent` nests from PFT to the new
`fir.do_concurrent` MLIR op as well as its special terminator
`fir.do_concurrent.loop` which models the actual loop nest.

To that end, this PR emits the allocations for the iteration variables
within the block of the `fir.do_concurrent` op and creates a region for
the `fir.do_concurrent.loop` op that accepts arguments equal in number
to the number of the input `do concurrent` iteration ranges.

For example, given the following input:
```fortran
   do concurrent(i=1:10, j=11:20)
   end do
```
the changes in this PR emit the following MLIR:
```mlir
    fir.do_concurrent {
      %22 = fir.alloca i32 {bindc_name = "i"}
      %23:2 = hlfir.declare %22 {uniq_name = "_QFsub1Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
      %24 = fir.alloca i32 {bindc_name = "j"}
      %25:2 = hlfir.declare %24 {uniq_name = "_QFsub1Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
      fir.do_concurrent.loop (%arg1, %arg2) = (%18, %20) to (%19, %21) step (%c1, %c1_0) {
        %26 = fir.convert %arg1 : (index) -> i32
        fir.store %26 to %23#0 : !fir.ref<i32>
        %27 = fir.convert %arg2 : (index) -> i32
        fir.store %27 to %25#0 : !fir.ref<i32>
      }
    }
```
2025-04-16 06:14:38 +02:00
Scott Manley
b581bd3429
[flang][OpenACC] use correct type when create private box init recipe ()
The recipe for initializing private box types was incorrect because
hlfir::createTempFromMold() is not a suitable utility function when the
box element type is a trivial type.
2025-04-15 14:21:19 -05:00
Valentin Clement (バレンタイン クレメン)
13615f7b50
[flang][openacc] Allow if clause on atomic directives ()
The new version of the OpenACC specification will allow the if clause on
the atomic directives. Allow it in `ACC.td` and update the parse node
and parser in flang to support it.

OpenACC dialect will need to be updated to support it as well.
2025-04-15 11:56:35 -07:00
Asher Mancinelli
595cc960b6
[flang] Propagate fast-math flags in target-rewrite ()
TargetRewritePass was dropping fast-math flags. Add the flags to the new
call ops and update tests.
2025-04-15 05:43:32 -07:00
Miguel Saldivar
0f86e2395e
[flang] Avoid optimizing min and max if not valid type ()
In `makeMinMaxInitValGenerator` it explicitly checks for only
`FloatType` and `IntegerType`, so we shouldn't match if we don't have
either of those types.

Fix for 
2025-04-15 10:14:58 +01:00
Connector Switch
cc354d6a6d
[NFC] Fix destroy typo. () 2025-04-15 08:20:44 +08:00
Asher Mancinelli
c9ec1bc753
[flang] Handle volatility in lowering and codegen ()
* Enable lowering and conversion patterns to pass volatility information
from higher level operations to lower level ones.
* Enable codegen to pass volatility to LLVM dialect ops by setting an
attribute on loads, stores, and memory intrinsics.
* Add utilities for passing along the volatility from an input type to
an output type.

To introduce volatile types into the IR, entities with the volatile
attribute will be given a volatile type in the bridge; this is not
enabled in this patch. User code should not result in IR with volatile
types yet, so this patch contains no tests with Fortran source, only IR
that already contains volatile types.

Part 3 of .
2025-04-14 11:02:23 -07:00
Tom Eccles
4983aec494
[flang][OpenMP][HLFIR] Support vector subscripted array sections for DEPEND ()
The OpenMP runtime needs the base address of the array section to
identify the dependency.

If we just put the vector subscript through the usual HLFIR expression
lowering, that would generate a new contiguous array representing the
values of the elements in the array which was sectioned. We cannot use
addresses from this array because these addresses would not match
dependencies on the original array. For example

```
integer :: array(1024)
integer :: indices(2)

indices(1) = 1
indices(2) = 100

!$omp task depend(out: array(1:512))
!$omp end task

!$omp task depend(in: array(indices))
!$omp end task
```

This requires taking the lowering path previously only used for ordered
assignments to get the address of the elements in the original array
which were indexed. This is done using `hlfir.elemental_addr`. e.g.
```
array(indices) = 2
```

`hlfir.elemental_addr` is awkward to use because it (by design) doesn't
return something like `!hlfir.expr<>` (like `hlfir.elemental`) and so it
can't have a generic lowering: each place it is used has to carefully
inline the contents of the operation and extract the needed address.

For this reason, `hlfir.elemental_addr` is not allowed outside of these
ordered assignments. In this commit I ignore this restriction so that I
can use `hlfir.elemental_addr` to lower the OpenMP DEPEND clause (this
works because the operation is inlined and removed before the verifier
runs).

One alternative solution would have been to provide my own more limited
re-implementation of `HlfirDesignatorBuilder` which skipped
`hlfir::elemental_addr`, instead inlining its body directly at the
current insertion point applying indices only for the first element.
This would have been difficult to maintain because designation in
Fortran is complex.
2025-04-14 17:25:59 +01:00
Andre Kuhlenschmidt
2e353a635b
[flang][openacc] Relax constraint on OpenACC declare statement ()
OpenACC declare statements are restricted from having having clauses
that reference assumed size arrays. It should be the case that we can
implement `deviceptr` and `present` clauses for assumed-size arrays.
This is a first step towards relaxing this restriction.

Note running flang on the following example results in an error in
lowering.
```
$ cat t.f90
subroutine vadd (a, b, c, n)
   real(8) :: a(*), b(*), c(*)
!$acc declare deviceptr(a, b, c)
!$acc parallel loop
   do i = 1,n
      c(i) = a(i) + b(i)
   enddo
end subroutine

$ flang -fopenacc -c t.f90
error: loc("/home/akuhlenschmi/work/p4/ta/tests/openacc/src/t.f90":3:7): expect declare attribute on variable in declare operation
error: Lowering to LLVM IR failed
error: loc("/home/akuhlenschmi/work/p4/ta/tests/openacc/src/t.f90":4:7): unsupported OpenACC operation: acc.private.recipe
error: loc("/home/akuhlenschmi/work/p4/ta/tests/openacc/src/t.f90":4:7): LLVM Translation failed for operation: acc.private.recipe
error: failed to create the LLVM module
```

I would like to to share this code, because others are currently working
on the implementation of `deviceptr`, but it is obviously not running
end-to-end. I think the cleanest approach to this would be to put this
exception to the rule behind some feature flag, but I am not certain
what the precedence for that is.
2025-04-14 09:08:21 -07:00
Peter Klausler
9f7aac177c
[flang] Allow host-associated INTENT(OUT) in specification expr. ()
Nearly, but not all, other compilers have a blanket prohibition against
the use of an INTENT(OUT) dummy argument in a specification expression.
Some compilers, however, permit an INTENT(OUT) dummy argument to appear
in a specification expression in a BLOCK construct or inner procedure
via host association.

The argument some have put forth to accept this usage comes from a
reading of 10.1.11 (specification expressions) in Fortran 2023 that, if
followed consistently, would also require host-associated OPTIONAL dummy
argument to be allowed. That would be dangerous for reasons that should
be obvious.

However, I can agree that a non-OPTIONAL dummy argument can't be assumed
to remain undefined on entry to a BLOCK construct or inner procedure, so
we can accept host-associated INTENT(OUT) in specification expressions
with a portability warning.
2025-04-14 09:00:12 -07:00
Peter Klausler
882200684b
[flang][OpenMP] Prescanning bug with !$ fixed form line continuation ()
The logic for fixed form compiler directive line continuation has a hole
that can apply continuation for !$ even if the next line does not begin
with a fixed form comment character. Rearrange the nested if statements
to enforce that requirement for all compiler directives.
2025-04-14 08:59:52 -07:00
Peter Klausler
dba757a33c
[flang] Rework preprocessor fix for replacement in kind suffixes ()
Recent work to better handle macro replacement in literal constant kind
suffixes isn't handling fixed form well, leading to a crash in Fujitsu
test 0113/0113_0073.F. The look-ahead needs to be done with the
higher-level prescanner functions that skip over fixed form comment
fields after column 72. Rework.
2025-04-14 08:59:28 -07:00
agozillon
b2c9a58b8f
[Flang][OpenMP][MLIR] Check for presence of Box type before emitting store in MapInfoFinalization pass ()
Currently we don't check for the presence of descriptor/BoxTypes before
emitting stores which lower to memcpys, the issue with this is that
users can have optional arguments, where they don't provide an input,
making the argument effectively null. This can still be mapped and this
causes issues at the moment as we'll emit a memcpy for function
arguments to store to a local variable for certain edge cases, when we
perform this memcpy on a null input, we cause a segfault at runtime.

The fix to this is to simply create a branch around the store that
checks if the data we're copying from is actually present. If it is, we
proceed with the store, if it isn't we skip it.
2025-04-14 17:15:56 +02:00
Michał Górny
a485abbddd
[flang] Fix Driver/do_concurrent_to_omp_cli.f90 test not to use runtime ()
Fix Flang invocation in `Driver/do_concurrent_to_omp_cli.f90` test to
run compilation step only, to fix testing when building with
`-DFLANG_INCLUDE_RUNTIME=OFF`. The test is only concerned with warning
being emitted by the compiler, so there is no need to link the resulting
executable.
2025-04-14 16:56:49 +02:00
Daniel Chen
1264d7a53a
[driver] Generalize the code that adds the path of libflang_rt.runtime.a. ()
The PR is to generalize the re-use of the `compilerRT` code of adding
the path of `libflang_rt.runtime.a (so)` from AIX and LoP only to all
platforms via a new function `addFlangRTLibPath`.

It also added `-static-libflangrt` and `-shared-libflangrt` compiler
options to allow users choosing which `flang-rt` to link to. It defaults
to shared `flang-rt`, which is consistent with the linker behavior,
except on AIX, it defaults to static.

Also, PR  exposed an issue in PR  that the the overriding
`addFortranRuntimeLibs` is missing the link to `libquadmath`. This PR
also fixed that and restored the test case that PR  broke.
2025-04-13 09:22:31 -04:00
Matt Arsenault
ccfb97b421 Revert "clang/AMDGPU: Stop looking for oclc_daz_opt_* control libraries ()"
This reverts commit 028429ac452acde227ae0bfafbfe8579c127e1ea and
1004fae222efeee215780c4bb4e64eb82b07fb4f.

These really need to be part of the compiler distribution. Bots are
relying on a nearly year old version to provide bitcode.
2025-04-13 14:47:39 +02:00
Matt Arsenault
1004fae222 flang: Try to update test for oclc_daz_opt removal
Try to fix bot failure after 028429ac452acde227ae0bfafbfe8579c127e1ea
2025-04-13 10:01:49 +02:00
Valentin Clement (バレンタイン クレメン)
2837fd7e5a
[flang][openacc] Allow if_present multiple times on host_data and update ()
Similar to .

The spec has not strict restriction to allow a single `if_present`
clause on the host_data and update directives. Allowing this clause
multiple times does not change the semantic of it. This patch relax the
rules in ACC.td since there is no restriction in the standard.

The OpenACC dialect represents the `if_present` clause with a `UnitAttr`
so the attribute will be set if the is one or more `if_present` clause.
2025-04-11 14:01:03 -07:00
Valentin Clement (バレンタイン クレメン)
609361ab39
[flang][openacc] Allow finalize clause on exit data more than once ()
The spec has not strict restriction to allow a single `finalize` clause
on the `exit data` directive. Allowing this clause multiple times does
not change the semantic of it. This patch relax the rules in `ACC.td`
since there is no restriction in the standard.

The OpenACC dialect represent the finalize clause with a UnitAttr so the
attribute will be set if the is one or more `finalize` clause.
2025-04-11 13:54:48 -07:00
Valentin Clement (バレンタイン クレメン)
8fb6bb3e23
[flang][openacc] Allow multiple device_type clauses on init and shutdown ()
Relax the restriction for init and shutdown directives for device_type
clause. The clause can be allowed multiple times.
2025-04-11 10:15:17 -07:00
agozillon
39f119086f
[Flang][OpenMP][ROCM] Enable rocm-device-lib-path for flang ()
Currently rocm-device-lib-path is not enabled for Flang, so when the
compiler warns / requests a user to provide this option in cases where
it can't find rocm a user cannot actually set the device libraries using
rocm-device-lib-path. The alternative rocm_path that's also mentioned
via the warning can be used, but we should enable both mentioned options
to not confuse users (and myself).
2025-04-11 15:57:30 +02:00
Slava Zakharin
9aff19e7a3
[flang] Defined SafeTempArrayCopyAttrInterface for array repacking. ()
This patch defines `fir::SafeTempArrayCopyAttrInterface` and the
corresponding
OpenACC/OpenMP related attributes in FIR dialect. The actual
implementations
are just placeholders right now, and array repacking becomes a no-op
if `-fopenacc/-fopenmp` is used for the compilation.
2025-04-10 18:41:54 -07:00
Valentin Clement (バレンタイン クレメン)
49f8ccd1eb
[flang][cuda] Pass stream information to kernel launch functions () 2025-04-10 13:50:50 -07:00
Valentin Clement (バレンタイン クレメン)
ca53463137
[flang][cuda] Propagate stream information to gpu.launch_func op ()
Use the information from `cuf.kernel_launch` to `gpu.launch_func`
2025-04-10 11:58:18 -07:00
Valentin Clement (バレンタイン クレメン)
6ca9a30c26
[flang][cuda] Update stream operand type for cuf.kernel_launch op () 2025-04-10 11:13:27 -07:00
Peter Klausler
cf8c02f71d
[flang] Don't insert spaces in -E output after line continuation ()
See test case. When Fortran line continuation has been used, don't
insert spaces in -E formatted output to put things into the right
column, as this can break up a token.

Fixes https://github.com/llvm/llvm-project/issues/134986.
2025-04-10 09:57:08 -07:00
Jeremy Morse
6a45fce909
[DebugInfo] Soft-disable the production of debug intrinsics ()
This patch switches the --experimental-debuginfo-iterators flag to be
stored to an otherwise unused cl-opt. This is a deliberate attempt to
break downstream tests that are relying on the use of debug intrinsics,
because they're imminently going away! If this commit breaks your tests,
please just revert the commit upstream, and then make contact with us
here:

https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578

So that we can work out whether there's any further transition work
needed to support the move away from using debug intrinsics.
2025-04-09 22:11:49 +01:00
Asher Mancinelli
8f23d4296c
Reland "[flang][nfc] Support volatility in Fir ops" ()
 had an extraneous include which caused the shared library builds
to break.
2025-04-09 12:45:55 -07:00
Peter Klausler
0ae9bb96d5
[flang][OpenMP] Fix regression in !$ continuation ()
A recent patch that obviated the need to use -fopenmp when using the
compiler to preprocess in -E mode broke a case of Fortran line
continuation when using OpenMP conditional compilation lines (!$) when
*not* in -E mode. Fix.
2025-04-09 12:30:33 -07:00
Peter Klausler
be133ff4c4
[flang] Fix preprocessor regression ()
For numeric kind suffixes like 1_foo, the preprocessor should be able to
perform macro replacement for macros named either "_foo" or "foo".

Fixes https://github.com/llvm/llvm-project/issues/133399.
2025-04-09 12:30:05 -07:00
Valentin Clement (バレンタイン クレメン)
f4d87c42a6
[flang][cuda] Add asyncId to allocate entry point () 2025-04-09 10:52:02 -07:00
David Spickett
fb73086dd2
Revert "[flang][nfc] Support volatility in Fir ops" ()
Reverts 

Fails to build when shared libraries are enabled:
https://lab.llvm.org/buildbot/#/builders/80/builds/12361
```
: && /usr/local/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libFIRDialect.so.21.0git -o lib/libFIRDialect.so.21.0git tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIRAttr.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIRDialect.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIRType.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FirAliasTagOpInterface.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FortranVariableInterface.cpp.o tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/Inliner.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/lib:"  lib/libCUFAttrs.so.21.0git  lib/libFIRDialectSupport.so.21.0git  lib/libLLVMAsmPrinter.so.21.0git  lib/libMLIRBuiltinToLLVMIRTranslation.so.21.0git  lib/libMLIROpenMPToLLVM.so.21.0git  lib/libMLIRLLVMToLLVMIRTranslation.so.21.0git  lib/libMLIRFuncToLLVM.so.21.0git  lib/libMLIRArithToLLVM.so.21.0git  lib/libMLIRArithAttrToLLVMConversion.so.21.0git  lib/libMLIRArithTransforms.so.21.0git  lib/libMLIRBufferizationTransforms.so.21.0git  lib/libMLIRBufferizationDialect.so.21.0git  lib/libMLIRSparseTensorDialect.so.21.0git  lib/libMLIRSCFDialect.so.21.0git  lib/libMLIRFuncTransforms.so.21.0git  lib/libMLIRShardingInterface.so.21.0git  lib/libMLIRMeshDialect.so.21.0git  lib/libMLIRVectorDialect.so.21.0git  lib/libMLIRTensorDialect.so.21.0git  lib/libMLIRParallelCombiningOpInterface.so.21.0git  lib/libMLIRMaskableOpInterface.so.21.0git  lib/libMLIRMaskingOpInterface.so.21.0git  lib/libMLIRVectorInterfaces.so.21.0git  lib/libMLIRControlFlowToLLVM.so.21.0git  lib/libMLIRControlFlowDialect.so.21.0git  lib/libMLIRMemRefToLLVM.so.21.0git  lib/libMLIRLLVMCommonConversion.so.21.0git  lib/libMLIRMemRefUtils.so.21.0git  lib/libMLIRAffineDialect.so.21.0git  lib/libMLIRMemRefDialect.so.21.0git  lib/libMLIRArithUtils.so.21.0git  lib/libMLIRComplexDialect.so.21.0git  lib/libMLIRArithDialect.so.21.0git  lib/libMLIRCastInterfaces.so.21.0git  lib/libMLIRInferIntRangeCommon.so.21.0git  lib/libMLIRShapedOpInterfaces.so.21.0git  lib/libMLIRDialect.so.21.0git  lib/libMLIRDialectUtils.so.21.0git  lib/libMLIROpenMPDialect.so.21.0git  lib/libMLIROpenACCMPCommon.so.21.0git  lib/libMLIRTargetLLVMIRExport.so.21.0git  lib/libMLIRDLTIDialect.so.21.0git  lib/libMLIRLLVMIRTransforms.so.21.0git  lib/libMLIRTransforms.so.21.0git  lib/libMLIRUBDialect.so.21.0git  lib/libMLIRRuntimeVerifiableOpInterface.so.21.0git  lib/libMLIRFuncDialect.so.21.0git  lib/libMLIRNVVMDialect.so.21.0git  lib/libMLIRTranslateLib.so.21.0git  lib/libMLIRParser.so.21.0git  lib/libMLIRBytecodeReader.so.21.0git  lib/libMLIRAsmParser.so.21.0git  lib/libMLIRTransformUtils.so.21.0git  lib/libMLIRSubsetOpInterface.so.21.0git  lib/libMLIRValueBoundsOpInterface.so.21.0git  lib/libMLIRDestinationStyleOpInterface.so.21.0git  lib/libMLIRRewrite.so.21.0git  lib/libMLIRRewritePDL.so.21.0git  lib/libMLIRPDLToPDLInterp.so.21.0git  lib/libMLIRPass.so.21.0git  lib/libMLIRAnalysis.so.21.0git  lib/libMLIRInferIntRangeInterface.so.21.0git  lib/libMLIRLoopLikeInterface.so.21.0git  lib/libMLIRPresburger.so.21.0git  lib/libMLIRViewLikeInterface.so.21.0git  lib/libMLIRPDLInterpDialect.so.21.0git  lib/libMLIRPDLDialect.so.21.0git  lib/libLLVMFrontendOpenMP.so.21.0git  lib/libLLVMTransformUtils.so.21.0git  lib/libMLIRLLVMDialect.so.21.0git  lib/libMLIRInferTypeOpInterface.so.21.0git  lib/libMLIRControlFlowInterfaces.so.21.0git  lib/libMLIRDataLayoutInterfaces.so.21.0git  lib/libMLIRFunctionInterfaces.so.21.0git  lib/libMLIRCallInterfaces.so.21.0git  lib/libMLIRMemorySlotInterfaces.so.21.0git  lib/libMLIRSideEffectInterfaces.so.21.0git  lib/libMLIRIR.so.21.0git  lib/libLLVMBitWriter.so.21.0git  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMAsmParser.so.21.0git  lib/libLLVMBitReader.so.21.0git  lib/libMLIRSupport.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMRemarks.so.21.0git  lib/libLLVMBinaryFormat.so.21.0git  lib/libLLVMTargetParser.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/lib && :
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::CharBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir12CharBoxValue4dumpEv[_ZNK3fir12CharBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::CharBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::PolymorphicValue::dump() const':
FIROps.cpp:(.text._ZNK3fir16PolymorphicValue4dumpEv[_ZNK3fir16PolymorphicValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::PolymorphicValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::ArrayBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir13ArrayBoxValue4dumpEv[_ZNK3fir13ArrayBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::ArrayBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::CharArrayBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir17CharArrayBoxValue4dumpEv[_ZNK3fir17CharArrayBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::CharArrayBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::ProcBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir12ProcBoxValue4dumpEv[_ZNK3fir12ProcBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::ProcBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::BoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir8BoxValue4dumpEv[_ZNK3fir8BoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::BoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::MutableBoxValue::dump() const':
FIROps.cpp:(.text._ZNK3fir15MutableBoxValue4dumpEv[_ZNK3fir15MutableBoxValue4dumpEv]+0x20): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::MutableBoxValue const&)'
/usr/bin/ld: tools/flang/lib/Optimizer/Dialect/CMakeFiles/FIRDialect.dir/FIROps.cpp.o: in function `fir::ExtendedValue::dump() const':
FIROps.cpp:(.text._ZNK3fir13ExtendedValue4dumpEv[_ZNK3fir13ExtendedValue4dumpEv]+0x18): undefined reference to `fir::operator<<(llvm::raw_ostream&, fir::ExtendedValue const&)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```
2025-04-09 15:41:45 +01:00
Asher Mancinelli
e42f860985
[flang][nfc] Support volatility in Fir ops ()
Part two of merging . Support volatility in fir ops.

* Introduce a new operation fir.volatile_cast, whose only purpose is to
add or take away the volatility of an SSA value's type. The types must
be otherwise identical, and any other type conversions must be handled
by fir.convert. fir.convert will give an error if the volatility of the
inputs does not match, such that all changes to volatility must be
handled explicitly through fir.volatile_cast.
* Add memory effects to ops that read from or write to memory. The
precedent for this comes from the LLVM dialect (feb7beaf70) where
llvm.load/store ops with the volatile attribute report read/write
effects to a generic memory resource. This change is similar in spirit
but different in two ways: the volatility of an operation is determined
by the type of its memref, not an attribute on the op, and the memory
effects of a load- or store-like operation on a volatile reference type
are reported against a particular memory resource,
`VolatileMemoryResource`. This is so MLIR optimizations are able to
reorder operations that are not volatile around operations that are,
which we believe more precisely models LLVM's volatile memory semantics.
@vzakhari suggested this in  citing LangRef. See
https://llvm.org/docs/LangRef.html#volatile-memory-accesses

Changes needed to generate IR with volatile types are not included in
this change, so it should be non-functional, containing only the changes
to Fir ops and op utilities that will be needed once we enable lowering
to generate volatile types.
2025-04-09 05:55:24 -07:00
NimishMishra
53fa92dcad
[mlir][llvm][OpenMP] Hoist __atomic_load alloca ()
Current implementation of `__atomic_compare_exchange` uses an alloca for
`__atomic_load`, leading to issues like
https://github.com/llvm/llvm-project/issues/120724. This PR hoists this
alloca to `AllocaIP`.


Fixes: https://github.com/llvm/llvm-project/issues/120724
2025-04-09 03:01:44 -07:00
vdonaldson
8ebc98c3b0
[flang] Update IEEE_SUPPORT_FLAG implementation ()
Optional argument X in an IEEE_SUPPORT_FLAG(FLAG, X) call may be an
array.
2025-04-08 21:20:21 -04:00
Valentin Clement (バレンタイン クレメン)
1d0f8355b1
[flang][cuda] Relax compatibility rules when host,device procedure is involved ()
Relax too restrictive rule for host, device procedure.
2025-04-08 14:55:11 -07:00
Valentin Clement (バレンタイン クレメン)
fed0f58547
[flang][cuda] Avoid triggering host array error in host device proc ()
we cannot enforce the detection of host arrays in device code when the
procedure is host, device. Relax the check for those.
2025-04-08 12:55:12 -07:00