]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Add Vector cost model framework for RVV
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Thu, 31 Aug 2023 12:23:44 +0000 (20:23 +0800)
committerPan Li <pan2.li@intel.com>
Thu, 31 Aug 2023 12:42:17 +0000 (20:42 +0800)
commit4da3065a6422062b029df9660a226297802455f4
tree72e0e25fca9294bba0908d759b2d40ee40fb0df2
parent9ea1248604d7b65009af32103814332f35bd33e2
RISC-V: Add Vector cost model framework for RVV

Hi, currently RVV vectorization only support picking LMUL according to
compile option --param=riscv-autovec-lmul= which is no ideal.

Compiler should be able to pick optimal LMUL/vectorization factor to
vectorize the loop according to the loop_vec_info and SSA-based register
pressure analysis.

Now, I figure out current GCC cost model provide the approach that we
can choose LMUL/vectorization factor by adjusting the COST.

This patch is just add the minimum COST model framework which is still
applying the default cost model (No vector codes changed from before).

Regression all pased and no difference.

gcc/ChangeLog:

* config.gcc: Add vector cost model framework for RVV.
* config/riscv/riscv.cc (riscv_vectorize_create_costs): Ditto.
(TARGET_VECTORIZE_CREATE_COSTS): Ditto.
* config/riscv/t-riscv: Ditto.
* config/riscv/riscv-vector-costs.cc: New file.
* config/riscv/riscv-vector-costs.h: New file.
gcc/config.gcc
gcc/config/riscv/riscv-vector-costs.cc [new file with mode: 0644]
gcc/config/riscv/riscv-vector-costs.h [new file with mode: 0644]
gcc/config/riscv/riscv.cc
gcc/config/riscv/t-riscv