[Mlir-commits] [mlir] [mlir][math] Fix intrinsic conversions to LLVM for 0D-vector types (PR #141020)
Andrzej Warzyński
llvmlistbot at llvm.org
Thu May 22 09:51:45 PDT 2025
https://github.com/banach-space commented:
Hi Artem - thanks for sending this!
Rank-0 vectors are tricky. Support across MLIR is still somewhat patchy, and our recent discussion on their role in the broader ecosystem was inconclusive:
* https://discourse.llvm.org/t/rfc-should-we-restrict-the-usage-of-0-d-vectors-in-the-vector-dialect
I’m bringing this up because I don’t see existing examples of rank-0 vectors in `math-to-llvm.mlir`, which suggests this may not have been explored yet in the context of `MathToLLVM`.
A couple of high-level questions:
* In practice, is there anything that will eliminate the `builtin.unrealized_conversion_cast` being inserted here? If not, could we instead lower the rank-0 vector to a scalar earlier in the pipeline?
* Why the focus on `absi`, `ctlz`, and `cttz` specifically? I’d expect this to apply to most (if not all) math ops that accept vector inputs.
In principle, I’m not opposed to this change - MLIR does support rank-0 vectors - but I want to make sure we consider this holistically. Ideally, we’d ensure that this integrates cleanly with the rest of the stack and doesn’t introduce hard-to-track edge cases later.
https://github.com/llvm/llvm-project/pull/141020
More information about the Mlir-commits
mailing list