[Mlir-commits] [mlir] [mlir] Re-land Loosen restrictions on folding dynamic reshapes (PR #142827)

Artem Gindinson llvmlistbot at llvm.org
Fri Jun 13 09:33:11 PDT 2025


AGindinson wrote:

Hi @GleasonK, thanks for the code pointers!

I believe in my original change I'd _accidentally_ made the map emit "collapse full dimensions into none" for scalars, and then we kind of stuck with it because it made sense at the time. The way we've had it before with an empty map feels even less correct semantically, however it does allow to distinguish between the scenarios.

Either way, this decision should be driven by the IR representation, and we're clearly failing the validation with the current approach. What do `expand_shape` / `collapse_shape` look like when they happen between tensor & scalar? And what _should_ they look like? @IanWood1, could you please chime in?

I can make a quick PR to adjust the early exit logic for scalars back to what it was before. Otherwise, on the SHLO end the scalars would have to be handled separately.

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


More information about the Mlir-commits mailing list