public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@rivosinc.com>
To: jeffreyalaw@gmail.com
Cc: Kito Cheng <kito.cheng@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] RISC-V: Add the Zihpm and Zicntr extensions
Date: Tue, 22 Nov 2022 14:00:35 -0800 (PST)	[thread overview]
Message-ID: <mhng-ccdb5c02-e118-4ad5-92ba-01195d9c1ba2@palmer-ri-x1c9> (raw)
In-Reply-To: <5bad6dad-f46e-620b-382c-31615b00d1bc@gmail.com>

On Tue, 22 Nov 2022 13:50:28 PST (-0800), jeffreyalaw@gmail.com wrote:
>
> On 11/22/22 08:29, Palmer Dabbelt wrote:
>> On Tue, 22 Nov 2022 07:20:15 PST (-0800), jeffreyalaw@gmail.com wrote:
>>>
>>> On 11/20/22 18:36, Kito Cheng wrote:
>>>>> So the idea here is just to define the extension so that it gets
>>>>> defined
>>>>> in the ISA strings and passed through to the assembler, right?
>>>> That will also define arch test marco:
>>>>
>>>> https://github.com/riscv-non-isa/riscv-c-api-doc/blob/master/riscv-c-api.md#architecture-extension-test-macro
>>>>
>>>
>>> Sorry I should have been clearer and included the test macro(s) as well.
>>>
>>> So a better summary would be that while it doesn't change the codegen
>>> behavior in the compiler, it does provide the mechanisms to pass along
>>> isa strings to other tools such as the assembler and signal via the test
>>> macros that this extension is available.
>>
>> IMO the important bit here is that we're not adding any compatibility
>> flags, like we did when fence.i was removed from the ISA.  That's fine
>> as long as we never remove these instructions from the base ISA in the
>> software, but that's what's suggested by Andrew in the post.
>
> Right.  IIUC these instructions were never supposed to be in the base
> ISA, but, in effect, snuck through.  We're retro-actively adding them as
> an extension, at least in terms of ISA strings & test macros.  We're
> currently (forever?) going to allow them in the assembler without
> strictly requiring the extension be on.

That'd the the idea.

>> It's a super weird one, but there's a bunch of cases in RISC-V where
>> we're told to just ignore words in the ISA manual.  Definitely a trap
>> for users (and we already had some Linux folks get bit by the counter
>> changes here), but that's just how RISC-V works.
>
> Mistakes happen.  The key is to adjust for them as best as we can.   
> I'd lean towards a stricter enforcement, bringing these
> instructions/extension in line with how we handle the others. It'd
> potentially mean source incompatibilities that would need to be fixed,
> but they shouldn't be difficult and we're still early enough in the game
> that we *could* take that route.  Andrew's position is more
> accommodating of existing code and while I may not 100% agree with his
> position, I understand it.
>
>
> So while I'd lean towards a stricter checking, I can live with this
> approach.  I wouldn't mind hearing from Kito, Philipp and others though.

That's the sort of thing we've traditionally done: essentially just read 
the actual words in the PDF and produce implementations that match 
those, tagging versions when things change (the fence.i stuff is a good 
example).  After some amount of time we can then move the default spec 
version over to the new one.  That's a little bit of churn for users, 
but it shouldn't be all that bad.

IMO that's the sane way to go, I'd certainly expect to be able to read 
the words in the PDFs and go implement things according to them.  It's 
pretty clearly not what the ISA folks want, though.

There's also the secondary issue of getting ISA strings to match between 
the various bits of the software stack that uses them.  We're trying to 
move away from ISA strings as a stable uABI in Linux for exactly this 
reason, but ISA strings have already ended up all over the place so 
there's only so much we can do.

  reply	other threads:[~2022-11-22 22:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09  3:00 Palmer Dabbelt
2022-11-18  2:14 ` Christoph Müllner
2022-11-18  4:29   ` Palmer Dabbelt
2022-11-20 16:19 ` Jeff Law
2022-11-21  1:36   ` Kito Cheng
2022-11-22 15:20     ` Jeff Law
2022-11-22 15:29       ` Palmer Dabbelt
2022-11-22 21:50         ` Jeff Law
2022-11-22 22:00           ` Palmer Dabbelt [this message]
2024-01-19  8:01             ` Kito Cheng

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-ccdb5c02-e118-4ad5-92ba-01195d9c1ba2@palmer-ri-x1c9 \
    --to=palmer@rivosinc.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=kito.cheng@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).