On 07/11/2024 11:07, Jakub Jelinek wrote:
On Thu, Nov 07, 2024 at 10:54:40AM +0000, Andrew Stubbs wrote:
On 07/11/2024 00:37, haochen.jiang wrote:
d334f729e53867b838e867375b3f475ba793d96e is the first bad commit
commit d334f729e53867b838e867375b3f475ba793d96e
Author: Andrew Stubbs <a...@baylibre.com>
Date: Wed Nov 6 12:26:08 2024 +0000
openmp: Add testcases for omp_max_vf
caused
FAIL: gcc.dg/gomp/max_vf-1.c scan-tree-dump-times ompexp "\\+ 16" 1
FAIL: gcc.dg/gomp/max_vf-1.c scan-tree-dump-times ompexp "\\* 16" 2
FAIL: gcc.dg/gomp/max_vf-1.c scan-tree-dump-times ompexp
"__builtin_GOMP_parallel_loop_nonmonotonic_dynamic \\(.*, 16, 0\\);" 1
with GCC configured with
../../gcc/configure
--prefix=/export/users/haochenj/src/gcc-bisect/master/master/r15-4988/usr
--enable-clocale=gnu --with-system-zlib --with-demangler-in-ld
--with-fpmath=sse --enable-languages=c,c++,fortran --enable-cet --without-isl
--enable-libmpx x86_64-linux --disable-bootstrap
To reproduce:
$ cd {build_dir}/gcc && make check RUNTESTFLAGS="gomp.exp=gcc.dg/gomp/max_vf-1.c
--target_board='unix{-m32\ -march=cascadelake}'"
$ cd {build_dir}/gcc && make check RUNTESTFLAGS="gomp.exp=gcc.dg/gomp/max_vf-1.c
--target_board='unix{-m64\ -march=cascadelake}'"
This problem was supposed to be avoided by explicitly passing "-msse2" in
the testcase. Apparently -march=cascadelake silently overrides that setting
... maybe don't do that?
What do yo mean by overrides?
-march=cascadelake -msse2
(or the other ordering too) certainly doesn't override the enabling of SSE2,
the -mISA and -mno-ISA flags take precedence over -march=; though other
flags can be set too from the -march= or its default set when configuring
the compiler.
So, if the testcase relies on SSE2 enabled and SSE3 not enabled, it should
use -msse2 -mno-sse3.
Seems the testcase actually relies on AVX not being enabled, so it should
use "-msse2 -mno-avx".
That will work fine even with -march=cascadelake, whether it is the default
or requested through --target_board.
Stupid me thought that those options were exclusive. The goal is to
make the vector size both predictable and not the same as amdgcn. It's
also good if it's sufficiently old that it works "everywhere".
Anyway, I think the attached patch should fix it. It passes on my
configuration, but I don't have a Cascade Lake.
OK?
Andrew
From 180d89fb029d28f09fa318c593dbb01e4cedf746 Mon Sep 17 00:00:00 2001
From: Andrew Stubbs <a...@baylibre.com>
Date: Thu, 7 Nov 2024 11:23:41 +0000
Subject: [PATCH] openmp: Fix max_vf testcases with -march=cascadelake
Apparently we need to explicitly disable AVX, not just enabled SSE, to
guarentee the 16-lane vectors we need for the pattern match.
libgomp/ChangeLog:
* testsuite/libgomp.c/max_vf-1.c: Add -mno-avx.
gcc/testsuite/ChangeLog:
* gcc.dg/gomp/max_vf-1.c: Add -mno-avx.
---
gcc/testsuite/gcc.dg/gomp/max_vf-1.c | 2 +-
libgomp/testsuite/libgomp.c/max_vf-1.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/gomp/max_vf-1.c b/gcc/testsuite/gcc.dg/gomp/max_vf-1.c
index 0513aae226c..d4617940eb2 100644
--- a/gcc/testsuite/gcc.dg/gomp/max_vf-1.c
+++ b/gcc/testsuite/gcc.dg/gomp/max_vf-1.c
@@ -5,7 +5,7 @@
/* { dg-options "-fopenmp -O2 -fdump-tree-ompexp" } */
/* Fix a max_vf size so we can scan for it.
-{ dg-additional-options "-msse2" { target { x86_64-*-* i?86-*-* } } } */
+{ dg-additional-options "-msse2 -mno-avx" { target { x86_64-*-* i?86-*-* } } } */
#define N 1024
int a[N], b[N], c[N];
diff --git a/libgomp/testsuite/libgomp.c/max_vf-1.c b/libgomp/testsuite/libgomp.c/max_vf-1.c
index be900c565a3..9c8d5dc0af9 100644
--- a/libgomp/testsuite/libgomp.c/max_vf-1.c
+++ b/libgomp/testsuite/libgomp.c/max_vf-1.c
@@ -7,7 +7,7 @@
/* { dg-options "-fopenmp -O2 -fdump-tree-ompexp -foffload=-fdump-tree-optimized" } */
/* Fix a max_vf size so we can scan for it.
-{ dg-additional-options "-msse2" { target { x86_64-*-* i?86-*-* } } } */
+{ dg-additional-options "-msse2 -mno-avx" { target { x86_64-*-* i?86-*-* } } } */
#define N 1024
int a[N], b[N], c[N];
--
2.46.0