Lowering through libm gives us a baseline version, even though it's not
going to be particularly fast. This is similar to what we do for some
math dialect ops.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I think there's an ABI issue here, MLIR complex numbers are always lowered to an LLVM struct of 2 elements, but that isn't necessarily the correct platform ABI for passing complex numbers/C structs (C complex numbers and C structs have the same ABI).
I see an issue with complex<f32> on x86_64: cpow expects both arguments to be passed in %xmm0 (i,e, [2 x float] at the LLVM level) but here they are passed in %xmm0 and %xmm1 ({float, float} at the LLVM level)
I'm not sure what the fix is here. Does MLIR have target awareness that we can switch on to lower to the correct thing when the ABI is different?
I was afraid this would happen. As far as I know MLIR doesn't have a way of using the correct ABI. The only place that has this information in LLVM is in Clang.
We probably just have to add non-libm expansions for all the ops.
I was afraid this would happen. As far as I know MLIR doesn't have a way of using the correct ABI. The only place that has this information in LLVM is in Clang.
We probably just have to add non-libm expansions for all the ops.
I posted about this on discourse too, maybe we could start a discussion there? https://discourse.llvm.org/t/complex-to-libm-conversion-abi-issues/65131
Thanks!