This is an archive of the discontinued LLVM Phabricator instance.

[LLVM][RISCV] Check more extension dependencies
AbandonedPublic

Authored by imkiva on Jul 25 2023, 1:38 AM.

Details

Reviewers
craig.topper
Summary

This patch addresses two TODOs in RISCVISAInfo::checkDependency:

  • Report error when both e and f (or d) extensions are specified in -march
  • Report error when q extension is specified when rv64 is unavailable
  • Corresponding unit tests are also updated

Currently, I cannot add a test about the q extension case because there's no q extension registered in either supported extensions or experimental extensions,
but the code added here should work fine if we have a proper q implementation in the future.

Diff Detail

Event Timeline

imkiva created this revision.Jul 25 2023, 1:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 25 2023, 1:38 AM
imkiva requested review of this revision.Jul 25 2023, 1:38 AM
imkiva updated this revision to Diff 543890.Jul 25 2023, 2:19 AM

Removed some tests that used e together with f or d

wangpc added inline comments.Jul 25 2023, 2:24 AM
llvm/lib/Support/RISCVISAInfo.cpp
948

I think the comment is outdated here. E can be combined with all other extensions according to spec:

Unless otherwise stated, standard extensions compatible with RV32I and RV64I are also compatible with RV32E and RV64E, respectively.

And, please see also D70401 for more context.

address review comments

llvm/lib/Support/RISCVISAInfo.cpp
948

I downloaded the specification from here, and in page 34 the footnote says:

RV32E can be combined with all current standard extensions. Defining the F, D, and Q extensions as having a 16-entry floating point register file when combined with RV32E was considered but decided against. To support systems with reduced floating-point register state, we intend to define a “Zfinx” extension...

It seems in the spec version 20191213, they rejected the combination of E with standard floating-point extensions, instead, a separate extension Zfinx is chosen for the original purpose.
I am not sure if there's any newer specification that decides to allow this combination.

asb added inline comments.Jul 25 2023, 4:59 AM
llvm/lib/Support/RISCVISAInfo.cpp
948

There's a link to the ratified version on https://wiki.riscv.org/display/HOME/Recently+Ratified+Extensions - see https://drive.google.com/file/d/1GjHmphVKvJlOBJydAt36g0Oc8yCOPtKw/view

As @wangpc says, the restriction was removed and so the comment is out of date.

craig.topper added inline comments.Jul 25 2023, 5:01 PM
llvm/lib/Support/RISCVISAInfo.cpp
948

I'm not sure this is true.

craig.topper added inline comments.Jul 25 2023, 5:42 PM
llvm/lib/Support/RISCVISAInfo.cpp
948
craig.topper added inline comments.Jul 25 2023, 5:51 PM
llvm/lib/Support/RISCVISAInfo.cpp
948

RV32E can be combined with all current standard extensions. Defining the F, D, and Q extensions as having a 16-entry floating point register file when combined with RV32E was considered but decided against. To support systems with reduced floating-point register state, we intend to define a “Zfinx” extension...

That really only says that the register file for F and D is still 32 entries with RV32E. It doesn't say they are incompatible. Maybe there was some even older text?

craig.topper added inline comments.Jul 25 2023, 6:00 PM
llvm/lib/Support/RISCVISAInfo.cpp
948
craig.topper added a comment.EditedJul 25 2023, 6:02 PM

I have deleted the two TODOs in 02c11c5aed59624046125cf512c12f70d2fa358d

Looks like I am reading a very old version of the spec haha. Anyway, thank you all for giving me the newest information and useful links! Thanks!!

imkiva abandoned this revision.Jul 25 2023, 10:51 PM