[Mlir-commits] [mlir] [mlir][python] C++ API demo (PR #71133)

Stella Laurenzo llvmlistbot at llvm.org
Mon Nov 6 06:13:59 PST 2023


================
@@ -607,11 +607,13 @@ if(MLIR_INCLUDE_TESTS)
     ROOT_DIR "${MLIR_SOURCE_DIR}/test/python/lib"
     SOURCES
       PythonTestModule.cpp
+      PythonTestPass.cpp
----------------
stellaraccident wrote:

This pulls in mlir c++ libs (built-in and pass) but it's not depending on them here. It appears they just happen to be resolved via MLIRCAPIPythonTestDialect.

I don't think this is going to work, and there is not an easy fix. This is relying in the capi lib incidentally exporting symbols for its backing c++ API. That is dependent on how the project is built: it happens to be true in this dev tree but will not work with hidden visibility, like real packages use. The other option you may be tempted to do is add the things you need to PRIVATE_LINK_LIBS, but that is also fraught. Not only will it duplicate the backing library code in the extension, TypeID linkage will no longer be single, strongly rooted. This will create the dreaded vague linkage issues on Linux and has no path to work on Windows.

I don't have a good suggestion: this is why we did not get adventurous on some of this stuff.

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


More information about the Mlir-commits mailing list