On 9/9/26 2:01 PM, Robin Dapp wrote:
Hi,

This patch makes -mrvv-max-lmul=conv-dynamic spill aware.
As reported by Anton, Peter in PR127075, we don't consider spilling when
letting the LMUL decision just be dependent on the size ratio of largest
and smallest type.  This causes spills when building x264 with the
conv-dynamic mode.

Although the original idea was to have a more deterministic approach
than pure "dynamic", determinism alone is not too helpful when spills
are still possible.

Thus, this patch merges the spill estimate of "dynamic" into
"conv-dynamic" and also corrects some mistakes in "dynamic".
It had VLS assumptions that haven't been true for a while, i.e. that we
cannot use length masking when niters is unknown.

There is a bit of overlap with Bohan's patch from this morning.  I guess
I'll wait for it and rebase once it's in.  I also have two follow-ups in
flight that fix a few issues in "dynamic", refactor more of the code and
improve performance slightly.

Regtested on rv64gcv_zvl512b.

Regards
  Robin

        PR target/127075

gcc/ChangeLog:

        * config/riscv/riscv-vector-costs.cc (compute_estimated_lmul):
        Fix VLS LMUL computation.
        (costs::compute_live_ranges_and_lmul): Store conv-dynamic lmul.
        (costs::has_unexpected_spills_p): Rename...
        (costs::has_spills_p): ...To This.
        (costs::record_lmul_spills): Call renamed function.
        (costs::record_potential_unexpected_spills): Rename...
        (costs::record_potential_spills): ...To This.
        (costs::better_main_loop_than_p): Reject spilling conv-dynamic
        loops.
        * config/riscv/riscv-vector-costs.h: Rename functions.

gcc/testsuite/ChangeLog:

        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-1.c: Adjust test
        expectations.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-2.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-4.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-5.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-7.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-2.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-1.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-12.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-2.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-5.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-7.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-1.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-10.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-11.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-13.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-14.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-15.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-2.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-3.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-4.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-5.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-6.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-7.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-8.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/pr127075.c: New test.
---
Looks quite sensible to me.  Stage in whenever it works for you and Bohan.

jeff

Reply via email to