public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
To: jeffreyalaw@gmail.com
Cc: Robin Dapp <rdapp.gcc@gmail.com>,
	gcc-patches@gcc.gnu.org, Kito Cheng <kito.cheng@gmail.com>,
	juzhe.zhong@rivai.ai
Subject: Re: [PATCH v2] RISC-V: Introduce -mrvv-allow-misalign.
Date: Fri, 24 May 2024 16:39:01 -0700 (PDT)	[thread overview]
Message-ID: <mhng-448fadc3-ce49-477a-a0f5-53ab9bb1897f@palmer-ri-x1c9> (raw)
In-Reply-To: <b92eac08-5d19-41cb-baaf-ac097025ce12@gmail.com>

On Fri, 24 May 2024 16:31:48 PDT (-0700), jeffreyalaw@gmail.com wrote:
>
>
> On 5/24/24 11:14 AM, Palmer Dabbelt wrote:
>> On Fri, 24 May 2024 09:19:09 PDT (-0700), Robin Dapp wrote:
>>>> We should have something in doc/invoke too, this one is going to be
>>>> tricky for users.  We'll also have to define how this interacts with
>>>> the existing -mstrict-align.
>>>
>>> Addressed the rest in the attached v2 which also fixes tests.
>>> I'm really not sure about -mstrict-align.  I would have hoped that using
>>> -mstrict-align we'd never run into any movmisalign situation but that
>>> might be wishful thinking.  Do we need to specify an
>>> interaction, though?  For now the new options disables movmisalign so
>>> if we hit that despite -mstrict-align we'd still not vectorize it.
>>
>> I think we just need to write it down.  I think there's two ways to
>> encode this: either we treat scalar and vector as independent, or we
>> couple them.  If we treat them independently then we end up with four
>> cases, it's not clear if they're all interesting.  IIUC with this patch
>> we'd be able to encode
> Given the ISA documents them as independent, I think we should follow
> suit and allow them to vary independently.

I'm only reading Zicclsm as saying both scalar and vector misaligned 
accesses are supported, but nothing about the performance.

>> * -mstrict-align: Both scalar and vector misaligned accesses are
>>   unsupported (-mrvv-allow-misalign doesn't matter).  I'm not sure if
>>   there's hardware there, but given we have systems that don't support
>>   scalar misaligned accesses it seems reasonable to assume they'll also
>>   not support vector misaligned accesses.
>> * -mno-strict-align -mno-rvv-allow-misalign: Scalar misaligned are
>>   supported, vector misaligned aren't supported.  This matches our best
>>   theory of how the k230 and k1 behave, so it also seems reasonable to
>>   support.
>> * -mno-strict-align -mrvv-allow-misalign: Both scalar and vector
>>   misaligned accesses are supported.  This seems reasonable to support
>>   as it's how I'd hope big cores end up being designed, though again
>>   there's no hardware.
> I'd almost lean towards -m[no-]scalar-strict-align and
> -m[no-]vector-strict-align and deprecate -mstrict-align (aliasing it to
> the scalar alignment option).  But I'll go with consensus here.

Seems reasonable to me.  Just having a regular naming scheme for the 
scalar/vector makes it clear what we're doing, and it's not like having 
the extra name for -mscalar-strict-align really costs anything.

>> The fourth case is kind of wacky: scalar misaligned is unsupported,
>> vector misaligned is supported.  I'm not really sure why we'd end up
>> with a system like that, but HW vendors do wacky things so it's kind of
>> hard to predict.
> I've worked on one of these :-)  The thinking from the designers was
> unaligned scalar access just wasn't that important, particularly with
> mem* and str* using the vector rather than scalar ops.

OK then ;)

  reply	other threads:[~2024-05-24 23:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 14:30 [PATCH] " Robin Dapp
2024-05-24 15:03 ` Palmer Dabbelt
2024-05-24 16:19   ` [PATCH v2] " Robin Dapp
2024-05-24 17:14     ` Palmer Dabbelt
2024-05-24 20:16       ` Robin Dapp
2024-05-24 23:31       ` Jeff Law
2024-05-24 23:39         ` Palmer Dabbelt [this message]
2024-05-24 23:41           ` Jeff Law
2024-05-24 23:43             ` Palmer Dabbelt
2024-05-24 23:50               ` Jeff Law
2024-05-25  0:05                 ` Palmer Dabbelt
2024-05-27 12:45                   ` [PATCH v3] RISC-V: Introduce -mvector-strict-align Robin Dapp
2024-05-27 14:05                     ` Kito Cheng
2024-05-27 14:13                       ` Robin Dapp

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=mhng-448fadc3-ce49-477a-a0f5-53ab9bb1897f@palmer-ri-x1c9 \
    --to=palmer@dabbelt.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.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).