From cd3dd3f8356cdc6ddfc7de5d88bf566a2426063f Mon Sep 17 00:00:00 2001 From: Thorsten Blass Date: Wed, 28 Feb 2024 04:40:47 -0500 Subject: [PATCH] Self-map tests for TDD These tests are used in a TDD fashion and will be extended along the way. They currently fail due to mssing support in the frontend. Change-Id: I6a4f7d58fe333250c256c0d0dfd7a18c717026c8 --- test/smoke-fails/selfmap/Makefile | 22 +++++++++++++++++ test/smoke-fails/selfmap/selfmap.cpp | 24 +++++++++++++++++++ test/smoke-fails/selfmap_map_mixed/Makefile | 22 +++++++++++++++++ .../selfmap_map_mixed/selfmap_map_mixed.cpp | 13 ++++++++++ 4 files changed, 81 insertions(+) create mode 100644 test/smoke-fails/selfmap/Makefile create mode 100644 test/smoke-fails/selfmap/selfmap.cpp create mode 100644 test/smoke-fails/selfmap_map_mixed/Makefile create mode 100644 test/smoke-fails/selfmap_map_mixed/selfmap_map_mixed.cpp diff --git a/test/smoke-fails/selfmap/Makefile b/test/smoke-fails/selfmap/Makefile new file mode 100644 index 000000000..29844d8af --- /dev/null +++ b/test/smoke-fails/selfmap/Makefile @@ -0,0 +1,22 @@ +include ../../Makefile.defs + +TESTNAME = selfmap +TESTSRC_MAIN = selfmap.cpp +TESTSRC_AUX = +TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX) + +RUNCMD_COPY = HSA_XNACK=0 ./$(TESTNAME) +RUNCMD_AUTOZERO = HSA_XNACK=1 ./$(TESTNAME) + + +CLANG = clang++ +OMP_BIN = $(AOMP)/bin/$(CLANG) +CC = $(OMP_BIN) $(VERBOSE) +#-ccc-print-phases +#"-\#\#\#" + +include ../Makefile.rules + +run: $(TESTNAME) + $(RUNCMD_COPY) + $(RUNCMD_AUTOZERO) \ No newline at end of file diff --git a/test/smoke-fails/selfmap/selfmap.cpp b/test/smoke-fails/selfmap/selfmap.cpp new file mode 100644 index 000000000..cbed1ddac --- /dev/null +++ b/test/smoke-fails/selfmap/selfmap.cpp @@ -0,0 +1,24 @@ +#include +#include + +#define N 100 + +int main() { + int x = 0; + +#pragma omp target teams distribute parallel for map(self : x) + { + for (unsigned i = 0; i < N; ++i) +#pragma omp atomic update + x++; + } + +#pragma omp target teams distribute parallel for map(self, tofrom : x) + { + for (unsigned i = 0; i < N; ++i) +#pragma omp atomic update + x++; + } + + return 0; +} \ No newline at end of file diff --git a/test/smoke-fails/selfmap_map_mixed/Makefile b/test/smoke-fails/selfmap_map_mixed/Makefile new file mode 100644 index 000000000..9fcb83ff3 --- /dev/null +++ b/test/smoke-fails/selfmap_map_mixed/Makefile @@ -0,0 +1,22 @@ +include ../../Makefile.defs + +TESTNAME = selfmap_map_mixed +TESTSRC_MAIN = selfmap_map_mixed.cpp +TESTSRC_AUX = +TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX) + +RUNCMD_COPY = HSA_XNACK=0 ./$(TESTNAME) +RUNCMD_AUTOZERO = HSA_XNACK=1 ./$(TESTNAME) + + +CLANG = clang++ +OMP_BIN = $(AOMP)/bin/$(CLANG) +CC = $(OMP_BIN) $(VERBOSE) +#-ccc-print-phases +#"-\#\#\#" + +include ../Makefile.rules + +run: $(TESTNAME) + $(RUNCMD_COPY) + $(RUNCMD_AUTOZERO) \ No newline at end of file diff --git a/test/smoke-fails/selfmap_map_mixed/selfmap_map_mixed.cpp b/test/smoke-fails/selfmap_map_mixed/selfmap_map_mixed.cpp new file mode 100644 index 000000000..5c47d5c62 --- /dev/null +++ b/test/smoke-fails/selfmap_map_mixed/selfmap_map_mixed.cpp @@ -0,0 +1,13 @@ +int main() { + int x = 0; +#pragma omp target data map(self : x) + { +#pragma omp target map(x) + { +// unspecified behaviour. It is not clear what x is used. Maybe a warning should +// be issued to inform the programmer. +#pragma omp atomic update + x++; + } + } +} \ No newline at end of file