torch-mlir icon indicating copy to clipboard operation
torch-mlir copied to clipboard

[cmake] Torch-MLIR doesn't build with CMake setting 'BUILD_SHARED_LIBS=ON'

Open christopherbate opened this issue 11 months ago • 0 comments

MLIR/LLVM supports building with CMake setting -DBUILD_SHARED_LIBS=ON. This can be helpful during development for various reasons. However, building with this setting is much less forgiving of missing link dependencies in the library declarations or of circular dependencies.

In the library TorchMLIRTorchUtils, for example, there are no link dependencies listed. The organization of the libraries TorchMLIRTorchUtils and TorchMLIRTorchDialect is also circular. Each depends on the other, which makes the build a bit brittle for downstream users. This is clear from looking at the Bazel build as well: all the headers in include/torch-mlir/Dialect/Torch/IR are referenced as includes by both libraries. I propose to move the functions that TorchMLIRTorchDialect actually depends on into the TorchMLIRTorchDialect directly, removing the circular dependency (and also fixing any other issues which block use of -DBUILD_SHARED_LIBS=ON).

christopherbate avatar Jan 15 '25 17:01 christopherbate