Archdetect riscv update - #243
Conversation
|
I think this update makes sense as it certainly gives more flexibility and would allow working with subsets of extensions instead of matching the whole ISA string. I suggest to change the comment in as it explains better why the replacement is done. The tokens here are just features/extensions and do not translate to compilation flags (in contrast with x86). At the end, when building we will need the ISA string (with underscores) anyway to pass it to the Which makes me think... if we do: where/how is the ISA string to pass to |
|
New job on instance
|
llvm: Supported profile names can be passed using -march instead of a standard ISA naming string. Currently supported profiles: GCC: -march=[ISA|Profile|Profile_ISA|processor-string] so if we use the profile name as the naming of the cpu, it can directly be used in the compilers... |
I'm not sure if I understand your question correctly, but: in principle, all our builds use the default value for EasyBuild's So yeah, making |
|
Folded the remaining useful bits from #234 into this PR:
Tokenized ISA matching from this PR is kept. Local RISC-V archdetect tests for p550, u74-mc, and both SpacemiT cases pass. Closing #234 as superseded by this PR. |
Build-time RISC-V optarch mapAdded the complementary piece to archdetect (runtime selection):
Example: |
GCC + Clang/LLVM optarch coverageMap entries are now EasyBuild multi-compiler strings, e.g. u74-mc: `GCC:-march=rva20u64 -mtune=sifive-u74 -mabi=lp64d;Clang:-mcpu=sifive-u74 -mabi=lp64d;LLVM:-mcpu=sifive-u74 -mabi=lp64d` CI installs `gcc-riscv64-linux-gnu` + `clang` and runs acceptance checks for both toolchains (`EESSI_RISCV_OPTARCH_REQUIRE_COMPILERS=1`). Locally verified: all GCC and Clang/LLVM flag sets compile an empty C unit. |
b40da49 to
a3adb93
Compare
Design note: RISC-V archdetect vs build-time
|
| x86/ARM assumption | RISC-V reality |
|---|---|
-march=native exists |
It does not |
| Host ≈ EESSI target | Breaks for profiles and cross-target bot jobs |
| Spec / ISA string ≈ compiler flag | Feature tokens for matching ≠ a -march string |
| Native implies good tuning | Need explicit -mtune / -mcpu |
EasyBuild’s get_isa_riscv() (easybuild-framework#5029) only helps “build on this host for this host”. It does not know about EESSI paths like riscv64/sifive/u74-mc or riscv64/generic/rva22u64.
/proc/cpuinfo isa: is also a poor CPU identity: it varies by vendor, kernel, and board (e.g. same SiFive vendor for P550 vs U74; different X60 ISA strings across kernels). Matching the whole ISA string was brittle; tokenizing it (this PR) fixes detection, but then the spec column is no longer a ready-made -march= value — so builds need another source of flags.
Design: split runtime selection from build-time flags
-
Runtime (archdetect) —
eessi_archdetect.sh+eessi_arch_riscv.spec
Choose the software subdirectory via tokenized ISA features + vendor.
Includes vendor targets (sifive/u74-mc,sifive/p550,spacemit/x60, …) and profile paths (riscv64/generic/rva20u64,rva22u64,rva23u64). -
Build time (optarch map) —
init/arch_specs/eessi_riscv_optarch.map+init/eessi_riscv_optarch.sh
Mapsoftware_subdir→EASYBUILD_OPTARCH(EasyBuild multi-compiler form:GCC:…;Clang:…;LLVM:…).
Wired inbot/build.shandEESSI-install-software.sh(honours pre-setEASYBUILD_OPTARCH/--generic).
Same idea as GPU builds: accel/nvidia/cc80 already maps to an explicit EasyBuild setting; RISC-V CPU targets need the same for -march/-mtune.
Flag roles
-march= legal instruction set (prefer RISC-V profiles where possible:rva20u64, …)-mtune/-mcpu= microarchitecture (e.g.sifive-u74,sifive-p400-series; SpacemiT stays-mtune=genericuntil toolchains grow a name)-mabi=lp64d= keep consistent with the EESSI RISC-V Linux userspaceGENERIC= EasyBuild’s compatibility floor (-march=rv64gc -mabi=lp64d), not an optimization strategy
Example (u74-mc):
GCC:-march=rva20u64 -mtune=sifive-u74 -mabi=lp64d;Clang:-mcpu=sifive-u74 -mabi=lp64d;LLVM:-mcpu=sifive-u74 -mabi=lp64d
What this PR lands
| Piece | Role |
|---|---|
| Tokenized RISC-V ISA matching | Reliable archdetect |
sifive/u74-mc + tests (from #234) |
VisionFive 2 / U74 detection |
| Profile + vendor specs | Runtime paths |
eessi_riscv_optarch.map |
Build-time flags for GCC + Clang/LLVM |
| CI for map + compiler acceptance | Guard the mapping |
Happy to adjust map entries (especially SpacemiT -march strings) based on review.
HaoZeke
left a comment
There was a problem hiding this comment.
The tokenization direction looks right to me and the vendored targets (p550, u74-mc, x60, x60-k6.6) are consistent between spec and map.
The generic profile entries are the problem: I don't think they can match at all under the vendor gate, one has a malformed token, and the specs are weaker than what the map compiles with; details inline.
On scope I'd split the optarch map + EESSI-extend Lua + its CI out, so the archdetect fix can merge while the optarch design gets its own discussion.
The map also has two parsers now, bash and Lua, which will drift.
d6d5ad1 to
9e84d31
Compare
|
Thanks for the extensive and precise review — summary of how the points land after the split: This PR (archdetect-only, tip 3d7f7e5)
Follow-up PR (local
Happy to resolve the archdetect threads once you’ve had a look at tip |
Drop the redundant generic/ nesting for RVA*U64 profile paths and the synthetic fixture basename, keeping riscv64/generic as the hardcoded rv64gc catch-all. Addresses Julian's path-shortening feedback on EESSI#243. Co-authored-by: Cursor <cursoragent@cursor.com>
Split underscore-separated ISA strings and expand compact rv64* base blobs into per-letter tokens so subset specs match supersets. Treat an empty Vendor ID as matching any host vendor for profile paths like riscv64/generic/rva*. Use portable [[:space:]] in sed and get_cpuinfo so BSD and GNU tools agree. Co-authored-by: Cursor <cursoragent@cursor.com>
Add generic rva20/22/23u64 profile specs with userspace floors that match after token expansion; fix rva23 base to rv64imafdcv. Rename jh7110 to sifive/u74-mc and use space-separated ISA tokens. Co-authored-by: Cursor <cursoragent@cursor.com>
Move HiFive Premier fixtures under sifive/p550, add VisionFive u74-mc and synthetic generic/rva20/22/23 hosts, refresh .all match lists, and extend the archdetect CI matrix. Co-authored-by: Cursor <cursoragent@cursor.com>
Matching floors now track the detectable mandatory userspace ISA subset of the ratified RVA20/22/23 U64 profiles (docs.riscv.org), including zicbo* and V on rva23. Omit PMA/behaviour tokens that never appear in cpuinfo; update synthetic and real fixture expectations accordingly. Co-authored-by: Cursor <cursoragent@cursor.com>
Vendor required-token lists already match fixture cpuinfo isa lines including S-mode tokens; clarify that full-ISA matching is intentional and that SpacemiT custom bits stay out until fixtures advertise them. Co-authored-by: Cursor <cursoragent@cursor.com>
Zifencei is a detectable mandatory RVA*U64 userspace extension; require it alongside zicsr/zicntr in generic/rva20–23 floors. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the redundant generic/ nesting for RVA*U64 profile paths and the synthetic fixture basename, keeping riscv64/generic as the hardcoded rv64gc catch-all. Addresses Julian's path-shortening feedback on EESSI#243. Co-authored-by: Cursor <cursoragent@cursor.com>
62763c9 to
95d6b1c
Compare
This update will treat the isa line from a riscv cpu (e.g. rv64imafdcv_zicbom_zicboz_zicntr_zicond_zicsr_zifencei_zihintpause_zihpm_zfh_zfhmin_zca_zcd_zba_zbb_zbc_zbs_zkt_zve32f_zve32x_zve64d_zve64f_zve64x_zvfh_zvfhmin_zvkt_sscofpmf_sstc_svinval_svnapot_svpbmt) and sed it into seperate flags which can be matched as relevant (!) features, the same way we do for x86_64. This should allow cpu's with the same relevant features, but from different vendors to be matched to the same cpu paths.