-
Notifications
You must be signed in to change notification settings - Fork 42
Add RISC-V Profiles format #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This got briefly brought up during the SIG toolchain meeting today, but got rapidly derailed into a process discussion. Since the root point seems important, I am repeating it here. In addition to defining the syntax for the -march string for profiles, there is a separate set of task items required to define and implement support for each of the new extensions which were defined in the ratified profile document. From the perspective of LLVM, my current intent is to make the support for all the various extensions a blocker for merging the -march profile parsing support. This may evolve, and I'm open to the arguments on why we should adopt a different posture, but that argument will need to be explicitly made. |
You are right, Christoph added a comment here riscv-admin/dev-partners#16 (comment). In fact, we need to nothing until those new extensions are actually ratified(more details are needed in extenisons specification to approach). So I think maybe is a good idea that only implements the new extensions' names in toolchain Profiles support. |
README.mkd
Outdated
To distinguish between ordinary extension input and input with profiles, | ||
profiles are assumed to be entered `at the beginning of the -march option`, and | ||
then input other extensions. Profiles `should use uppercase letters` in the `-march` | ||
option. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect placement of code (backtick) markup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to emphasize here the rules for using, do you have any good solutions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To distinguish between ordinary extension input and input with profiles, | |
profiles are assumed to be entered `at the beginning of the -march option`, and | |
then input other extensions. Profiles `should use uppercase letters` in the `-march` | |
option. | |
To distinguish between ordinary extension input and input with profiles, | |
profiles are assumed to be entered `at the beginning of the -march option`, and | |
then input other extensions. Profiles *should use uppercase letters* in the `-march` | |
option. |
The status of the profiles support was briefly discussed in today's SIG toolchain call:
|
An initial patch was sent to the GCC mailing list today: https://gcc.gnu.org/pipermail/gcc-patches/2023-November/637490.html |
Uppercase strings being required in things like -march is very unusual; I would be much more in favour of keeping things lowercase |
The architecture review committee has sent out the following text about how profiles support in toolchains should look like:
|
Draft LLVM implementation: llvm/llvm-project#76357. |
This PR implements the draft riscv-non-isa/riscv-toolchain-conventions#36. Currently, we replace specified profile in `-march` with standard arch string. We may need to pass it to backend so that we can emit an ELF attr proposed by riscv-non-isa/riscv-elf-psabi-doc#409.
Reverse ping. Is there any progress? |
The GCC implementation is tracked here: riscv-admin/dev-partners#16. There was a request to wait on the GCC patch regarding the adoption of profiles in toolchain components: https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641025.html. So, at this point, we have clear guidelines from RVI regarding the adoption. We have this PR, and we have patches for GCC and LLVM. This can all move forward if upstream maintainers are fine with it. Given the relatively low impact on toolchains, I'm fine with waiting until the GCC 15 branch opens up. |
This PR implements the draft riscv-non-isa/riscv-toolchain-conventions#36. Currently, we replace specified profile in `-march` with standard arch string.
Sync the format with LLVM implement, using lowercase and |
src/toolchain-conventions.adoc
Outdated
|
||
Profiles format has the following BNF form `"-march="<profile-name>"_"[option-ext]*`. | ||
|
||
`profile-name ::= "RV"<profile-family-name><profile-ratified-year><privilege-mode><ISA-XLEN>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming convention of profiles may not be like this any more if I read what the sig-profiles (https://lists.riscv.org/g/sig-profiles/message/83) is doing rightly. The proposed profile naming is here (I don't know if every one can read it): https://docs.google.com/document/d/19xXIMnk1MNRZIp9fnW0yzBvnRnqko0LJT0XUjUvDVZ4/
So, I think, here we can just say that profile-name
will be a valid list of released profiles. As for the format, we should refer to the document of profiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok,it sounds great, will update it in new version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we don't need these eBNFs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
src/toolchain-conventions.adoc
Outdated
`option-ext ::= 'a legal RISC-V extension name'` | ||
|
||
As the spec defines, to use the profiles it should follow profile naming convention | ||
(See [3.4 form spec doc](https://github.com/riscv/riscv-profiles)), the toolchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
", the toolchain will check" should be the start of a new sentence.
src/toolchain-conventions.adoc
Outdated
|
||
`option-ext ::= 'a legal RISC-V extension name'` | ||
|
||
As the spec defines, to use the profiles it should follow profile naming convention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is kind of awkward.
src/toolchain-conventions.adoc
Outdated
@@ -216,6 +216,43 @@ As of November 2021 the additional tail-call entry points are only | |||
implemented in compiler-rt, and calls will only be generated by LLVM | |||
when the option `-mllvm -save-restore-tailcall` is specified. | |||
|
|||
== Profile-based format | |||
|
|||
Profiles name will be a valid list of released profiles, it should be recognized and used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Profiles name" -> "Profile names" if we are talking about a list of names of multiple profiles.
src/toolchain-conventions.adoc
Outdated
|
||
`profile-family-name ::= "i" | "m" | "a"` | ||
|
||
`profile-ratified-year-version ::= "20" | "22" | "23A" | "23B"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't the profiles named rva23 and rvb23. There is no A or B after 23.
src/toolchain-conventions.adoc
Outdated
|
||
`profile-name ::= "RV"<profile-family-name><profile-ratified-year><privilege-mode><ISA-XLEN>` | ||
|
||
`profile-family-name ::= "i" | "m" | "a"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing "b"
src/toolchain-conventions.adoc
Outdated
|
||
To distinguish between ordinary extension input and input with profiles, | ||
profiles are assumed to be entered *at the beginning of the -march option*, and | ||
then input other extensions. Profiles should input in the `-march` option. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Profiles should input in the -march
option." seems redundant with the previous sentece.
src/toolchain-conventions.adoc
Outdated
|
||
`-march=rvi20u64_zbkb_zkne -mabi=lp64` equals `-march=rv64i_zbkb_zkne -mabi=lp64` | ||
|
||
`-march=rva22u32` equals `-march=rv64gcb_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zihpm_za64rs_zfhmin_zkt` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no rva22u32 profile. I think this should be rva22u64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your comments, fixed in new commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one minor comment
src/toolchain-conventions.adoc
Outdated
in the `-march=` option. The benefit of using the `-march` option is easy for toolchain | ||
parsing the profiles string and expanding it into normal extensions combinations. | ||
|
||
Profiles format has the following BNF form `"-march="<profile-name>"_"[option-ext]*`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BNF should be "-march="<profile-name>["_"option-ext]*
? The underline is optional when there is no optional extra extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks for the mention, update with new commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Ping.. |
Could you rebase and squash all commit into one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fix typo and adjust examples. Signed-off-by: Jiawei <[email protected]>
Profiles support landed in GCC: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=43b450e3f72a53c744e77f55393962f1d349373a Thanks @pz9115! |
@pz9115, the CI complains about a trailing whitespace. @kito-cheng and others, given the long history of the profile support discussion, I think we should just land this PR as is. |
@cmuellner no objection on moving forward this first, we can tweak this later. |
This is a subset work form #26.
Add RISC-V Profiles format only. The doc record in:
https://docs.google.com/document/d/1TZXRIgVfQHWQ6xrZflHXUCSav6xNmliojrW2bEsvPno/edit.