Skip to content

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

@christopherbate

Description

@christopherbate

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions