This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add InitializeNativeTargetAsmParser to ExecutionEngine.
ClosedPublic

Authored by nicolasvasilache on Nov 21 2021, 9:33 AM.

Details

Summary

This is required to allow python to work with lowerings that use inline_asm.

Diff Detail

Event Timeline

nicolasvasilache requested review of this revision.Nov 21 2021, 9:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2021, 9:33 AM
mlir/lib/CAPI/ExecutionEngine/CMakeLists.txt
6 ↗(On Diff #388761)

Hmm not too sure how to set this up properly in OSS, @ftynse do you have a suggestion?

mehdi_amini added inline comments.Nov 21 2021, 11:01 AM
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
4994

You didn't add an include, is this needed? Is this failing with a linker error without this?

utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
4994

Yes, this would fail with a linker error without this change.
Do you have a suggestion for the CMakeLists update?

ftynse requested changes to this revision.Nov 22 2021, 1:09 AM
ftynse added inline comments.
mlir/lib/CAPI/ExecutionEngine/CMakeLists.txt
6 ↗(On Diff #388761)

Something like ${LLVM_NATIVE_ARCH}AsmParser would be more restricted.

Also, I'm pretty sure you want to add the dependency in MLIRExecutionEngine, not in its C API.

This revision now requires changes to proceed.Nov 22 2021, 1:09 AM
nicolasvasilache retitled this revision from [mlir][CAPI] Add InitializeNativeTargetAsmParser to ExecutionEngine. to [mlir] Add InitializeNativeTargetAsmParser to ExecutionEngine..Nov 22 2021, 3:26 AM
ftynse accepted this revision.Nov 22 2021, 3:27 AM
This revision is now accepted and ready to land.Nov 22 2021, 3:27 AM
This revision was landed with ongoing or failed builds.Nov 22 2021, 3:29 AM
This revision was automatically updated to reflect the committed changes.
mehdi_amini added inline comments.Nov 22 2021, 10:55 AM
mlir/lib/CAPI/ExecutionEngine/CMakeLists.txt
6 ↗(On Diff #388761)

Also, I'm pretty sure you want to add the dependency in MLIRExecutionEngine, not in its C API.

Why?

The call is added to the C API only, not to the C++ library.

mehdi_amini added inline comments.Nov 23 2021, 4:42 PM
mlir/lib/CAPI/ExecutionEngine/CMakeLists.txt
6 ↗(On Diff #388761)

Ping?

My team is working on MLIR-based projects which don't target the native (host) architecture, and there's some consternation about the increased build times arising from the added dependency on ${LLVM_NATIVE_ARCH}AsmParser in MLIRExecutionEngine (note that we don't use the execution engine either). Is this dependency on the native target unavoidable, or something that could be selectively disabled? Alternatively, could the MLIRExecutionEngine project be made optional in some way? Many thanks in advance!

ftynse added inline comments.Dec 14 2021, 12:13 AM
mlir/lib/CAPI/ExecutionEngine/CMakeLists.txt
6 ↗(On Diff #388761)

Hm, I missed the fact that it was added to the C API. This only makes it stranger: I would expect the functionality that requires a library dependency to be implemented in C++, not in the C API glue.