Skip to content
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

Add RISC-V Profiles format #36

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/toolchain-conventions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,41 @@ 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 should be recognized and used 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]*`.

`profile-name ::= "RV"<profile-family-name><profile-ratified-year><privilege-mode><ISA-XLEN>`
Copy link

@wangpc-pp wangpc-pp Jan 7, 2025

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.

Copy link
Author

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.

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.


`profile-family-name ::= "i" | "m" | "a"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "b"


`profile-ratified-year-version ::= "20" | "22" | "23A" | "23B"`
Copy link
Contributor

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.


`privilege-mode ::= "u" | "s" | "m"`

`ISA-XLEN ::= "64" | "32"`

`option-ext ::= 'a legal RISC-V extension name'`

As the spec defines, to use the profiles it should follow profile naming convention
Copy link
Contributor

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.

(See [3.4 form spec doc](https://github.com/riscv/riscv-profiles)), the toolchain
Copy link
Contributor

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.

will check whether an input profile name is correct at first, then do the parse
work.

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.
Copy link
Contributor

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.


Examples:

`-march=rvi20u64 -mabi=lp64` equals `-march=rv64i -mabi=lp64`

`-march=rva22u32` equals `-march=rv64gcb_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zihpm_za64rs_zfhmin_zkt`
kito-cheng marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

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?

Copy link
Author

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.


== Conventions for vendor extensions

Support for custom instruction set extensions are an important part of RISC-V,
Expand Down