Hi! On 2024-11-06T16:18:50+0000, Andrew Stubbs <a...@baylibre.com> wrote: > On 06/11/2024 15:41, Jakub Jelinek wrote: >> On Wed, Nov 06, 2024 at 03:27:22PM +0000, Andrew Stubbs wrote: >>> [...] requires enabling the offload-dump scanning features previously only >>> used >>> in the libgomp testsuite. The automake scheme used there isn't a good fit >>> here, so we probe the known devices manually. >>> >>> gcc/testsuite/ChangeLog: >>> >>> * gcc.dg/gomp/gomp.exp: Load scanoffload.exp and scanoffloadtree.exp. >>> Set offload_targets when available. >>> * gcc.dg/gomp/max_vf-1.c: New test. >>> * gcc.dg/gomp/max_vf-2.c: New test. >>> * gcc.dg/gomp/max_vf-3.c: New test. >> >> I don't see how this can work. gomp.exp isn't prepared to find the libgomp >> directory nor add -B options etc.
ACK. >> Perhaps it appears to work if you have >> your system gcc's libgomp installed, but that isn't the library that should >> be used. >> So, max_vf-1.c test can stay where it is, but the gomp.exp changes shouldn't >> be done and max_vf-{2,3}.c should move to libgomp/testsuite/libgomp.c/ > > It worked for me, but I might have an unusual configuration that allows > me to test installed toolchains with remote devices, rather than build > trees with local devices. Right. (And, of course, boths way should work.) > --- /dev/null > +++ b/libgomp/testsuite/libgomp.c/max_vf-1.c > @@ -0,0 +1,47 @@ > +/* Test that omp parallel simd schedule uses the correct max_vf for the > + host system, when target directives are present. */ > + > +/* { dg-require-effective-target offloading_enabled } */ > + > +[...] > + > +/* Make sure that the max_vf is used as an IFN. > +{ dg-final { scan-tree-dump-times {GOMP_MAX_VF} 2 "ompexp" { target { > x86_64-*-* i?86-*-* } } } } */ > + > +/* Make sure the max_vf is passed as a temporary variable. > +{ dg-final { scan-tree-dump-times > {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, D\.[0-9]*, 0\);} 1 > "ompexp" { target { x86_64-*-* i?86-*-* } } } } */ > + > +/* Test SIMD offload devices > +{ dg-final { scan-offload-tree-dump-times > {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, 64, 0\);} 1 > "optimized" { target { offload_gcn } } } } > +{ dg-final { scan-offload-tree-dump-times > {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, 7, 0\);} 1 > "optimized" { target { offload_nvptx } } } } */ > + > +int main() {} For configurations where both GCN and nvptx offloading are enabled, we get FAILs here. Avoid these via 'only_for_offload_target [...]'. Pushed to trunk branch commit 730f28b081bea4a749f9b82902446731ec8faa93 "Adjust 'libgomp.c/max_vf-*.c'", see attached. Grüße Thomas
>From 730f28b081bea4a749f9b82902446731ec8faa93 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tschwi...@baylibre.com> Date: Sat, 9 Nov 2024 13:37:53 +0100 Subject: [PATCH] Adjust 'libgomp.c/max_vf-*.c' For configurations where both GCN and nvptx offloading are enabled, we get: PASS: libgomp.c/max_vf-1.c (test for excess errors) PASS: libgomp.c/max_vf-1.c scan-tree-dump-times ompexp "GOMP_MAX_VF" 2 PASS: libgomp.c/max_vf-1.c scan-tree-dump-times ompexp "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, D\\.[0-9]*, 0\\);" 1 PASS: libgomp.c/max_vf-1.c scan-amdgcn-amdhsa-offload-tree-dump-times optimized "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 64, 0\\);" 1 FAIL: libgomp.c/max_vf-1.c scan-nvptx-none-offload-tree-dump-times optimized "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 64, 0\\);" 1 FAIL: libgomp.c/max_vf-1.c scan-amdgcn-amdhsa-offload-tree-dump-times optimized "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 7, 0\\);" 1 PASS: libgomp.c/max_vf-1.c scan-nvptx-none-offload-tree-dump-times optimized "__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 7, 0\\);" 1 Avoid these FAILs via 'only_for_offload_target [...]'. Also, for consistency with other libgomp test cases, use effective-target specifiers of the libgomp test suite. Fix-up for recent commit d334f729e53867b838e867375b3f475ba793d96e "openmp: Add testcases for omp_max_vf". libgomp/ * testsuite/libgomp.c/max_vf-1.c: Adjust. * testsuite/libgomp.c/max_vf-2.c: Likewise. --- libgomp/testsuite/libgomp.c/max_vf-1.c | 6 +++--- libgomp/testsuite/libgomp.c/max_vf-2.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libgomp/testsuite/libgomp.c/max_vf-1.c b/libgomp/testsuite/libgomp.c/max_vf-1.c index 9c8d5dc0af9..70f6b86c614 100644 --- a/libgomp/testsuite/libgomp.c/max_vf-1.c +++ b/libgomp/testsuite/libgomp.c/max_vf-1.c @@ -1,7 +1,7 @@ /* Test that omp parallel simd schedule uses the correct max_vf for the host system, when target directives are present. */ -/* { dg-require-effective-target offloading_enabled } */ +/* { dg-require-effective-target offload_target_any } */ /* { dg-do link } */ /* { dg-options "-fopenmp -O2 -fdump-tree-ompexp -foffload=-fdump-tree-optimized" } */ @@ -41,7 +41,7 @@ f3 (int *a, int *b, int *c) { dg-final { scan-tree-dump-times {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, D\.[0-9]*, 0\);} 1 "ompexp" { target { x86_64-*-* i?86-*-* } } } } */ /* Test SIMD offload devices -{ dg-final { scan-offload-tree-dump-times {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, 64, 0\);} 1 "optimized" { target { offload_gcn } } } } -{ dg-final { scan-offload-tree-dump-times {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, 7, 0\);} 1 "optimized" { target { offload_nvptx } } } } */ +{ dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-times {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, 64, 0\);} 1 "optimized" { target offload_target_amdgcn } } } +{ dg-final { only_for_offload_target nvptx-none scan-offload-tree-dump-times {__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \(.*, 7, 0\);} 1 "optimized" { target offload_target_nvptx } } } */ int main() {} diff --git a/libgomp/testsuite/libgomp.c/max_vf-2.c b/libgomp/testsuite/libgomp.c/max_vf-2.c index 91744c309df..545cf1d2138 100644 --- a/libgomp/testsuite/libgomp.c/max_vf-2.c +++ b/libgomp/testsuite/libgomp.c/max_vf-2.c @@ -1,7 +1,7 @@ /* Ensure that the default safelen is set correctly for the larger of the host and offload device, to prevent defeating the vectorizer. */ -/* { dg-require-effective-target offloading_enabled } */ +/* { dg-require-effective-target offload_target_any } */ /* { dg-do link } */ /* { dg-options "-fopenmp -O2 -fdump-tree-omplower" } */ @@ -16,6 +16,6 @@ int f(float *a, float *b, int n) } /* Make sure that the max_vf used is suitable for the offload device. -{ dg-final { scan-tree-dump-times {omp simd safelen\(64\)} 1 "omplower" { target { offload_gcn } } } } */ +{ dg-final { scan-tree-dump-times {omp simd safelen\(64\)} 1 "omplower" { target offload_target_amdgcn } } } */ int main() {} -- 2.34.1