This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv][complex] Support convert complex.constant
ClosedPublic

Authored by antiagainst on May 27 2023, 6:12 PM.

Diff Detail

Event Timeline

antiagainst created this revision.May 27 2023, 6:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 27 2023, 6:12 PM
antiagainst requested review of this revision.May 27 2023, 6:12 PM
kuhar added inline comments.May 29 2023, 7:28 AM
mlir/lib/Conversion/ComplexToSPIRV/ComplexToSPIRV.cpp
37–38

If we expect this to be a shaped type later on, we can do convertType<ShapedType>(constOp.getType());

mlir/test/Conversion/ComplexToSPIRV/complex-to-spirv.mlir
44

Should we also have test for vector of complex?

antiagainst marked 2 inline comments as done.

Address comments

mlir/lib/Conversion/ComplexToSPIRV/ComplexToSPIRV.cpp
37–38

Ah, interesting. Didn't notice this overwrite!

mlir/test/Conversion/ComplexToSPIRV/complex-to-spirv.mlir
44

complext.constant does not support creating vectors. https://mlir.llvm.org/docs/Dialects/ComplexOps/#complexconstant-mlircomplexconstantop. You mean using arith.constant or something? Also right now we don't support vector of complex type yet---see callers of https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp#L338.

kuhar accepted this revision.May 29 2023, 1:18 PM

LGTM

mlir/test/Conversion/ComplexToSPIRV/complex-to-spirv.mlir
44

ah, TIL

This revision is now accepted and ready to land.May 29 2023, 1:18 PM