> Yeah...and I also don't like the magic "ceil(AVL / 2) ≤ vl ≤ VLMAX if > AVL < (2 * VLMAX)" rule...
+1, spec has some description about this but I am not sure if I really get the point. From Spec: "For example, this permits an implementation to set vl = ceil(AVL / 2) for VLMAX < AVL < 2*VLMAX in order to evenly distribute work over the last two iterations of a stripmine loop. Requirement 2 ensures that the rst stripmine iteration of reduction loops uses the largest vector length of all iterations, even in the case of AVL < 2*VLMAX. This allows software to avoid needing to explicitly calculate a running maximum of vector lengths observed during a stripmined loop. Requirement 2 also allows an implementation to set vl to VLMAX for VLMAX < AVL < 2*VLMAX" Pan -----Original Message----- From: Kito Cheng <kito.ch...@gmail.com> Sent: Tuesday, April 1, 2025 9:53 AM To: Robin Dapp <rdapp....@gmail.com> Cc: Kito Cheng <kito.ch...@sifive.com>; gcc-patches@gcc.gnu.org; pal...@dabbelt.com; jeffreya...@gmail.com; rd...@ventanamicro.com; juzhe.zh...@rivai.ai; Li, Pan2 <pan2...@intel.com>; vine...@rivosinc.com; patr...@rivosinc.com; monk.chi...@sifive.com Subject: Re: [PATCH v3] RISC-V: Fix wrong LMUL when only implict zve32f. Hi Robin: Pushed to trunk, thanks, On Mon, Mar 31, 2025 at 11:23 PM Robin Dapp <rdapp....@gmail.com> wrote: > > LGTM (even though I still don't like the spec :D). Yeah...and I also don't like the magic "ceil(AVL / 2) ≤ vl ≤ VLMAX if AVL < (2 * VLMAX)" rule... > We still have an implicit assumption in riscv-vsetvl.cc that might modify > LMUL: Thanks for reminding me, will take a look to see if that will cause problems :) > > In prev_ratio_valid_for_next_sew_p and next_ratio_valid_for_prev_sew_p we > check > whether the ratio of two LMULs is <= 8. ISTR that with recent changes we only > re-use an existing ratio and don't compute a new one but it might be worth a > second look. A while ago we certainly did change LMUL even to values that > weren't initially enabled. > > -- > Regards > Robin >