Skip to content

arcv: simplify multilib configurations and cover more cases #147

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

Merged
merged 3 commits into from
Apr 11, 2025

Conversation

kolerov
Copy link
Contributor

@kolerov kolerov commented Mar 26, 2025

List of changes

  1. Remove Zicsr from all configurations. It's not necessary anymore since crt0 in Newlib and Picolibc is built with Zicsr extension explicitly.
  2. Remove Zcmp from all configurations. It may reduce performance significantly but the gain in library size is minimal.
  3. Remove Zcmt from all configurations. GCC does not produce Zcmt code by default.
  4. Add more general configurations for testing.

Toolchain's size

When installed the toolchain occupies ~13GB. A compressed tar.xz archive (LZMA) occupies ~1.3GB with maximum compression rate.

List of RMX-100 mini configurations

  • All RMX-100 mini configurations use -mtune=arc-v-rmx-100-series.
  • All RMX-100 mini configurations use -mcmodel=medlow.
march mabi Comment
rv32e ilp32e General configuration
rv32em ilp32e General configuration
rv32ea ilp32e General configuration
rv32ema ilp32e General configuration
rv32emac_zcb_zba_zbb_zbs_zfinx_zdinx ilp32e Full featured RMX-100 mini

List of RMX-100 configurations

  • All RMX-100 configurations use -mtune=arc-v-rmx-100-series.
  • All RMX-100 configurations use -mcmodel=medlow.
  • All RMX-100 profiles include zcb_zba_zbb_zbs set. All optimized configurations include them. However, using C extensions may lead to performance decrease for RMX-100, thus additional optimized configurations without C are shipped too.
march mabi Comment
rv32i ilp32 General configuration
rv32ic ilp32 General configuration
rv32im ilp32 General configuration
rv32ia ilp32 General configuration
rv32ima ilp32 General configuration
rv32iac ilp32 General configuration
rv32imac ilp32 General configuration
rv32ic_zcb_zba_zbb_zbs ilp32 Optimized configuration
rv32imc_zcb_zba_zbb_zbs ilp32 Optimized configuration
rv32imac_zcb_zba_zbb_zbs ilp32 Optimized configuration
rv32imac_zcb_zba_zbb_zbs_zfinx ilp32 Optimized configuration with SP FPU
rv32imac_zcb_zba_zbb_zbs_zfinx_zdinx ilp32 Optimized configuration with DP FPU
rv32i_zba_zbb_zbs ilp32 Optimized configuration without C
rv32im_zba_zbb_zbs ilp32 Optimized configuration without C
rv32ima_zba_zbb_zbs ilp32 Optimized configuration without C
rv32ima_zba_zbb_zbs_zfinx ilp32 Optimized configuration without C with SP FPU
rv32ima_zba_zbb_zbs_zfinx_zdinx ilp32 Optimized configuration without C with DP FPU

List of RMX-500 configurations

  • All RMX-500 configurations use -mtune=arc-v-rmx-500-series.
  • All RMX-500 configurations use -mcmodel=medlow.
  • All RMX-500 profiles include zcb_zba_zbb_zbs set. All optimized configurations include them.
march mabi Comment
rv32i ilp32 General configuration
rv32ic ilp32 General configuration
rv32im ilp32 General configuration
rv32ia ilp32 General configuration
rv32ima ilp32 General configuration
rv32iac ilp32 General configuration
rv32imac ilp32 General configuration
rv32ic_zcb_zba_zbb_zbs ilp32 Optimized configuration
rv32imc_zcb_zba_zbb_zbs ilp32 Optimized configuration
rv32imac_zcb_zba_zbb_zbs ilp32 Optimized configuration
rv32imac_zcb_zba_zbb_zbs_zfinx ilp32 Optimized configuration with SP FPU
rv32imac_zcb_zba_zbb_zbs_zfinx_zdinx ilp32 Optimized configuration with DP FPU

List of RHX-100 configurations

  • All RHX-100 configurations use -mtune=arc-v-rhx-100-series.
  • All RHX-100 configurations use -mcmodel=medlow.
  • All RHX-100 profiles include mac_zcb_zba_zbb_zbs set. All optimized configurations include them.
  • RHX-100 does not support Zcd and configurations with D extension contain Zca instead of C.
march mabi Comment
rv32i ilp32 General configuration
rv32ic ilp32 General configuration
rv32im ilp32 General configuration
rv32ia ilp32 General configuration
rv32ima ilp32 General configuration
rv32iac ilp32 General configuration
rv32imac ilp32 General configuration
rv32imafc ilp32f General configuration with FPU
rv32imafd_zca ilp32d General configuration with FPU
rv32imac_zcb_zba_zbb_zbs ilp32 Optimized configuration
rv32imafc_zcb_zba_zbb_zbs ilp32f Optimized configuration with SP FPU
rv32imafd_zca_zcb_zba_zbb_zbs ilp32d Optimized configuration with DP FPU

List of RPX-100 configurations

  • All RPX-100 configurations use -mtune=arc-v-rhx-100-series.
  • All RPX-100 configurations use -mcmodel=medany.
  • All RPX-100 profiles include mac_zcb_zba_zbb_zbs set. All optimized configurations include them.
march mabi Comment
rv64i lp64 General configuration
rv64ic lp64 General configuration
rv64im lp64 General configuration
rv64imc lp64 General configuration
rv64ia lp64 General configuration
rv64ima lp64 General configuration
rv64iac lp64 General configuration
rv64imac lp64 General configuration
rv64imafdc lp64d General configuration
rv64imac_zcb_zba_zbb_zbs lp64 Speed optimized configuration
rv64imafdc_zcb_zba_zbb_zbs lp64 Speed optimized configuration with DP FPU

1. Remove Zicsr from all configurations. It's not necessary
   anymore since crt0 in Newlib and Picolibc is built with
   Zicsr extension explicitly.
2. Remove Zcmp from all configurations. It may reduce performance
   significantly but the gain in library size is minimal.
3. Remove Zcmt from all configurations. GCC does not produce
   Zcmt code by default.
4. Add more general configurations for testing.

Signed-off-by: Yuriy Kolerov <[email protected]>
arcv_march_variants += rv32imac_zcb_zba_zbb_zbs_zfinx
arcv_march_variants += rv32imac_zcb_zba_zbb_zbs_zfinx_zdinx
arcv_march_variants += rv32i_zba_zbb_zbs
arcv_march_variants += rv32im_zba_zbb_zbs
Copy link
Collaborator

Choose a reason for hiding this comment

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

IIRC, the most critical insns for strcmp() are or.b and rev8 which are both part of Zbb. Should we create a fallback without Zba and Zbs, but with Zbb?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think that it's reasonable now. There could be too many of such fallbacks with a single zbb for all possible variants of march.

@kolerov kolerov requested a review from artemiy-volkov March 28, 2025 07:51
Copy link
Collaborator

@artemiy-volkov artemiy-volkov left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@kolerov
Copy link
Contributor Author

kolerov commented Mar 28, 2025

@abrodkin Could you please take a look at this new list?

@abrodkin
Copy link
Member

abrodkin commented Apr 7, 2025

What I'd like to see in that PR description at least:

  1. Motivation for the current set of configurations in a more digestible way like "we build libraries to match the following configurations of the tree ARC-V processor series (i.e. for each processor family we re-build libraries optimized for the particular pipeline, which is preserved for all processors within the family)".
  2. Toolchain distribution implications: multilib toolchain tarball contains XXX library sets and that takes ~YYY GB of size packed in the archive, while installed it occupies ~ZZZ TB.

@kolerov
Copy link
Contributor Author

kolerov commented Apr 8, 2025

@abrodkin I updated PR's description.

We have 4 -mtune values for ARC-V targets:

1. arc-v-rmx-100-series
2. arc-v-rmx-500-series
3. arc-v-rhx-100-series
4. arc-v-rpx-100-series

When all of them are mentioned in a multilib configuration file
(t-arcv for ARC-V) and arc-v-rmx-100-series is a default -mtune
value (-with-tune= configuration option for GCC), then GCC cannot
build with default target options (like gcc app.c -o app).

To fix this we had to use -with-tune=rocket. However, with such
approach we have to pass -mtune for a particular ARC-V
target manually and not rely on RMX-100 as a default target.

This patch removes -mtune from t-arcv for all RMX-100 targets
and sets -with-tune=arc-v-rmx-100-series if it's not set
explicitly (it corresponds to -with-tune=default). This allows
using -mtune=arc-v-rmx-100-series as default without passing
extra configuration options to GCC build scripts and fixes that
bug with default target options.

Signed-off-by: Yuriy Kolerov <[email protected]>
@kolerov
Copy link
Contributor Author

kolerov commented Apr 10, 2025

@artemiy-volkov @abrodkin I pushed another patch (d067383) that also allows using -mtune=arc-v-rmx-100-series as a default -mtune without passing extra configuration options. This is another version of this closed PR: #139.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants