[Mlir-commits] [mlir] [mlir][vector] Fold `in_bounds` for transfers with loop-derived indices (PR #215340)

Dhairyashil R G llvmlistbot at llvm.org
Sun Aug 16 01:01:59 PDT 2026


dhairyashilRG wrote:

@FedericoBruzzone Yes, that's my expectation too, with the caveat that I haven't measured it. With vscale pinned, the backend gets constant trip counts and fixed-width addressing instead of `cntw`-based induction, so VLS should beat plain VLA independently of this patch.

It doesn't recover the fold, though. In MLIR, `vscale_range` exists only as an attribute on `llvm.func` (it can ride on `func.func` as `llvm.vscale_range`, consumed at `convert-func-to-llvm`); nothing in the vector dialect reads it, so `isInBounds` still bails on scalable dims and the mask is still emitted.

A pass could change that: `vector::eliminateVectorMasks` already accepts a `VscaleRange{min, max}` via pass options, and `ScalableValueBoundsConstraintSet::computeScalableBound` takes vscale bounds. So the restructure @matthias-springer suggested would also make bounded-vscale folding of scalable dims possible as a follow-up, compare against `vectorSize * vscaleMax` instead of bailing.

https://github.com/llvm/llvm-project/pull/215340


More information about the Mlir-commits mailing list