[Mlir-commits] [mlir] [mli][vector] canonicalize vector.from_elements from ascending extracts (PR #139819)

Andrzej Warzyński llvmlistbot at llvm.org
Fri May 16 09:52:22 PDT 2025


banach-space wrote:

> I share this concern. Specifically, if the lowering of `vector.shape_cast` were to create a `vector.from_elements`, then canonicalization would un-lower `shape_cast`. It currently doesn't lower like this, but it doesn't seem unreasonable. 

Thanks for sharing your points - I agree with pretty much everything you've said.

>  Perhaps shape_cast should be treated as the bottom rung on the lowering ladder, an op which gets converted directly to llvm/other (in the case where not all shape_casts have cancelled).

Personally, I think we should aim for a design where `vector.shape_cast` is effectively a no-op. In that model, lowering it to LLVM would be considered an error. We're not quite there yet, and in the meantime, we need to continue supporting all current users who may rely on the existing behaviour. So I'm not suggesting any drastic changes just yet. :)

That said, I fully acknowledge that we might ultimately discover that "shape_cast as a no-op" isn't viable - and that would be a completely acceptable outcome. But with your recent patches, we're already converging in that direction, so I’m optimistic.

@dcaballe, any thoughts?

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


More information about the Mlir-commits mailing list