[Mlir-commits] [mlir] [mlir][EmitC] Refactor MLIR Translate To Cpp (PR #84973)
Marius Brehler
llvmlistbot at llvm.org
Thu Mar 21 02:37:44 PDT 2024
marbre wrote:
> Suppose TQue has some member functions that we want to call. For example, in mlir, we have `%tensor1 = ascendc.alloc_tensor(%QueueX) : !ascendc.TQue<VECIN, 2> -> !ascendc.LocalTensor<16xf16>` which will be translated to `LocalTensor<half> tensor1 = que1.AllocTensor<half>();` Do we have some good representation for this `.` or `->` for the member function? Thanks in advance!
Unfortunately, there is no convenient way to express a member access operator. While this could be added to the dialect, we hesitated to do so, as this is closely related to an lvalue/rvalue discussion we're currently facing (@simon-camp will post an update to this later on discourse). Alongside we would need to add function pointers (related to `func.constant`) and an operation resembling `func.call_indirect`. While adding these two to the dialect is straight forward, it requires some additional work in the emitter.
TL;DR, right know there is no convenient way, but you could use `emtic.verbatim` to emit a macro (if you want to define it via MLIR and don't want to provide a hand-written header file) and together with using `emitc.call_opaque`.
https://github.com/llvm/llvm-project/pull/84973
More information about the Mlir-commits
mailing list