This is an archive of the discontinued LLVM Phabricator instance.

Add C bindings for mlir::ExecutionEngine
ClosedPublic

Authored by mehdi_amini on Feb 13 2021, 11:30 AM.

Details

Summary

This adds minimalistic bindings for the execution engine, allowing to
invoke the JIT from the C API. This is still quite early and
experimental and shouldn't be considered stable in any way.

Diff Detail

Unit TestsFailed

Event Timeline

mehdi_amini created this revision.Feb 13 2021, 11:30 AM
mehdi_amini requested review of this revision.Feb 13 2021, 11:30 AM

Remove unusued type

stellaraccident accepted this revision.Feb 13 2021, 4:31 PM
stellaraccident added inline comments.
mlir/lib/CAPI/ExecutionEngine/ExecutionEngine.cpp
22

I feel like you are going to run into trouble eventually by making the LLVM initialization implicit (as soon as being used in a context that also initializes LLVM differently). In things I've written, I've eventually had to lift all such default initialization sequences to custom functions that the top level can choose to use or not.

This revision is now accepted and ready to land.Feb 13 2021, 4:31 PM
mehdi_amini added inline comments.Feb 13 2021, 7:33 PM
mlir/lib/CAPI/ExecutionEngine/ExecutionEngine.cpp
22

Yeah this is tricky and I'm not fond of these init in general...

In this case is there an issue to initializing the native target? I expect that you can call multiple times the initialization and LLVM will just ignore future calls. But I may miss some adversary effect that you have in mind with a client that would "initializes LLVM differently"?

mlir/lib/CAPI/ExecutionEngine/ExecutionEngine.cpp
22

Honestly, I can't remember in this case - just memories of issues. Let's just stick with this for the moment to get started?

ftynse accepted this revision.Feb 15 2021, 1:19 AM

Fix memory leak and add missing implementation for mlirExecutionEngineDestroy()

This revision was landed with ongoing or failed builds.Mar 3 2021, 10:19 AM
This revision was automatically updated to reflect the committed changes.