On Tue, Apr 15, 2025 at 12:05:05PM -0600, Alex wrote:
> * testsuite/libgomp.c++/allocator-1.C: New test.
> * testsuite/libgomp.c++/allocator-2.C: New test.
The libgomp.c/alloc-pinned*.c test have
/* { dg-skip-if "Pinning not implemented on this host" { ! *-*-linux-gnu* } } */
so they are only run on Linux targets right now. Duplicating the tests or
reworking them into headers looked like too much work for me right now this
late in stage4, so I've just #ifdefed the uses at least for now.
Tested on x86_64-linux + verified with -O0 the gnu_pinned_mem symbols show
up in the binary, committed to trunk.
2025-04-17 Jakub Jelinek <[email protected]>
PR libgomp/119849
* testsuite/libgomp.c++/allocator-1.C (test_inequality, main): Guard
ompx::allocator::gnu_pinned_mem uses with #ifdef __gnu_linux__.
* testsuite/libgomp.c++/allocator-2.C (main): Likewise.
--- libgomp/testsuite/libgomp.c++/allocator-1.C.jj 2025-04-16
00:15:09.101113607 +0200
+++ libgomp/testsuite/libgomp.c++/allocator-1.C 2025-04-17 12:06:50.852863934
+0200
@@ -78,7 +78,10 @@ void test_inequality ()
CHECK_INEQUALITY (omp::allocator::cgroup_mem, void);
CHECK_INEQUALITY (omp::allocator::pteam_mem, void);
CHECK_INEQUALITY (omp::allocator::thread_mem, void);
+#ifdef __gnu_linux__
+ /* Pinning not implemented on other targets. */
CHECK_INEQUALITY (ompx::allocator::gnu_pinned_mem, void);
+#endif
/* And again with the same type passed to the allocator. */
CHECK_INEQUALITY (omp::allocator::null_allocator, T);
CHECK_INEQUALITY (omp::allocator::default_mem, T);
@@ -89,7 +92,9 @@ void test_inequality ()
CHECK_INEQUALITY (omp::allocator::cgroup_mem, T);
CHECK_INEQUALITY (omp::allocator::pteam_mem, T);
CHECK_INEQUALITY (omp::allocator::thread_mem, T);
+#ifdef __gnu_linux__
CHECK_INEQUALITY (ompx::allocator::gnu_pinned_mem, T);
+#endif
}
#undef CHECK_INEQUALITY
@@ -121,7 +126,9 @@ int main ()
test<int, omp::allocator::cgroup_mem>(42);
test<int, omp::allocator::pteam_mem>(42);
test<int, omp::allocator::thread_mem>(42);
+#ifdef __gnu_linux__
test<int, ompx::allocator::gnu_pinned_mem>(42);
+#endif
test<long long, omp::allocator::null_allocator>(42);
test<long long, omp::allocator::default_mem>(42);
@@ -132,7 +139,9 @@ int main ()
test<long long, omp::allocator::cgroup_mem>(42);
test<long long, omp::allocator::pteam_mem>(42);
test<long long, omp::allocator::thread_mem>(42);
+#ifdef __gnu_linux__
test<long long, ompx::allocator::gnu_pinned_mem>(42);
+#endif
test<S, omp::allocator::null_allocator>( S{42, true, 128.f});
test<S, omp::allocator::default_mem>( S{42, true, 128.f});
@@ -143,7 +152,9 @@ int main ()
test<S, omp::allocator::cgroup_mem>( S{42, true, 128.f});
test<S, omp::allocator::pteam_mem>( S{42, true, 128.f});
test<S, omp::allocator::thread_mem>( S{42, true, 128.f});
+#ifdef __gnu_linux__
test<S, ompx::allocator::gnu_pinned_mem>(S{42, true, 128.f});
+#endif
test_inequality<int, omp::allocator::null_allocator>();
test_inequality<int, omp::allocator::default_mem>();
@@ -154,5 +165,7 @@ int main ()
test_inequality<int, omp::allocator::cgroup_mem>();
test_inequality<int, omp::allocator::pteam_mem>();
test_inequality<int, omp::allocator::thread_mem>();
+#ifdef __gnu_linux__
test_inequality<int, ompx::allocator::gnu_pinned_mem>();
+#endif
}
--- libgomp/testsuite/libgomp.c++/allocator-2.C.jj 2025-04-16
00:15:09.101113607 +0200
+++ libgomp/testsuite/libgomp.c++/allocator-2.C 2025-04-17 12:07:20.666464136
+0200
@@ -86,7 +86,10 @@ int main ()
f<int, omp::allocator::cgroup_mem >(0, 1, 2, 3);
f<int, omp::allocator::pteam_mem >(0, 1, 2, 3);
f<int, omp::allocator::thread_mem >(0, 1, 2, 3);
+#ifdef __gnu_linux__
+ /* Pinning not implemented on other targets. */
f<int, ompx::allocator::gnu_pinned_mem>(0, 1, 2, 3);
+#endif
f<long long, omp::allocator::null_allocator >(0, 1, 2, 3);
f<long long, omp::allocator::default_mem >(0, 1, 2, 3);
@@ -97,7 +100,9 @@ int main ()
f<long long, omp::allocator::cgroup_mem >(0, 1, 2, 3);
f<long long, omp::allocator::pteam_mem >(0, 1, 2, 3);
f<long long, omp::allocator::thread_mem >(0, 1, 2, 3);
+#ifdef __gnu_linux__
f<long long, ompx::allocator::gnu_pinned_mem>(0, 1, 2, 3);
+#endif
S0 s0_0{ 42, true, 111128.f};
S0 s0_1{ 142, false, 11128.f};
@@ -112,7 +117,9 @@ int main ()
f<S0, omp::allocator::cgroup_mem >(s0_0, s0_1, s0_2, s0_3);
f<S0, omp::allocator::pteam_mem >(s0_0, s0_1, s0_2, s0_3);
f<S0, omp::allocator::thread_mem >(s0_0, s0_1, s0_2, s0_3);
+#ifdef __gnu_linux__
f<S0, ompx::allocator::gnu_pinned_mem>(s0_0, s0_1, s0_2, s0_3);
+#endif
S1 s1_0{ 42, true, 111128.f};
S1 s1_1{ 142, false, 11128.f};
@@ -128,5 +135,7 @@ int main ()
f<S1, omp::allocator::cgroup_mem >(s1_0, s1_1, s1_2, s1_3);
f<S1, omp::allocator::pteam_mem >(s1_0, s1_1, s1_2, s1_3);
f<S1, omp::allocator::thread_mem >(s1_0, s1_1, s1_2, s1_3);
+#ifdef __gnu_linux__
f<S1, ompx::allocator::gnu_pinned_mem>(s1_0, s1_1, s1_2, s1_3);
+#endif
}
Jakub