summaryrefslogtreecommitdiff
path: root/mlir/lib/CAPI/ExecutionEngine/ExecutionEngine.cpp
AgeCommit message (Collapse)Author
2025-02-15[MLIR] Fix mlirExecutionEngineLookup throwing assert on lookup fail (#123924)Edgar
Apparently trying to lookup a function pointer using the C api `mlirExecutionEngineLookup` will throw an assert instead of just returning a nullptr on builds with asserts. The docs itself says it returns a nullptr when no function is found so it should be sensible to not throw an assert in this case.
2023-09-14[NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes ↵Arthur Eubanks
(#66295) This will make it easy for callers to see issues with and fix up calls to createTargetMachine after a future change to the params of TargetMachine. This matches other nearby enums. For downstream users, this should be a fairly straightforward replacement, e.g. s/CodeGenOpt::Aggressive/CodeGenOptLevel::Aggressive or s/CGFT_/CodeGenFileType::
2023-06-05Activate OpenMP translation in MLIR execution engine CAPI.Rafael Ubal Tena
We've observed that the MLIR Jit Engine fails when the `omp` dialect is used due to a failure to register OpenMP-related translations. This small patch addresses this issue. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D151577
2023-03-27[mlir] Update JitRunner, ExecutionEngine after LLVM commit 8b1771bd9f3.Lang Hames
LLVM commit 8b1771bd9f3 replaced JITEvaluatedSymbol with ExecutorSymbolDef.
2023-03-21[mlir] Support lowering of dialect attributes attached to top-level modulesSergio Afonso
This patch supports the processing of dialect attributes attached to top-level module-type operations during MLIR-to-LLVMIR lowering. This approach modifies the `mlir::translateModuleToLLVMIR()` function to call `ModuleTranslation::convertOperation()` on the top-level operation, after its body has been lowered. This, in turn, will get the `LLVMTranslationDialectInterface` object associated to that operation's dialect before trying to use it for lowering prior to processing dialect attributes attached to the operation. Since there are no `LLVMTranslationDialectInterface`s for the builtin and GPU dialects, which define their own module-type operations, this patch also adds and registers them. The requirement for always calling `mlir::registerBuiltinDialectTranslation()` before any translation of MLIR to LLVM IR where builtin module operations are present is introduced. The purpose of these new translation interfaces is to succeed when processing module-type operations, allowing the lowering process to continue and to prevent the introduction of failures related to not finding such interfaces. Differential Revision: https://reviews.llvm.org/D145932
2022-10-20[mlir] Fix and test python bindings for dump_to_object_fileDenys Shabalin
Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D136334
2022-04-11Reland [mlir] Remove uses of LLVM's legacy pass managerArthur Eubanks
Use the new pass manager. This also removes the ability to run arbitrary sets of passes. Not sure if this functionality is used, but it doesn't seem to be tested. No need to initialize passes outside of constructing the PassBuilder with the new pass manager. Reland: Fixed custom calls to `-lower-matrix-intrinsics` in integration tests by replacing them with `-O0 -enable-matrix`. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D123425
2022-04-11Revert "[mlir] Remove uses of LLVM's legacy pass manager"Arthur Eubanks
This reverts commit b0f7f6f78d050cc89b31c87fb48744989145af60. Causes test failures: https://lab.llvm.org/buildbot#builders/61/builds/24879
2022-04-11[mlir] Remove uses of LLVM's legacy pass managerArthur Eubanks
Use the new pass manager. This also removes the ability to run arbitrary sets of passes. Not sure if this functionality is used, but it doesn't seem to be tested. No need to initialize passes outside of constructing the PassBuilder with the new pass manager. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D123425
2022-02-23[mlir][NFC] Use options struct in ExecutionEngine::createEmilio Cota
Its number of optional parameters has grown too large, which makes adding new optional parameters quite a chore. Fix this by using an options struct. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D120380
2021-11-22Rename MlirExecutionEngine lookup to lookupPackedTres Popp
The purpose of the change is to make clear whether the user is retrieving the original function or the wrapper function, in line with the invoke commands. This new functionality is useful for users that already have defined their own packed interface, so they do not want the extra layer of indirection, or for users wanting to the look at the resulting primary function rather than the wrapper function. All locations, except the python bindings now have a `lookupPacked` method that matches the original `lookup` functionality. `lookup` still exists, but with new semantics. - `lookup` returns the function with a given name. If `bool f(int,int)` is compiled, `lookup` will return a reference to `bool(*f)(int,int)`. - `lookupPacked` returns the packed wrapper of the function with the given name. If `bool f(int,int)` is compiled, `lookupPacked` will return `void(*mlir_f)(void**)`. Differential Revision: https://reviews.llvm.org/D114352
2021-11-22[mlir] Add InitializeNativeTargetAsmParser to ExecutionEngine.Nicolas Vasilache
This is required to allow python to work with lowerings that use inline_asm. Differential Revision: https://reviews.llvm.org/D114338
2021-06-12[MLIR] Execution engine python binding support for shared librariesUday Bondhugula
Add support to Python bindings for the MLIR execution engine to load a specified list of shared libraries - for eg. to use MLIR runtime utility libraries. Differential Revision: https://reviews.llvm.org/D104009
2021-05-16[MLIR][PYTHON] Provide opt level for ExecutionEngine Python bindingUday Bondhugula
Provide an option to specify optimization level when creating an ExecutionEngine via the MLIR JIT Python binding. Not only is the specified optimization level used for code generation, but all LLVM optimization passes at the optimization level are also run prior to machine code generation (akin to the mlir-cpu-runner tool). Default opt level continues to remain at level two (-O2). Contributions in part from Prashant Kumar <prashantk@polymagelabs.com> as well. Differential Revision: https://reviews.llvm.org/D102551
2021-04-19[mlir][python] ExecutionEngine can dump to object fileNicolas Vasilache
Differential Revision: https://reviews.llvm.org/D100786
2021-03-30Add a "register_runtime" method to the mlir.execution_engine and show ↵Mehdi Amini
calling back from MLIR into Python This exposes the ability to register Python functions with the JIT and exposes them to the MLIR jitted code. The provided test case illustrates the mechanism. Differential Revision: https://reviews.llvm.org/D99562
2021-03-04[mlir] make implementations of translation to LLVM IR interfaces privateAlex Zinenko
There is no need for the interface implementations to be exposed, opaque registration functions are sufficient for all users, similarly to passes. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D97852
2021-03-03Add basic JIT Python BindingsMehdi Amini
This offers the ability to create a JIT and invoke a function by passing ctypes pointers to the argument and the result. Differential Revision: https://reviews.llvm.org/D97523
2021-03-03Add C bindings for mlir::ExecutionEngineMehdi Amini
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. Differential Revision: https://reviews.llvm.org/D96651