From 84ae4ee0568ffebd9433c7fcdb315b9608c7cddc Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 16 Apr 2025 12:23:43 +0200 Subject: [PATCH] Add OpenMP untied RT test Executing the taskyield in a loop causes the runtime to maximize the probablily that we end up running the task again before we have the chance to emit the PPe event, so making the emulator panic as this breaks the current OpenMP task model. --- test/rt/openmp/CMakeLists.txt | 1 + test/rt/openmp/task-untied.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/rt/openmp/task-untied.c diff --git a/test/rt/openmp/CMakeLists.txt b/test/rt/openmp/CMakeLists.txt index 20f0f78..a647928 100644 --- a/test/rt/openmp/CMakeLists.txt +++ b/test/rt/openmp/CMakeLists.txt @@ -47,6 +47,7 @@ openmp_rt_test(simple-task.c) openmp_rt_test(task.c) openmp_rt_test(taskloop.c) openmp_rt_test(taskwait.c) +openmp_rt_test(task-untied.c) openmp_rt_test(team-distribute.c) openmp_rt_test(worksharing-and-tasks.c) openmp_rt_test(worksharing-mix.c BREAKDOWN) diff --git a/test/rt/openmp/task-untied.c b/test/rt/openmp/task-untied.c new file mode 100644 index 0000000..2c3e1f8 --- /dev/null +++ b/test/rt/openmp/task-untied.c @@ -0,0 +1,22 @@ +/* Copyright (c) 2025 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +/* + * Ensures that we can emit a sequence of PPx, PPe, PPx, PPe events for the same + * OpenMP task to execute it again. + * + * See: https://gitlab.pm.bsc.es/rarias/ovni/-/issues/208 + */ + +int +main(void) +{ + #pragma omp parallel + #pragma omp master + #pragma omp task untied + { + for (int i = 0; i < 10000; i++) { + #pragma omp taskyield + } + } +}