diff options
| author | Julian Brown <julian.brown@amd.com> | 2026-03-25 16:57:25 -0500 |
|---|---|---|
| committer | Julian Brown <julian.brown@amd.com> | 2026-03-26 10:00:04 -0500 |
| commit | 14269b45180aac83010e7704300b2d0120d495ff (patch) | |
| tree | 32c6bd21de5b819ba38610bc4ad5b7bf399ce2d2 | |
| parent | eec9d38f222263cdd201f4be01a8fd619459f934 (diff) | |
| download | llvm-users/jtb20/omp6.0-taskgraph-support-9.tar.gz llvm-users/jtb20/omp6.0-taskgraph-support-9.tar.bz2 llvm-users/jtb20/omp6.0-taskgraph-support-9.zip | |
[OpenMP] OpenMP 6.0 "taskgraph" support, add new testsusers/jtb20/omp6.0-taskgraph-support-9
27 files changed, 1575 insertions, 0 deletions
diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_1.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_1.cpp new file mode 100644 index 000000000000..d6abdb1e1ee9 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_1.cpp @@ -0,0 +1,50 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[3]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[2]) + { } + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(inout: deps[0]) + { } + #pragma omp task depend(inout: deps[1]) + { } + #pragma omp task depend(inout: deps[2]) + { } + #pragma omp task depend(in: deps[0], deps[1], deps[2]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_10.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_10.cpp new file mode 100644 index 000000000000..f3dd856f84f9 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_10.cpp @@ -0,0 +1,47 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[5]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1], deps[4]) + { } + #pragma omp task depend(in: deps[0], deps[1]) + { } + + #pragma omp task depend(out: deps[2], deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[3], deps[4]) + { } + #pragma omp task depend(in: deps[2], deps[3]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x1c] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x7] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_11.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_11.cpp new file mode 100644 index 000000000000..4f2babaefe25 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_11.cpp @@ -0,0 +1,57 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(in: deps[0], deps[1]) + { } + + #pragma omp task depend(out: deps[2], deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[3]) + { } + #pragma omp task depend(in: deps[2], deps[3]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: exclusive { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: exclusive { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_12.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_12.cpp new file mode 100644 index 000000000000..d3615187b546 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_12.cpp @@ -0,0 +1,52 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[2]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(mutexinoutset: deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[1]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: exclusive { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: exclusive { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_13.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_13.cpp new file mode 100644 index 000000000000..de2b5e138dd4 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_13.cpp @@ -0,0 +1,42 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(mutexinoutset: deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[2]) + { } + #pragma omp task depend(mutexinoutset: deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[3]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xc] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x3] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x8] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x4] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x2] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x1] +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_14.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_14.cpp new file mode 100644 index 000000000000..684a196a8d8f --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_14.cpp @@ -0,0 +1,45 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(mutexinoutset: deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1], deps[2]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1], deps[2], deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[1], deps[2], deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[3]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xf] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xe] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x7] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xc] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x3] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x8] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x1] +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_15.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_15.cpp new file mode 100644 index 000000000000..d35660ddfd09 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_15.cpp @@ -0,0 +1,72 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task + { } + #pragma omp task depend(mutexinoutset: deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[1], deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[2]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[1], deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[3], deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[3], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[3], deps[1], deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[3], deps[2]) + { } + #pragma omp task depend(mutexinoutset: deps[3], deps[2], deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[3], deps[2], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[3], deps[2], deps[1], deps[0]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xf] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xe] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xd] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xb] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x7] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xc] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0xa] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x9] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x6] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x5] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x3] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x8] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x4] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x2] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x1] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_16.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_16.cpp new file mode 100644 index 000000000000..45aa3c587d75 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_16.cpp @@ -0,0 +1,52 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[8]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(inout: deps[0]) + { } + #pragma omp task depend(mutexinoutset: deps[4], deps[7]) + { } + #pragma omp task depend(inout: deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[4], deps[7]) + { } + #pragma omp task depend(inout: deps[2]) + { } + #pragma omp task depend(mutexinoutset: deps[5], deps[6]) + { } + #pragma omp task depend(inout: deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[5], deps[6]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: exclusive { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: exclusive { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_17.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_17.cpp new file mode 100644 index 000000000000..2c59595f5b00 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_17.cpp @@ -0,0 +1,65 @@ +// RUN: %libomp-cxx-compile && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { + fprintf(stderr, "task 0\n"); + } + #pragma omp task depend(out: deps[2], deps[3]) + { + fprintf(stderr, "task 1\n"); + } + #pragma omp task depend(inout: deps[0]) + { + fprintf(stderr, "task 2\n"); + } + #pragma omp task depend(inout: deps[1]) + { + fprintf(stderr, "task 3\n"); + } + #pragma omp task depend(inout: deps[2]) + { + fprintf(stderr, "task 4\n"); + } + #pragma omp task depend(inout: deps[3]) + { + fprintf(stderr, "task 5\n"); + } + #pragma omp task depend(in: deps[0], deps[1], deps[2], deps[3]) + { + fprintf(stderr, "task 6\n"); + } + } + } + } + } + return 0; +} + +// CHECK-DAG: task 0 +// CHECK-DAG: task 2 +// CHECK-DAG: task 3 +// CHECK-DAG: task 1 +// CHECK-DAG: task 4 +// CHECK-DAG: task 5 +// CHECK: task 6 + +// CHECK-DAG: task 0 +// CHECK-DAG: task 2 +// CHECK-DAG: task 3 +// CHECK-DAG: task 1 +// CHECK-DAG: task 4 +// CHECK-DAG: task 5 +// CHECK: task 6 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_18.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_18.cpp new file mode 100644 index 000000000000..954cfcbadb7b --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_18.cpp @@ -0,0 +1,43 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[2]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp taskloop num_tasks(strict: 2) + { + for (int j = 0; j < 20; j++) { } + } + #pragma omp task depend(in: deps[0], deps[1]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: wait: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_19.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_19.cpp new file mode 100644 index 000000000000..24d5fdfcb94b --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_19.cpp @@ -0,0 +1,48 @@ +// RUN: %libomp-cxx-compile && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +int main() +{ + int deps[3]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 10; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0]) + { + fprintf(stderr, "task 0\n"); + } + #pragma omp task depend(out: deps[1]) + { + fprintf(stderr, "task 1\n"); + } + #pragma omp task depend(out: deps[2]) + { + fprintf(stderr, "task 2\n"); + } + #pragma omp taskwait depend(in: deps[0], deps[1], deps[2]) + #pragma omp task depend(in: deps[0], deps[1], deps[2]) + { + fprintf(stderr, "task 3\n"); + } + } + } + } + } + return 0; +} + +// CHECK-DAG: task 0 +// CHECK-DAG: task 1 +// CHECK-DAG: task 2 +// CHECK: task 3 + +// CHECK-DAG: task 0 +// CHECK-DAG: task 1 +// CHECK-DAG: task 2 +// CHECK: task 3 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_2.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_2.cpp new file mode 100644 index 000000000000..89dd9137e158 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_2.cpp @@ -0,0 +1,55 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(out: deps[2], deps[3]) + { } + #pragma omp task depend(inout: deps[0]) + { } + #pragma omp task depend(inout: deps[1]) + { } + #pragma omp task depend(inout: deps[2]) + { } + #pragma omp task depend(inout: deps[3]) + { } + #pragma omp task depend(in: deps[0], deps[1], deps[2], deps[3]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_20.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_20.cpp new file mode 100644 index 000000000000..ab3b42995a90 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_20.cpp @@ -0,0 +1,48 @@ +// RUN: %libomp-cxx-compile && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +int main() +{ + int deps[3]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 10; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0]) + { + fprintf(stderr, "task 0\n"); + } + #pragma omp task depend(out: deps[1]) + { + fprintf(stderr, "task 1\n"); + } + #pragma omp task depend(out: deps[2]) + { + fprintf(stderr, "task 2\n"); + } + #pragma omp taskwait depend(inoutset: deps[0], deps[1]) + #pragma omp task depend(in: deps[0], deps[1], deps[2]) + { + fprintf(stderr, "task 3\n"); + } + } + } + } + } + return 0; +} + +// CHECK-DAG: task 0 +// CHECK-DAG: task 1 +// CHECK-DAG: task 2 +// CHECK: task 3 + +// CHECK-DAG: task 0 +// CHECK-DAG: task 1 +// CHECK-DAG: task 2 +// CHECK: task 3 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_21.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_21.cpp new file mode 100644 index 000000000000..ad36c8c5a401 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_21.cpp @@ -0,0 +1,49 @@ +// RUN: %libomp-cxx-compile && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +int main() +{ + int arr[100]; + + int res = 0; + for (int i = 0; i < 100; i++) { + arr[i] = i; + res += i; + } + printf("base result: %d\n", res); + + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 10; i++) + { + int res = 0; + #pragma omp taskgraph + { + #pragma omp taskloop reduction(+: res) num_tasks(10) + { + for (int j = 0; j < 100; j++) { + res += arr[j]; + } + } + } + printf("reduction result: %d\n", res); + } + } + } + return 0; +} + +// CHECK: base result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 +// CHECK-NEXT: reduction result: 4950 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_22.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_22.cpp new file mode 100644 index 000000000000..254de8e3542c --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_22.cpp @@ -0,0 +1,67 @@ +// RUN: %clangXX %flags %openmp_flags -fopenmp-version=60 %s -o %t && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +void foo() { +#pragma omp task replayable(1) + { + fprintf(stderr, "task outside lexical taskgraph\n"); + } +} + +int main() +{ + int arr[100]; + + int res = 0; + for (int i = 0; i < 100; i++) { + arr[i] = i; + res += i; + } + fprintf(stderr, "base result: %d\n", res); + + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 10; i++) + { + int res = 0; + #pragma omp taskgraph + { + #pragma omp taskloop reduction(+: res) num_tasks(10) + { + for (int j = 0; j < 100; j++) { + res += arr[j]; + } + } + foo(); + } + fprintf(stderr, "reduction result: %d\n", res); + } + } + } + return 0; +} + +// CHECK: base result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: task outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_23.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_23.cpp new file mode 100644 index 000000000000..eb6930965da6 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_23.cpp @@ -0,0 +1,100 @@ +// RUN: %clangXX %flags %openmp_flags -fopenmp-version=60 %s -o %t && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +void foo() { + fprintf(stderr, "called function foo\n"); +#pragma omp taskloop replayable num_tasks(4) + { + for (int i = 0; i < 4; i++) + fprintf(stderr, "taskloop iter %d outside lexical taskgraph\n", i); + } +} + +int main() +{ + int arr[100]; + + int res = 0; + for (int i = 0; i < 100; i++) { + arr[i] = i; + res += i; + } + fprintf(stderr, "base result: %d\n", res); + + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 10; i++) + { + int res = 0; + #pragma omp taskgraph + { + #pragma omp taskloop reduction(+: res) num_tasks(10) + { + for (int j = 0; j < 100; j++) { + res += arr[j]; + } + } + foo(); + } + fprintf(stderr, "reduction result: %d\n", res); + } + } + } + return 0; +} + +// CHECK: base result: 4950 +// CHECK-NEXT: called function foo +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 +// CHECK-DAG: taskloop iter 0 outside lexical taskgraph +// CHECK-DAG: taskloop iter 1 outside lexical taskgraph +// CHECK-DAG: taskloop iter 2 outside lexical taskgraph +// CHECK-DAG: taskloop iter 3 outside lexical taskgraph +// CHECK-DAG: reduction result: 4950 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_24.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_24.cpp new file mode 100644 index 000000000000..c974a08520ae --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_24.cpp @@ -0,0 +1,77 @@ +// RUN: %clangXX %flags %openmp_flags -fopenmp-version=60 %s -o %t && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +#include <cassert> + +int global_dep; + +void foo() { +#pragma omp taskwait replayable(1) depend(in: global_dep) +} + +int main() +{ + int arr[100]; + + int res = 0; + for (int i = 0; i < 100; i++) { + arr[i] = i; + res += i; + } + + assert(res == 4950); + + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 10; i++) + { + int res = 0; + #pragma omp taskgraph + { + #pragma omp taskloop reduction(+: res) num_tasks(10) + { + for (int j = 0; j < 100; j++) { + res += arr[j]; + } + } + #pragma omp task depend(out: global_dep) + { } + foo(); + } + assert(res == 4950); + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: sequential { +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: wait: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: wait: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_25.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_25.cpp new file mode 100644 index 000000000000..0f2c3fbf9b45 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_25.cpp @@ -0,0 +1,86 @@ +// RUN: %clangXX %flags %openmp_flags -fopenmp-version=60 %s -o %t && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +int global_dep; + +void foo() { + fprintf(stderr, "called function foo\n"); +#pragma omp task replayable(1) depend(in: global_dep) + { + fprintf(stderr, "out-of-line task created from within taskloop\n"); + } +} + +int main() +{ + int arr[100]; + + int res = 0; + for (int i = 0; i < 4; i++) { + arr[i] = i; + res += i; + } + fprintf(stderr, "base result: %d\n", res); + + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 4; i++) + { + int res = 0; + #pragma omp taskgraph + { + #pragma omp taskloop reduction(+: res) num_tasks(4) + { + for (int j = 0; j < 4; j++) { + res += arr[j]; + foo(); + } + } + } + fprintf(stderr, "reduction result: %d\n", res); + } + } + } + return 0; +} + +// CHECK: base result: 6 +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: reduction result: 6 +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: reduction result: 6 +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: reduction result: 6 +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: called function foo +// CHECK-DAG: out-of-line task created from within taskloop +// CHECK-DAG: reduction result: 6 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_26.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_26.cpp new file mode 100644 index 000000000000..86c69e8134a9 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_26.cpp @@ -0,0 +1,58 @@ +// RUN: %clangXX %flags %openmp_flags -fopenmp-version=60 %s -o %t && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +int main() +{ + int arr[100]; + int arr2[100]; + + int res = 0, res2 = 0; + for (int i = 0; i < 10; i++) { + arr[i] = i; + arr2[i] = 3 + i * 2; + res += i; + res2 += 3 + i * 2; + } + fprintf(stderr, "base results: %d, %d\n", res, res2); + + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 10; i++) + { + int res = 0, res2 = 0; + #pragma omp taskgraph + { + #pragma omp taskloop reduction(+: res) num_tasks(10) + { + for (int j = 0; j < 10; j++) { + res += arr[j]; + } + } + #pragma omp taskloop reduction(+: res2) num_tasks(10) + { + for (int j = 0; j < 10; j++) { + res2 += arr2[j]; + } + } + } + fprintf(stderr, "reduction results: %d, %d\n", res, res2); + } + } + } + return 0; +} + +// CHECK: base results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 +// CHECK-NEXT: reduction results: 45, 120 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_27.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_27.cpp new file mode 100644 index 000000000000..20b81b143c6b --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_27.cpp @@ -0,0 +1,60 @@ +// RUN: %clangXX %flags %openmp_flags -fopenmp-version=60 %s -o %t && %libomp-run 2>&1 | FileCheck %s + +#include <cstdio> + +int main() +{ + int arr[100]; + int arr2[100]; + + int res = 0, res2 = 0; + for (int i = 0; i < 10; i++) { + arr[i] = i; + res += i; + } + for (int i = 0; i < 10; i++) { + arr2[i] = 3 + i * 2; + res2 += res * (3 + i * 2); + } + fprintf(stderr, "base results: %d, %d\n", res, res2); + + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 10; i++) + { + int res = 0, res2 = 0; + #pragma omp taskgraph + { + #pragma omp taskloop reduction(+: res) num_tasks(10) + { + for (int j = 0; j < 10; j++) { + res += arr[j]; + } + } + #pragma omp taskloop reduction(+: res2) num_tasks(10) + { + for (int j = 0; j < 10; j++) { + res2 += res * arr2[j]; + } + } + } + fprintf(stderr, "reduction results: %d, %d\n", res, res2); + } + } + } + return 0; +} + +// CHECK: base results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 +// CHECK-NEXT: reduction results: 45, 5400 diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_3.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_3.cpp new file mode 100644 index 000000000000..3686772695e9 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_3.cpp @@ -0,0 +1,77 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[6]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(out: deps[2], deps[3]) + { } + #pragma omp task depend(inout: deps[0]) + { } + #pragma omp task depend(inout: deps[1]) + { } + #pragma omp task depend(inout: deps[2]) + { } + #pragma omp task depend(inout: deps[3]) + { } + #pragma omp task depend(in: deps[0], deps[1], deps[2], deps[3]) + { } + #pragma omp task depend(in: deps[1], deps[2]) depend(out: deps[5]) + { } + #pragma omp task depend(in: deps[5]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x[[#%x,NODE1:]] (* 2) +// CHECK-NEXT: node: 0x[[#%x,NODE2:]] (* 2) +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x[[#%x,NODE3:]] (* 2) +// CHECK-NEXT: node: 0x[[#%x,NODE4:]] (* 2) +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x[[#NODE3]] (* 2) +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x[[#NODE4]] (* 2) +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x[[#NODE1]] (* 2) +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x[[#NODE2]] (* 2) +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_4.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_4.cpp new file mode 100644 index 000000000000..a70fed4845f5 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_4.cpp @@ -0,0 +1,73 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(out: deps[2], deps[3]) + { } + #pragma omp task depend(inout: deps[0]) + { } + #pragma omp task depend(inout: deps[1]) + { } + #pragma omp task depend(inout: deps[2]) + { } + #pragma omp task depend(inout: deps[3]) + { } + #pragma omp task depend(in: deps[0], deps[2], deps[3]) + { } + #pragma omp task depend(in: deps[0], deps[1]) + { } + #pragma omp task depend(in: deps[3]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x[[#%x,NODE1:]] (* 2) +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x[[#%x,NODE2:]] (* 2) +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x[[#%x,NODE3:]] (* 2) +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x[[#%x,NODE4:]] (* 2) +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x[[#NODE1]] (* 2) +// CHECK-NEXT: node: 0x[[#NODE2]] (* 2) +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x[[#NODE3]] (* 2) +// CHECK-NEXT: node: 0x[[#NODE4]] (* 2) +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_5.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_5.cpp new file mode 100644 index 000000000000..636208245fd0 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_5.cpp @@ -0,0 +1,60 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[2]) + { } + #pragma omp task depend(out: deps[1], deps[3]) + { } + #pragma omp task depend(inoutset: deps[0], deps[1]) + { } + #pragma omp task depend(inoutset: deps[0], deps[1]) + { } + #pragma omp task depend(inoutset: deps[2], deps[3]) + { } + #pragma omp task depend(inoutset: deps[2], deps[3]) + { } + #pragma omp task depend(in: deps[0], deps[1]) + { } + #pragma omp task depend(in: deps[2], deps[3]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_6.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_6.cpp new file mode 100644 index 000000000000..66e872f83379 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_6.cpp @@ -0,0 +1,56 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[1], deps[3]) + { } + #pragma omp task depend(out: deps[0], deps[2]) + { } + #pragma omp task depend(inoutset: deps[0], deps[1]) + { } + #pragma omp task depend(inoutset: deps[0], deps[1]) + { } + #pragma omp task depend(inoutset: deps[2], deps[3]) + { } + #pragma omp task depend(inoutset: deps[2], deps[3]) + { } + #pragma omp task depend(in: deps[0], deps[2]) + { } + #pragma omp task depend(in: deps[0], deps[2]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: parallel { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_7.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_7.cpp new file mode 100644 index 000000000000..c01d4a080385 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_7.cpp @@ -0,0 +1,56 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[4]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(out: deps[2], deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[3]) + { } + #pragma omp task depend(mutexinoutset: deps[2], deps[3]) + { } + #pragma omp task depend(in: deps[0], deps[1]) + { } + #pragma omp task depend(in: deps[2], deps[3]) + { } + } + } + } + } + return 0; +} + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: parallel { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: exclusive { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: exclusive { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_8.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_8.cpp new file mode 100644 index 000000000000..179e8bb08780 --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_8.cpp @@ -0,0 +1,36 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[2]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(in: deps[0], deps[1]) + { } + } + } + } + } + return 0; +} + +// FIXME: This isn't perfect -- we don't really need to keep the mutexes in +// this case. + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x3] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} diff --git a/openmp/runtime/test/taskgraph/taskgraph_deps_9.cpp b/openmp/runtime/test/taskgraph/taskgraph_deps_9.cpp new file mode 100644 index 000000000000..7e9af09dbe7d --- /dev/null +++ b/openmp/runtime/test/taskgraph/taskgraph_deps_9.cpp @@ -0,0 +1,44 @@ +// RUN: %libomp-cxx-compile && env KMP_G_DEBUG=10 %libomp-run 2>&1 | FileCheck %s + +int main() +{ + int deps[3]; + #pragma omp parallel + { + #pragma omp single + { + for (int i = 0; i < 2; i++) + { + #pragma omp taskgraph + { + #pragma omp task depend(out: deps[0], deps[1]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(in: deps[1]) depend(out: deps[2]) + { } + #pragma omp task depend(mutexinoutset: deps[0], deps[1]) + { } + #pragma omp task depend(in: deps[0], deps[1], deps[2]) + { } + } + } + } + } + return 0; +} + +// FIXME: This isn't perfect -- we don't really need to keep the mutexes in +// this case. + +// CHECK: Processed taskgraph 0x[[#%x,GRAPHPTR:]] (graph_id 0): +// CHECK-NEXT: sequential { +// CHECK-NEXT: sequential { +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x3] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} [sets: 0x3] +// CHECK-NEXT: node: 0x{{[[:xdigit:]]+}} +// CHECK-NEXT: } +// CHECK-NEXT: Replay taskgraph 0x[[#GRAPHPTR]] from task 0x{{[[:xdigit:]]+}} |
