public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: 钟居哲 <juzhe.zhong@rivai.ai>
To: rdapp.gcc <rdapp.gcc@gmail.com>,  kito.cheng <kito.cheng@gmail.com>
Cc: rdapp.gcc <rdapp.gcc@gmail.com>,
	 gcc-patches <gcc-patches@gcc.gnu.org>,
	 kito.cheng <kito.cheng@sifive.com>,
	 "Jeff Law" <jeffreyalaw@gmail.com>
Subject: Re: Re: [PATCH V4] RISC-V: Expand VLS mode to scalar mode move[PR111391]
Date: Fri, 15 Sep 2023 06:25:53 +0800	[thread overview]
Message-ID: <2F334AD6F302713A+202309150625532095607@rivai.ai> (raw)
In-Reply-To: <45da5f7a-9e41-4c90-ecec-18b7183bfa96@gmail.com>

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

>> All that's missing is a (reinterpreting) vtype change to Pmode-sized
>> elements before. I quickly hacked something together (without the proper
>> mode change) and the resulting code looks like:
 
>> vsetvli zero, 8, e8, ...
>> vmv.v.x v1,a5
>>         # missing vsetivli zero, 1, e64, ... or something
>> vmv.x.s a0,v1

This issue has been addressed by this patch:
[PATCH V3] RISC-V: Fix ICE in get_avl_or_vl_reg (gnu.org)



juzhe.zhong@rivai.ai
 
From: Robin Dapp
Date: 2023-09-15 05:06
To: Kito Cheng; Juzhe-Zhong
CC: rdapp.gcc; gcc-patches; kito.cheng; jeffreyalaw
Subject: Re: [PATCH V4] RISC-V: Expand VLS mode to scalar mode move[PR111391]
> I am thinking what we are doing is something like we are allowing
> scalar mode within the vector register, so...not sure should we try to
> implement that within the mov pattern?
> 
> I guess we need some inputs from Jeff.
 
Sorry for the late response.  I have also been thinking about this and
it feels a bit like a bandaid to me.  Usually register-class moves like
this are performed by reload (which consults register_move_costs among
other things) and we are working around it.
 
The situation is that we move a vec_duplicate of QImodes into a vector
register.  Then we want to use this as scalar call argument so we need
to transfer it back to a DImode register.
 
One maybe more typical solution would be to allow small VLS vector modes
like V8QI in GPRs (via hard_regno_mode_ok) until reload so we could have
a (set (reg:V8QI a0) (vec_duplicate:V8QI ...)).
 
The next step would be to have a mov<mode> expander with target "r"
constraint (and source "vr") that performs the actual move.  This is
where Juzhe's mov code could fit in (without the subreg handling).
If I'm not mistaken vmv.x.s without slidedown should be sufficient for
our case as we'd only want to use the whole thing when the full vector
fits into a GPR. 
 
All that's missing is a (reinterpreting) vtype change to Pmode-sized
elements before. I quickly hacked something together (without the proper
mode change) and the resulting code looks like:
 
vsetvli zero, 8, e8, ...
vmv.v.x v1,a5
        # missing vsetivli zero, 1, e64, ... or something 
vmv.x.s a0,v1
 
Now, whether that's efficient (and desirable) is a separate issue and
should probably be defined by register_move_costs as well as instruction
costs.  I wasn't actually aware of this call/argument optimization that
uses vec_duplicate and I haven't checked what costing (if at all) it
uses.
 
Regards
Robin
 

  reply	other threads:[~2023-09-14 22:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 10:49 Juzhe-Zhong
2023-09-14 16:17 ` Kito Cheng
2023-09-14 21:06   ` Robin Dapp
2023-09-14 22:25     ` 钟居哲 [this message]
2023-09-14 22:28     ` 钟居哲
2023-09-14 22:26   ` 钟居哲
2023-09-15 15:27     ` Jeff Law
2023-09-15 15:34       ` 钟居哲
2023-09-15 15:43         ` Robin Dapp
2023-09-16  9:56           ` Li, Pan2

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=2F334AD6F302713A+202309150625532095607@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=rdapp.gcc@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).