[Mlir-commits] [mlir] [mlir][EmitC] Refactor MLIR Translate To Cpp (PR #84973)

Weizhe Chen llvmlistbot at llvm.org
Wed Mar 20 08:53:22 PDT 2024


weizchen wrote:

> Couldn't you have something like this:
> 
> ```c++
> std::string typeName = std::string("TQue<QuePosition::") + std::to_string(tque.getTposition()) + ", " + std::to_string(tque.getBufNum()) + ">";
> Type t = emitc::OpaqueType::get(ctx, typeName);
> ```
> 
> That's not much different to printing the parts to the output stream.

Ah you are right, thank you for your answer! Another thing I found is the member functions. 

Suppose TQue has some member functions that we want to call. For example, in mlir, we have 
`%tensor1 = ascendc.alloc_tensor(%inQueueX) : !ascendc.TQue<VECIN, 2> -> !ascendc.LocalTensor<16xf16>` 
which will be translated to 
`LocalTensor<half> localTensor24 = inQueue16.AllocTensor<half>();`
Do we have some good representation for this `.` or `->` for the member function? Thanks in advance!

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


More information about the Mlir-commits mailing list