diff options
author | Tom Eccles <tom.eccles@arm.com> | 2024-10-16 14:43:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-16 14:43:57 +0100 |
commit | 621fcf892bcd3c2d81e25c6ee39ca32db3c6b05a (patch) | |
tree | 7432f79e72c78aec39623bc4c4c7d11085760e66 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | a3010c77910c706be4c51ce4a95d51211e335a1f (diff) | |
download | llvm-621fcf892bcd3c2d81e25c6ee39ca32db3c6b05a.zip llvm-621fcf892bcd3c2d81e25c6ee39ca32db3c6b05a.tar.gz llvm-621fcf892bcd3c2d81e25c6ee39ca32db3c6b05a.tar.bz2 |
[mlir][OpenMP] rewrite conversion of privatisation for omp.parallel (#111844)
The existing conversion inlined private alloc regions and firstprivate
copy regions in mlir, then undoing the modification of the mlir module
before completing the conversion. To make this work, LLVM IR had to be
generated using the wrong mapping for privatised values and then later
fixed inside of OpenMPIRBuilder.
This approach violated an assumption in OpenMPIRBuilder that private
variables would be values not constants. Flang sometimes generates code
where private variables are promoted to globals, the address of which is
treated as a constant in LLVM IR. This caused the incorrect values for
the private variable from being replaced by OpenMPIRBuilder: ultimately
resulting in programs producing incorrect results.
This patch rewrites delayed privatisation for omp.parallel to work more
similarly to reductions: translating directly into LLVMIR with correct
mappings for private variables.
RFC:
https://discourse.llvm.org/t/rfc-openmp-fix-issue-in-mlir-to-llvmir-translation-for-delayed-privatisation/81225
Tested against the gfortran testsuite and our internal test suite.
Linaro's post-commit bots will check against the fujitsu test suite.
I decided to add the new tests as flang integration tests rather than in
mlir/test/Target/LLVMIR:
- The regression test is for an issue filed against flang. i wanted to
keep the reproducer similar to the code in the ticket.
- I found the "worst case" CFG test difficult to reason about in
abstract it helped me to think about what was going on in terms of a
Fortran program.
Fixes #106297
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions