From: "juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>
To: "Richard Biener" <richard.guenther@gmail.com>,
jeffreyalaw <jeffreyalaw@gmail.com>
Cc: Kito.cheng <kito.cheng@sifive.com>,
gcc-patches <gcc-patches@gcc.gnu.org>,
kito.cheng <kito.cheng@gmail.com>, palmer <palmer@dabbelt.com>,
palmer <palmer@rivosinc.com>,
"Robin Dapp" <rdapp.gcc@gmail.com>
Subject: Re: Re: [PATCH V2] RISC-V: Fix bug of pre-calculated const vector mask
Date: Wed, 28 Jun 2023 16:15:18 +0800 [thread overview]
Message-ID: <6C6D136EC3B6AAD4+2023062816151748403317@rivai.ai> (raw)
In-Reply-To: <CAFiYyc0w6+mktRa=dwhHETbYOq7bg66zyBD2uM2NG7+X6H8=AQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]
Hi, Richi.
After I dig into the codes and experiment:
https://godbolt.org/z/hMf5nsPeK
This example is VNx8QI, GCC works fine for RVV using 1-bit compact mask.
ADJUST_PRECISION (VNx1BI, riscv_v_adjust_precision (VNx1BImode, 1));
ADJUST_PRECISION (VNx2BI, riscv_v_adjust_precision (VNx2BImode, 2));
ADJUST_PRECISION (VNx4BI, riscv_v_adjust_precision (VNx4BImode, 4));
ADJUST_PRECISION (VNx8BI, riscv_v_adjust_precision (VNx8BImode, 8));
ADJUST_PRECISION (VNx16BI, riscv_v_adjust_precision (VNx16BImode, 16));
ADJUST_PRECISION (VNx32BI, riscv_v_adjust_precision (VNx32BImode, 32));
ADJUST_PRECISION (VNx64BI, riscv_v_adjust_precision (VNx64BImode, 64));
ADJUST_PRECISION (VNx128BI, riscv_v_adjust_precision (VNx128BImode, 128));
The only problem is for VNx1BI, VNx2BI, VNx4BI since we use ADJUST_PRECISION to differentiate them with VNx8QI.
VNx1BI, VNx2BI, VNx4BI is too small and GCC can not represent a mode with only 4bit size in GET_MODE_SIZE, now we use ADJUST_PRECISION to differentiate them.
However, it cause loading bitmask for VNx1BI/VNx2BI/VNx4BI incorrectly, so this patch is to fix such in RISC-V backend. This is the RISC-V specific issue and would not happen on X86.
Thanks.
juzhe.zhong@rivai.ai
From: Richard Biener
Date: 2023-06-28 15:17
To: Jeff Law
CC: Kito Cheng; juzhe.zhong@rivai.ai; gcc-patches; kito.cheng; palmer; palmer; Robin Dapp
Subject: Re: [PATCH V2] RISC-V: Fix bug of pre-calculated const vector mask
On Wed, Jun 28, 2023 at 6:09 AM Jeff Law via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
>
> On 6/27/23 21:16, Kito Cheng wrote:
> > Do you mind giving some comments about what the difference between the
> > two versions?
> And I'd like a before/after assembly code with the example in the commit
> message. I didn't see the same behavior when I tried it earlier today
> and ran out of time to dig into it further.
>
> Juzhe -- most folks wait ~1wk to ping patches, even codegen bugfixes.
> Pinging this fast runs the risk of irritating others. Please be patient.
I think if we get constant mask expansion wrong this has to be fixed in
generic code. ISTR fixing similar issues with AVX512 compact masks.
But maybe I'm misunderstanding the problem and the issue only
exists in the backend?
Richard.
> Jeff
next prev parent reply other threads:[~2023-06-28 8:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 1:59 Juzhe-Zhong
2023-06-28 3:14 ` juzhe.zhong
2023-06-28 3:16 ` Kito Cheng
2023-06-28 3:19 ` juzhe.zhong
2023-06-28 4:09 ` Jeff Law
2023-06-28 6:01 ` Kito Cheng
2023-06-28 6:17 ` juzhe.zhong
2023-06-28 7:17 ` Richard Biener
2023-06-28 7:38 ` juzhe.zhong
2023-06-28 8:15 ` juzhe.zhong [this message]
2023-06-28 9:50 ` juzhe.zhong
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=6C6D136EC3B6AAD4+2023062816151748403317@rivai.ai \
--to=juzhe.zhong@rivai.ai \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=kito.cheng@gmail.com \
--cc=kito.cheng@sifive.com \
--cc=palmer@dabbelt.com \
--cc=palmer@rivosinc.com \
--cc=rdapp.gcc@gmail.com \
--cc=richard.guenther@gmail.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).