public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: "Li, Pan2" <pan2.li@intel.com>,
	"Robin Dapp" <rdapp.gcc@gmail.com>, 钟居哲 <juzhe.zhong@rivai.ai>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	palmer <palmer@dabbelt.com>, "kito.cheng" <kito.cheng@gmail.com>
Subject: Re: [PATCH] RISC-V: Split VF iterators for Zvfh(min).
Date: Fri, 23 Jun 2023 13:27:13 -0600	[thread overview]
Message-ID: <fe385e86-81cd-7362-0991-745db76ec62a@gmail.com> (raw)
In-Reply-To: <MW5PR11MB59085B886456CE6B6680857AA923A@MW5PR11MB5908.namprd11.prod.outlook.com>



On 6/23/23 06:54, Li, Pan2 wrote:
> Thanks Robine for the explanation, it is very clear to me. Totally agree below parts and I think we can leave it to the maintainers of the RTL/Machine Descriptions.
> 
>> Now we could argue that combine's behavior should change here and an
>> insn without any alternatives is not actually available but that's not
>> a battle I'm willing to fight 😃
> 
> Pan
> 
> -----Original Message-----
> From: Robin Dapp <rdapp.gcc@gmail.com>
> Sent: Thursday, June 22, 2023 10:31 PM
> To: Li, Pan2 <pan2.li@intel.com>; 钟居哲 <juzhe.zhong@rivai.ai>; gcc-patches <gcc-patches@gcc.gnu.org>; palmer <palmer@dabbelt.com>; kito.cheng <kito.cheng@gmail.com>; Jeff Law <jeffreyalaw@gmail.com>
> Cc: rdapp.gcc@gmail.com
> Subject: Re: [PATCH] RISC-V: Split VF iterators for Zvfh(min).
> 
>> Just curious about the combine pass you mentioned, not very sure my
>> understand is correct but it looks like the combine pass totally
>> ignore the iterator requirement?
>>
>> It is sort of surprise to me as the combine pass may also need the
>> information of iterators.
> 
> combine tries to match instructions (with fitting modes of course).
> It does not look at the insn constraints that reload/lra later can
> use to switch between alternatives depending on the register situation
> and other factors.
> 
> We e.g. have an instruction
>   (define_insn "bla"
>     (set (match_operand:VF 1   "=vd")
>          (match_operand:VF 2   "vr"))
>     ...
> and implicitly
>    [(set_attr "enabled" "true")]
> 
> This instruction gets multiplexed via the VF iterator into (among others)
>    (define_insn "bla"
>      (set (match_operand:VNx4HF 1   "=vd")
>           (match_operand:VNx4HF 2   "vr"))
>      ...
>    [(set_attr "enabled" "true")]
> 
> When we set "enabled" to "false" via "fp_vector_disabled", we have:
>    (define_insn "bla"
>      (set (match_operand:VNx4HF 1   "=vd")
>           (match_operand:VNx4HF 2   "vr"))
>      ...
>    [(set_attr "enabled" "false")]
> 
> This means the only available alternative is disabled but the insn
> itself is still there, particularly for combine which does not look
> into the constraints.
> 
> So in our case the iterator "allowed" the instruction (leading combine
> to think it is available) and we later masked it out with "enabled = false".
> Now we could argue that combine's behavior should change here and an
> insn without any alternatives is not actually available but that's not
> a battle I'm willing to fight :D
More importantly, at combine time we don't know which alternative will 
match.  In fact, you can run into cases where no alternative matches 
until register allocation -- this was fairly common in the past as it 
allowed for simpler machine descriptions.  It fell out of favor in the 
90s as more targets started using scheduling and we wanted to expose as 
much of the final code as we could for the first scheduling pass.

Jeff


  reply	other threads:[~2023-06-23 19:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 13:03 Robin Dapp
2023-06-22 13:14 ` 钟居哲
2023-06-22 13:22   ` Robin Dapp
2023-06-22 13:25     ` 钟居哲
2023-06-22 13:32       ` Robin Dapp
2023-06-22 13:37         ` 钟居哲
2023-06-22 13:45           ` Li, Pan2
2023-06-22 14:30             ` Robin Dapp
2023-06-23 12:54               ` Li, Pan2
2023-06-23 19:27                 ` Jeff Law [this message]
2023-06-24 16:38 ` Jeff Law

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=fe385e86-81cd-7362-0991-745db76ec62a@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pan2.li@intel.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).