From: Jeff Law <jeffreyalaw@gmail.com>
To: Jin Ma <jinma@linux.alibaba.com>, gcc-patches <gcc-patches@gcc.gnu.org>
Cc: palmer <palmer@dabbelt.com>,
"richard.sandiford" <richard.sandiford@arm.com>,
"kito.cheng" <kito.cheng@gmail.com>,
"christoph.muellner" <christoph.muellner@vrull.eu>,
"rdapp.gcc" <rdapp.gcc@gmail.com>,
"juzhe.zhong" <juzhe.zhong@rivai.ai>,
"jinma.contrib" <jinma.contrib@gmail.com>
Subject: Re: [PATCH] haifa-sched: Avoid the fusion priority of the fused insn to affect the subsequent insn sequence.
Date: Sat, 8 Jun 2024 13:50:34 -0600 [thread overview]
Message-ID: <4dd759d6-549d-4fc3-bb86-ea868e675b69@gmail.com> (raw)
In-Reply-To: <bb28e09f-e0fa-4072-810e-4027095225fe.jinma@linux.alibaba.com>
On 6/6/24 8:51 PM, Jin Ma wrote:
>
> I am very sorry that I did not check the commit information carefully. The statement is somewhat inaccurate.
>
>> When the insn 1 and 2, 3 and 4 can be fusioned, then there is the
>> following sequence:
>>
>> ;; insn |
>> ;; 1 | sp=sp-0x18
>> ;; + 2 | [sp+0x10]=ra
>> ;; 3 | [sp+0x8]=s0
>> ;; 4 | [sp+0x0]=s1
>
>> The fusion priority of the insn 2, 3, and 4 are the same. According to
>> the current algorithm, since abs(0x10-0x8)<abs(0x10-0x0), the insn 2
>> is followed by the insn 3. It is obviously unreasonable to do so.
>>
>> Therefore, when we issue the insn 3 and 4, we should consider the fusion
>> priority of the insn 1 instead of the insn 2. And the final instruction
>> sequence is as follows:
>
>> ;; insn |
>> ;; 1 | sp=sp-0x18
>> ;; + 2 | [sp+0x10]=ra
>> ;; 4 | [sp+0x8]=s1
>> ;; + 3 | [sp+0x0]=s0
>>
>> gcc/ChangeLog:
>
>> * haifa-sched.cc (rank_for_schedule): Likewise.
>
> When the insn 1 and 2, 4 and 3 can be fusioned, then there is the
> following sequence:
>
> ;; insn |
> ;; 1 | sp=sp-0x18
> ;; + 2 | [sp+0x10]=ra
> ;; 3 | [sp+0x8]=s0
> ;; 4 | [sp+0x0]=s1
>
> The fusion priority of the insn 2, 3, and 4 are the same. According to
> the current algorithm, since abs(0x10-0x8)<abs(0x10-0x0), the insn 2
> is followed by the insn 3. It is obviously unreasonable to do so.
>
> Therefore, when we issue the insn 3 and 4, we should consider the fusion
> priority of the insn 1 instead of the insn 2. And the final instruction
> sequence is as follows:
>
> ;; insn |
> ;; 1 | sp=sp-0x18
> ;; + 2 | [sp+0x10]=ra
> ;; 4 | [sp+0x0]=s1
> ;; + 3 | [sp+0x8]=s0
>
> gcc/ChangeLog:
>
> * haifa-sched.cc (rank_for_schedule): Likewise.
I'd really love to see a testcase here, particularly since I'm still
having trouble understanding the code you're currently getting vs the
code you want.
Furthermore, I think I need to understand the end motivation here. I
always think of fusion priority has bringing insns consecutive so that
peephole pass can then squash two more more insns into a single insn.
THe canonical case being load/store pairs.
If you're trying to generate pairs, then that's fine. I just want to
make sure I understand the goal. And if you're trying to generate pairs
what actually can be paired? I must admit I don't have any notable
experience with the thead core extensions.
If you're just trying to keep the instructions consecutive in the IL,
then I don't think fusion priorities are a significant concern. Much
more important for that case is the fusion pair detection (which I think
is about to get a lot more attention in the near future).
Jeff
prev parent reply other threads:[~2024-06-08 19:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 2:37 Jin Ma
2024-06-07 2:51 ` Jin Ma
2024-06-08 19:50 ` Jeff Law [this message]
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=4dd759d6-549d-4fc3-bb86-ea868e675b69@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=christoph.muellner@vrull.eu \
--cc=gcc-patches@gcc.gnu.org \
--cc=jinma.contrib@gmail.com \
--cc=jinma@linux.alibaba.com \
--cc=juzhe.zhong@rivai.ai \
--cc=kito.cheng@gmail.com \
--cc=palmer@dabbelt.com \
--cc=rdapp.gcc@gmail.com \
--cc=richard.sandiford@arm.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).