[PATCH] D131508: [WIP][RISCV] Enable fixed length vectorization

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 10:21:25 PDT 2022


reames added inline comments.


================
Comment at: llvm/test/Transforms/LoopVectorize/RISCV/inloop-reduction.ll:85
 ; INLOOP:       for.body.preheader:
-; INLOOP-NEXT:    [[TMP0:%.*]] = call i32 @llvm.vscale.i32()
-; INLOOP-NEXT:    [[TMP1:%.*]] = mul i32 [[TMP0]], 8
-; INLOOP-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[N]], [[TMP1]]
+; INLOOP-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[N]], 16
 ; INLOOP-NEXT:    br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
----------------
reames wrote:
> TODO: We're deciding that fixed length vectorization is profitable over scalable vectorization when both are legal.  That's odd, and probably indicates a problem in the cost model.  
This turns out to be a known issue in the cost model.  So as to return a conservative correct cost, we're using an upper bound on VL.  This results in scalable vectors (for which maximum VL is potentially quite large) appearing unprofitable.  In this case, the cost is a function of log2(max-vl), but we have other instances - such as scatter/gather - where the cost is linear in max-VL and magnifies this effect even further.

I don't think this is a blocking issue for enabling fixed length vectorization.  


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131508/new/

https://reviews.llvm.org/D131508



More information about the llvm-commits mailing list