public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: chenxiaolong <chenxiaolong@loongson.cn>, YunQiang Su <wzssyqa@gmail.com>
Cc: gcc-patches@gcc.gnu.org, i@xen0n.name, xuchenghua@loongson.cn,
	 chenglulu@loongson.cn, schwab@linux-m68k.org,
	ci_notify@linaro.org
Subject: Re: [PATCH v2] LoongArch: testsuite:Added additional vectorization "-mlsx" option.
Date: Tue, 16 Jan 2024 17:51:34 +0800	[thread overview]
Message-ID: <bb8e9a7fdd30e8459ff43d6898247de9e4813117.camel@xry111.site> (raw)
In-Reply-To: <fd4a07c211eca6f5f232508abcd8eb707ee539b5.camel@xry111.site>

On Tue, 2024-01-16 at 12:58 +0800, Xi Ruoyao wrote:
> On Tue, 2024-01-16 at 10:57 +0800, chenxiaolong wrote:
> > 在 2024-01-15一的 15:50 +0800,Xi Ruoyao写道:
> > > On Mon, 2024-01-15 at 15:10 +0800, chenxiaolong wrote:
> > > > At 14:42 +0800 on the first day of 2024-01-15, Xi Ruoyao wrote:
> > > > > On Mon, 2024-01-15 at 14:32 +0800, YunQiang Su wrote:
> > > > > > Xi Ruoyao <xry111@xry111.site> wrote at 12:11pm on Monday,
> > > > > > January
> > > > > > 15, 2024:
> > > > > > > On Mon, 2024-01-15 at 09:29 +0800, chenxiaolong wrote:
> > > > > > > > At 21:13 +0800 on Saturday, 2024-01-13, Xi Ruoyao wrote:
> > > > > > > > > At 15:28 +0800 on Saturday 2024-01-13, chenxiaolong
> > > > > > > > > wrote:
> > > > > > > > > > gcc/testsuite/ChangeLog:
> > > > > > > > > > 
> > > > > > > > > >     * gcc.dg/pr104992.c: Added additional "-mlsx"
> > > > > > > > > > compilation
> > > > > > > > > > options.
> > > > > > > > > >     * gcc.dg/signbit-2.c: Dito.
> > > > > > > > > >     * gcc.dg/tree-ssa/scev-16.c: Dito.
> > > > > > > > > >     * gfortran.dg/graphite/vect-pr40979.f90: Dito.
> > > > > > > > > >     * gfortran.dg/vect/fast-math-mgrid-resid.f: Dito.
> > > > > > > > > 
> > > > > > > > > I don't feel it right about the changes to pr104992.c and
> > > > > > > > > scev-16.c
> > > > > > > > > because no other architectures add special options
> > > > > > > > > there. 
> > > > > > > > > Why are we
> > > > > > > > > so special?
> > > > > > > > Because on the LoongArch architecture, GCC requires the
> > > > > > > > addition of
> > > > > > > > vectorization options in order to generate vector code. Use
> > > > > > > > the
> > > > > > > > check_effective_target_vect_cmdline_needed command in the
> > > > > > > > lib/target-
> > > > > > > > supports.exp file to set whether the command line option is
> > > > > > > > needed to
> > > > > > > > enable vectorizations. For example, ia64,x86,aarch64, and
> > > > > > > > riscv
> > > > > > > > architectures, vectorization is enabled by default.
> > > > > > > 
> > > > > > > But no.  The default baseline of 32-bit x86 is i686, which is
> > > > > > > basically
> > > > > > > a Pentium III launched in 1999 without any vector
> > > > > > > instructions.
> > > > > > > 
> > > > > > > We are still missing something here.
> > > > > > > 
> > > > > > There is a line
> > > > > >        #define vector
> > > > > > __attribute__((vector_size(4*sizeof(int))))
> > > > > > I guess it is the syntax needs to be supported.
> > > > > 
> > > > > This is always supported.  If the target does not have vector
> > > > > instructions GCC will just expand vector arithmetic as a loop.
> > > > > 
> > > > > Maybe we should just move this test into gcc.dg/vect where the
> > > > > framework
> > > > > automatically add options like -mlsx or -msse2?
> > > > > 
> > > > 
> > > > The "-mlsx" option is turned on by default after vectorization
> > > > testing
> > > > is turned on. However, the use of dg-options in some files resets
> > > > the
> > > > compilation options for testing this file. Therefore, to detect
> > > > vectorization on LoongArch, it is necessary to add an additional "-
> > > > mlsx" option.
> > > 
> > > Then it should use dg-additional-options instead of dg-options.
> > > 
> > According to your advice, I have tried the following two ways:
> > 
> > (1)Replace dg-options directly with dg-additional-options. The "-ansi-
> > pedantic-errors" set in the dg.exp file is used, and the following
> > problems occur:
> > 
> > gcc.dg/pr104992.c:ISO C90 does not support complex types.
> > gcc.dg/tree-ssa/scev-16.c:‘for’ loop initial declarations are only
> > allowed in C99 or C11 mode
> > 
> > Note: The ISO required by the program is inconsistent with the default
> > standard, resulting in an error.
> 
> We can add -std=c11 into dg-additional-options as well.
> 
> > (2)Move pr104992.c and scev-16.c to the gcc.dg/vect directory and
> > replace dg-options with dg-additional-options. The problems are as
> > follows:
> > 
> > gcc.dg/vect/scev-16.c: Because there is no test rule starting with
> > scev* in the vect.exp file, you need to add a new test rule or change
> > the file name before the test can be performed.
> > 
> > Summary: It is more appropriate to add the additional "-mlsx" option
> > directly to the pr104992.c and scev-16.c files. This supports
> > vectorization  testing of the LoongArch architecture and does not
> > modify the testing behavior of other architectures.
> 
> No, "not modifying the other architectures" may not be a good thing in
> some cases.
> 
> There are only two possibilities here:
> 
> (1) The test is broken for all architectures where vectorization needs
> additional options.  Then we should fix it for all the architectures.
> 
> (2) The test is only broken on LoongArch, then on other architectures
> some mechanism is already adding the proper options for vectorization.
> Then we should implement the same mechanism for LoongArch.
> 
> For either case adding -mlsx only for LoongArch is only papering over
> the real issue.
> 
> I'll run these tests on some other architectures and see what's
> happening...

Alright, now to me using vect_* out of vect directories is simply wrong.
Instead of fixing up all the tests one by one, target by target, we
should just stop this nonsense.  Spreading target-specific vectorization
options everywhere is pretty unmaintainable.

https://gcc.gnu.org/PR113418

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2024-01-16  9:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-13  7:28 chenxiaolong
2024-01-13 13:13 ` Xi Ruoyao
2024-01-15  1:29   ` chenxiaolong
2024-01-15  4:10     ` Xi Ruoyao
2024-01-15  6:32       ` YunQiang Su
2024-01-15  6:42         ` Xi Ruoyao
2024-01-15  7:10           ` chenxiaolong
2024-01-15  7:50             ` Xi Ruoyao
2024-01-16  2:57               ` chenxiaolong
2024-01-16  4:58                 ` Xi Ruoyao
2024-01-16  9:51                   ` Xi Ruoyao [this message]
2024-01-16 10:20                   ` Richard Biener
2024-01-18  7:15                     ` chenglulu
2024-01-18  7:44                       ` Xi Ruoyao
2024-01-18  8:49                         ` chenglulu
2024-01-18 14:12                           ` chenglulu
2024-01-15  7:26           ` chenglulu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb8e9a7fdd30e8459ff43d6898247de9e4813117.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=chenglulu@loongson.cn \
    --cc=chenxiaolong@loongson.cn \
    --cc=ci_notify@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=i@xen0n.name \
    --cc=schwab@linux-m68k.org \
    --cc=wzssyqa@gmail.com \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).