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

fix multilib support and rework --with-extra-multilib-test #1395

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ewlu
Copy link
Contributor

@ewlu ewlu commented Dec 20, 2023

This pull request allows the following functionality:

  1. Enable multilib support with generate_target_board.py and allow additional testing configurations without needing --with-extra-multilib-test flag
  2. Enable linux multilib support using --with-multilib-generator

Currently --with-multilib-generator with more than one target is not supported with generate_target_board.py. For example,

  $ ../configure --prefix=/scratch/ewlu/ci/triage/other/build-newlib --with-multilib-generator="rv64gcv-lp64d--;rv32gcv-ilp32d--"

will have an error

usage: generate_target_board [-h] --sim-name SIM_NAME --build-arch-abi
                             BUILD_ARCH_ABI
                             [--extra-test-arch-abi-flags-list EXTRA_TEST_ARCH_ABI_FLAGS_LIST]
                             [--cmodel CMODEL]
generate_target_board: error: unrecognized arguments: rv32gcv-ilp32d

This is because generate_target_board expects rv32gcv-ilp32d to be passed in through --with-extra-multilib-test.

We fix generate_target_board.py's problem with multilib by changing the script arguments to accept a list of different configurations while maintaining the internal logic

For example, instead of running configure flags
--with-arch=rv64gc --with-abi=lp64d --with-extra-multilib-test="rv64gcv-lp64d:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax;rv64gcv_zba-lp64d"
to generate

riscv-sim/-march=rv64gc/-mabi=lp64d/-mcmodel=medlow
riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic/--param=riscv-autovec-preference=fixed-vlmax
riscv-sim/-march=rv64gcv_zba/-mabi=lp64d/-mcmodel=medlow

we can run
--with-multilib-generator="rv64gc-lp64d--;rv64gcv-lp64d--:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax;rv64gcv_zba-lp64d--
to generate the same boards
Alternatively, if we just want to run one target, the new flag --with-test-flags enables single target flexibility so
--with-arch=rv64gcv --with-abi=lp64d --with-test-flags="--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax"
will generate target board

riscv-sim/-march=rv64gcv/-mabi=lp64d/-mcmodel=medlow/--param=riscv-autovec-lmul=dynamic/--param=riscv-autovec-preference=fixed-vlmax

--with-multilib-generator="<targets>" will fail with make report-linux because the desired targets will always be overwritten with the defaults (therefore testing incorrect targets). This supports the intended linux multilib builds and tests.

Copy link
Collaborator

@patrick-rivos patrick-rivos left a comment

Choose a reason for hiding this comment

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

This is cool - I like the unified syntax for --with-multilib-generator and --with-extra-multilib-test. Specifying the flags lets us run multilibs where all the multilibs have options specified (we don't need to test a dummy config if we're only interested in --param=riscv-autovec-preference=fixed-vlmax). Adding --with-test-flags also makes sense to me.

For my own understanding @kito-cheng is the only difference between --with-multilib-generator and --with-extra-multilib-test that --with-extra-multilib-test doesn't build a new glibc for each mutilib?

@kito-cheng
Copy link
Collaborator

For my own understanding @kito-cheng is the only difference between --with-multilib-generator and --with-extra-multilib-test that --with-extra-multilib-test doesn't build a new glibc for each mutilib?

--with-multilib-generator will pass to GCC to configure the multilib, and it only support -mabi, -march and -mcmodel for the multilib selection.

For linux toolchain, we only use -mabi for the multilib selection, so it's not really make too much sense to configure linux toolchain with --with-multilib-generator="rv64gc-lp64d--;rv64gcv-lp64d--:--param=riscv-autovec-lmul=dynamic:--param=riscv-autovec-preference=fixed-vlmax;rv64gcv_zba-lp64d--, because rv64gc-lp64d--, rv64gcv-lp64d-- and rv64gcv_zba-lp64d-- are all mapping to /lib/lp64d.

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