Tejas Belagod <tejas.bela...@arm.com> writes: > Note: This patch series is based on Richard's initial patch > https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606741.html > and Jakub's suggestion > https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611892.html > > The following patch series handles various scenarios with OpenMP and SVE > types. > The starting point for the series follows a suggestion from Jakub to cover > all > the possible scenarios that could arise when OMP constructs/clauses etc are > used with SVE ACLE types. Here are a few instances that this patch series > tests > and in some cases fixes the expected output. This patch series does not > follow > a formal definition or a spec of how OMP interacts with SVE ACLE types, so > it's > more of a proposed behaviour. Comments and discussion welcome.
Thanks for doing this. I've left some comments on individual patches, but generally the series looks good from my limited abilit to evaluate it. Hopefully Jakub can say whether this catches all the cases that matter. Richard > This list is not exhaustive, but covers most scenarios of how SVE ACLE types > ought to interact with OMP constructs/clauses. > > 1. Poly-int structures that represent variable-sized objects and OMP runtime. > > Currently poly-int type structures are passed by value to OpenMP runtime > functions for shared clauses etc. This patch improves on this by passing > around poly-int structures by address to avoid copy-overhead. > > 2. SVE ACLE types in OMP Shared clauses. > > We test the behaviour where SVE ACLE type objects are shared in the following > methods into an OMP region: > a. Explicit Shared clause on SVE ACLE type objects. > b. Implicit shared clause. > c. Implicit shared with default clause. > d. SVE ALCE types in the presence of predetermined (static) shared objects. > > The associated tests ensure that all such shared objects are passed by address > into the OMP runtime. There are runtime tests to verify the functional > correctness of the change. > > 3. Offloading and SVE ACLE types. > > The target clause in OpenMP is used to offload loop kernels to accelerator > peripeherals. target's 'map' clause is used to move data from and to the > accelarator. When the data is SVE type, it may not be suitable because of > various reasons i.e. the two SVE targets may not agree on vector size or > some targets don't support variable vector size. This makes SVE unsuitable > for use in OMP's 'map' clause. We diagnose all such cases and issue errors > where appropriate. The cases we cover in this patch are: > > a. Implicitly-mapped SVE ACLE types in OMP target regions are diagnosed. > b. Explicitly-mapped SVE ACLE types in OMP target regions using map clause > are diagnosed. > c. Explicilty-mapped SVLE ACLE types of various directions - to, from, > tofrom > in the map clause are diagnosed. > d. target enter and exit data clauses with map on SVE ACLE types are > diagnosed. > e. target data map with alloc on SVE ACLE types are diagnosed. > f. target update from clause on SVE ACLE types are diagnosed. > g. target private firstprivate with SVE ACLE types are diagnosed. > h. All combinations of target with work-sharing constructs like parallel, > loop, simd, teams, distribute etc are also diagnosed when SVE ACLE types > are involved. > > 3. Lastprivate and SVE ACLE types. > > Various OpenMP lastprivate clause scenarios with SVE object types are > diagnosed. Worksharing constructs like sections, for, distribute bind to an > implicit outer parallel region in whose scope SVE ACLE types are declared and > are therefore default private. The lastprivate clause list with SVE ACLE type > object items are diagnosed in this scenario. > > 4. Threadprivate on SVE ACLE type objects. > > We ensure threadprivate SVE ACLE type objects are supported. We also ensure > copyin clause is also supported. > > 5. User-Defined Reductions on SVE ACLE types. > > We define a reduction using OMP declare reduction using SVE ACLE intrinsics > and > ensure its functional correctness with various work-sharing constructs like > for, simd, parallel, task, taskloop. > > 6. Uniform and Aligned Clause with SVE ACLE > > We ensure the uniform clause's functional correctness with simd construct and > associated SVE ACLE intrinsics in the simd region. There is no direct > interaction between uniform and SVE ACLE type objects, but we ensure the > uniform > clause applies correctly to a region where SVE ACLE intrinsics are present. > Similarly for the aligned clause. > > 7. Linear clause and SVE ACLE type. > > We diagnose if a linear clause list item has SVE ACLE type objects present. > Its doesn't mean much if the linear clause is applied to SVE ACLE types. > > 8. Depend clause and SVE ACLE objects. > > We test for functional correctness many combinations of dependency of shared > SVE ACLE type objects in parallel regions. We test if in, out dependencies > and > anti-dependencies are supported for SVE ACLE type objects using the depend > clause with work-sharing constructs like task. > > 9. 'doacross' clause and SVE ACLE object types. > > doacross is mainly supported for scalars and loop iteration variables. We > diagnose cases where SVE ACLE objects are used in doacross list items. > > Tejas Belagod (11): > OpenMP/PolyInt: Pass poly-int structures by address to OMP libs. > AArch64: Add test cases for SVE types in OpenMP shared clause. > AArch64: Diagnose OpenMP offloading when SVE types involved. > AArch64: Test OpenMP lastprivate clause for various constructs. > AArch64: Test OpenMP threadprivate clause on SVE type. > AArch64: Test OpenMP user-defined reductions with SVE types. > AArch64: Test OpenMP uniform clause on SVE types. > AArch64: Test OpenMP simd aligned clause with SVE types. > AArch64: Diagnose OpenMP linear clause for SVE type objects. > AArch64: Test OpenMP depend clause and its variations on SVE types > AArch64: Diagnose SVE type objects when applied to OpenMP doacross > clause. > > gcc/config/aarch64/aarch64-sve-builtins.cc | 31 +++ > gcc/gimplify.cc | 34 ++- > gcc/omp-low.cc | 3 +- > gcc/target.h | 19 +- > .../aarch64/sve/omp/aarch64-sve-omp.exp | 80 ++++++ > .../gcc.target/aarch64/sve/omp/depend-1.c | 223 ++++++++++++++++ > .../gcc.target/aarch64/sve/omp/doacross.c | 22 ++ > .../gcc.target/aarch64/sve/omp/lastprivate.c | 121 +++++++++ > .../gcc.target/aarch64/sve/omp/linear.c | 33 +++ > .../gcc.target/aarch64/sve/omp/offload-1.c | 237 ++++++++++++++++++ > .../gcc.target/aarch64/sve/omp/offload-2.c | 198 +++++++++++++++ > .../aarch64/sve/omp/offload-parallel-loop.c | 236 +++++++++++++++++ > .../aarch64/sve/omp/offload-parallel.c | 195 ++++++++++++++ > .../gcc.target/aarch64/sve/omp/offload-simd.c | 236 +++++++++++++++++ > .../sve/omp/offload-teams-distribute-simd.c | 237 ++++++++++++++++++ > .../sve/omp/offload-teams-distribute.c | 236 +++++++++++++++++ > .../aarch64/sve/omp/offload-teams-loop.c | 237 ++++++++++++++++++ > .../aarch64/sve/omp/offload-teams.c | 195 ++++++++++++++ > .../gcc.target/aarch64/sve/omp/shared.c | 186 ++++++++++++++ > .../gcc.target/aarch64/sve/omp/simd-aligned.c | 50 ++++ > .../gcc.target/aarch64/sve/omp/simd-uniform.c | 71 ++++++ > .../aarch64/sve/omp/target-device.c | 97 +++++++ > .../gcc.target/aarch64/sve/omp/target-link.c | 48 ++++ > .../aarch64/sve/omp/threadprivate.c | 44 ++++ > .../gcc.target/aarch64/sve/omp/udr-sve.c | 166 ++++++++++++ > 25 files changed, 3232 insertions(+), 3 deletions(-) > create mode 100644 > gcc/testsuite/gcc.target/aarch64/sve/omp/aarch64-sve-omp.exp > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/depend-1.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/doacross.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/lastprivate.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/linear.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/offload-1.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/offload-2.c > create mode 100644 > gcc/testsuite/gcc.target/aarch64/sve/omp/offload-parallel-loop.c > create mode 100644 > gcc/testsuite/gcc.target/aarch64/sve/omp/offload-parallel.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/offload-simd.c > create mode 100644 > gcc/testsuite/gcc.target/aarch64/sve/omp/offload-teams-distribute-simd.c > create mode 100644 > gcc/testsuite/gcc.target/aarch64/sve/omp/offload-teams-distribute.c > create mode 100644 > gcc/testsuite/gcc.target/aarch64/sve/omp/offload-teams-loop.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/offload-teams.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/shared.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/simd-aligned.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/simd-uniform.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/target-device.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/target-link.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/threadprivate.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/omp/udr-sve.c