public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: 钟居哲 <juzhe.zhong@rivai.ai>
To: "Jeff Law" <jeffreyalaw@gmail.com>,
	 gcc-patches <gcc-patches@gcc.gnu.org>
Cc: kito.cheng <kito.cheng@gmail.com>,  palmer <palmer@dabbelt.com>
Subject: Re: Re: [PATCH] RISC-V: Add testcases for VSETVL PASS
Date: Sat, 17 Dec 2022 09:31:17 +0800	[thread overview]
Message-ID: <C61875D2C391A1AA+2022121709311718304859@rivai.ai> (raw)
In-Reply-To: <1bcbe6fb-74be-34b4-b178-ffb324abca43@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4341 bytes --]

Register allocation (RA) doesn't affect the assembler checks since I relax the registers in assmebler checks,
all assmebler checks have their own goal. For example:

The code like this:
+void foo2 (void * restrict in, void * restrict out, int n)
+{
+  for (int i = 0; i < n; i++)
+    {
+      vuint16mf4_t v = *(vuint16mf4_t*)(in + i);
+      *(vuint16mf4_t*)(out + i) = v;
+    }
+}
Assembler check:
scan-assembler-times {vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9]\:\s+vle16\.v\s+(?:v[0-9]|v[1-2][0-9]|v3[0-1]),0\s*\((?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7])\I don't care about which vector register is using since I relax register in assembler : (?:v[0-9]|v[1-2][0-9]|v3[0-1]), this means any vector register v0-v31But also I relax scalar register : (?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]), so could be any x0 - x31 of them.The only strict check is that make sure the vsetvl is hoist outside the loop meaning the location of vsetvl is outside of the Lable L[0-9]:vsetvli\s+(?:ra|[sgtf]p|t[0-6]|s[0-9]|s10|s11|a[0-7]),\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]\s+\.L[0-9]You can see the last assembler is \s+\.L[0-9] to make sure VSETVL PASS successfully do the optimization that hoist the vsetvl instruction outside the loopI try to use check-function-body but it fails since it can not recognize the Lable which is most important for such cases.


juzhe.zhong@rivai.ai
 
From: Jeff Law
Date: 2022-12-17 04:07
To: juzhe.zhong; gcc-patches
CC: kito.cheng; palmer
Subject: Re: [PATCH] RISC-V: Add testcases for VSETVL PASS
 
 
On 12/14/22 01:09, juzhe.zhong@rivai.ai wrote:
> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
> 
> gcc/testsuite/ChangeLog:
> 
>          * gcc.target/riscv/rvv/rvv.exp: Adjust to enable tests for VSETVL PASS.
>          * gcc.target/riscv/rvv/vsetvl/dump-1.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-1.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-17.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-2.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-3.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-4.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-5.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-6.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-7.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-8.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-1.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-2.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-3.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-4.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-5.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-6.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-7.c: New test.
>          * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-8.c: New test.
So it looks like the assembler strings you're searching for are highly 
specific (across all 5 testsuite patches).  How sensitive do we expect 
these tests to be to things like register allocation giving us different 
registers and such?  I'd hate to be in a position where we're constantly 
needing to update these tests because the output is changing in 
unimportant ways.
 
Jeff
 

  reply	other threads:[~2022-12-17  1:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14  8:09 juzhe.zhong
2022-12-16 20:07 ` Jeff Law
2022-12-17  1:31   ` 钟居哲 [this message]
2022-12-17  1:42     ` Jeff Law
2022-12-19  3:22       ` Kito Cheng
2022-12-26  9:20 ` Andreas Schwab
2022-12-26  9:28   ` 钟居哲
2022-12-27 15:04   ` Jeff Law
2022-12-27 15:12     ` Kito Cheng

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=C61875D2C391A1AA+2022121709311718304859@rivai.ai \
    --to=juzhe.zhong@rivai.ai \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    /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).