Repository navigation
Conversation
…`Ubuntu 24.04, LLVM 20` CI job
|
Hello @kinke, @thewilsonator, the |
|
Hello @kinke @thewilsonator, just a gentle ping on this when you have a moment. Thanks! |
That's absolutely fine; I was expecting this problem earlier, but looks like we had to actually drag in a bit more MLIR stuff to show up. What I'm lacking is a rationale for this feature - do we expect this to be necessary for users, to implement certain stuff that they couldn't otherwise? The size of the FreeBSD artifact grows significantly - used to 18.9 MB IIRC, then 19.3 MB after your first PR, and now it's 25.5 MB. I haven't checked the |
| return {str.ptr, str.length}; | ||
| } | ||
| } // anonymous namespace | ||
| #endif // LDC_MLIR_ENABLED |
There was a problem hiding this comment.
Okay, AFAICT, these are 1:1 copies of the helpers in gen/inlineir.cpp. The DtoCheck…Pragma() and DtoInlineMLIR() look quite similar to the normal-LLVM-IR functions, so there's probably room to refactor this (probably after moving this to the existing .cpp modue), avoiding all duplication.
There was a problem hiding this comment.
Yes, they are from gen/inlineir.cpp. I'll refactor it.
There was a problem hiding this comment.
I have refactored it and moved llvm ir/mlir parsing logic into the same file gen/inlineir.cpp. Please let me know if I should make more adjustments.
On its own, inlineMLIR is a small feature, but it's the first user-visible step of my SAOC project (mentored by Nicholas, plan here). The goal is an MLIR code generation path for the BetterC subset of D to start with, and after that lowering DCompute kernels through MLIR's GPU and transformation infrastructure. I intend to keep working on it after SAOC program. The pragma was the smallest thing that used the whole chain end to end, and I've started on the next milestone, an MLIR-emitting AST visitor. For the size, I think I know the cause: I used |
|
Hello @kinke @thewilsonator , just a gentle ping on this when you have a chance. Thanks! |
This is the follow-up to #5300. It adds
LDC_inline_mlir, a pragma similar toLDC_inline_ir, which lets us write a function body in MLIR in D code. It's used through the new__mlir!template inldc.llvmasm:How it works:
func.funcwith the D parameter and return types translated to MLIR types. Forvoidfunctions it adds thereturnitself.scf → cf,arith,cfandfunc → llvm), translated to LLVM IR and linked into the current module.alwaysinline, gets the function attributes of the calling function (likeLDC_inline_irdoes), and is called with the runtime arguments.Supported dialects for now:
func,arith,cf,scfandllvm.In a build without MLIR support, using
__mlir!errors with message"Inline MLIR is not supported by this LDC build".This replaces my earlier draft #5295, which I rebased onto master after #5300 was merged and cleaned up.