[Mlir-commits] [mlir] [mlir][emitc] Restrict types in EmitC (PR #88391)

Jeff Fifield llvmlistbot at llvm.org
Thu May 2 07:15:47 PDT 2024


fifield wrote:

> I aligned the restriction to the capabilities of the [Emitter](https://github.com/llvm/llvm-project/blob/15027be6a5c5cf870f25af8de05d6d06c767238f/mlir/lib/Target/Cpp/TranslateToCpp.cpp#L1537), such that one could only build EmitC code which the emitter can handle (to be able to find errors upon construction already). As far as I can see, the emitter doesn't support `VectorType` and `bf16`; do you have downstream changes for these types?

mlir-aie does not use the Emitter directly, but it does have a [similar pass](https://github.com/Xilinx/mlir-aie/blob/main/lib/Targets/AIEVecToCpp/TranslateAIEVecToCpp.cpp) supporting vector and bf16 types, and that pass reuses ops from emitc dialect. Because those ops are mixed with "unsupported" types, the emitc verifier fails.

To me it seems like the legality check for the Emitter should be in the Emitter, not in the dialect. Then the input to the Emitter can be generated by a multi-stage lowering, where the intermediate IR(s) might contain things not supported by the Emitter, but those things will be legalized away by subsequent transformations.


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


More information about the Mlir-commits mailing list