[Mlir-commits] [mlir] [mlir][vector] Fold `in_bounds` for transfers with loop-derived indices (PR #215340)
Federico Bruzzone
llvmlistbot at llvm.org
Sun Aug 16 01:27:36 PDT 2026
FedericoBruzzone 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.
Exactly! That was my concern, and I'm pretty sure LLVM can't recover this lost information, but I'm just speculating. When I have time, maybe I'll take a look at the generated code :D
> 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.
That would have been my follow-up question :D
I think that if your plan gets approved, this follow-up PR makes sense to me, and I'd be happy to review it too. Don’t hesitate to ping me :D
https://github.com/llvm/llvm-project/pull/215340
More information about the Mlir-commits
mailing list