]> gcc.gnu.org Git - gcc.git/commit
RISC-V: Fix regression (GCC-14 compare with GCC-13.2) of SHA256 from coremark-pro
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Mon, 15 Jan 2024 12:00:14 +0000 (20:00 +0800)
committerPan Li <pan2.li@intel.com>
Mon, 15 Jan 2024 13:13:33 +0000 (21:13 +0800)
commit7be87b7d2e330afd14a7cc028f64d88f80e12f40
treeda0b5e7b6185751c045adafabd45638e7ed5ae32
parent405096f908e1ceb0d6a1b5420ded20ad85ddae9e
RISC-V: Fix regression (GCC-14 compare with GCC-13.2) of SHA256 from coremark-pro

This patch fixes -70% performance drop from GCC-13.2 to GCC-14 with -march=rv64gcv in real hardware.

The root cause is incorrect cost model cause inefficient vectorization which makes us performance drop significantly.

So this patch does:

1. Adjust vector to scalar cost by introducing v to scalar reg move.
2. Adjust vec_construct cost since we does spend NUNITS instructions to construct the vector.

Tested on both RV32/RV64 no regression, Rebase to the trunk and commit it as it is approved by Robin.

PR target/113247

gcc/ChangeLog:

* config/riscv/riscv-protos.h (struct regmove_vector_cost): Add vector to scalar regmove.
* config/riscv/riscv-vector-costs.cc (adjust_stmt_cost): Ditto.
* config/riscv/riscv.cc (riscv_builtin_vectorization_cost): Adjust vec_construct cost.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vls/reduc-19.c: Adapt test.
* gcc.target/riscv/rvv/autovec/vls/reduc-20.c: Ditto.
* gcc.target/riscv/rvv/autovec/vls/reduc-21.c: Ditto.
* gcc.dg/vect/costmodel/riscv/rvv/pr113247-1.c: New test.
* gcc.dg/vect/costmodel/riscv/rvv/pr113247-2.c: New test.
* gcc.dg/vect/costmodel/riscv/rvv/pr113247-3.c: New test.
* gcc.dg/vect/costmodel/riscv/rvv/pr113247-4.c: New test.
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv-vector-costs.cc
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113247-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113247-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113247-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr113247-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/reduc-19.c
gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/reduc-20.c
gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/reduc-21.c
This page took 0.072719 seconds and 5 git commands to generate.