Depend on torch-mlir via CMake
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 736
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 15
Description
Moving discussion from Discord thread by @garymm
Hi I'm trying to write some C++ code that depends on torch-mlir. Does anyone have an example CMake project that depends on the torch-mlir code? If not, any tips as to the general thing I should be trying to do? I have basically no experience with LLVM's build system. So far I've tried this:
transforms/CMakeLists.txt:
add_mlir_library(transforms
passes.cpp
DEPENDS
TorchMLIRConversionPassIncGen
LINK_COMPONENTS
Core
EXCLUDE_FROM_LIBMLIR
)
transforms/passes.cpp:
#include "mlir/Transforms/Passes.h"
#include "mlir/Pass/PassManager.h"
#include "foo/transforms/passes.h"
namespace foo {
void registerConversionPasses() {
mlir::PassPipelineRegistration<
mlir::torch::Torch::TorchLoweringPipelineOptions>(
"torch-backend-to-foo-backend-pipeline",
"Pipeline lowering torch backend contract to foobackend "
"contract.",
createTorchBackendToFooBackendPipeline);
}
void createTorchBackendToFooBackendPipeline(
OpPassManager &pm,
const mlir::torch::Torch::TorchLoweringPipelineOptions &options) {
}
} // namespace foo
The build fails compiling passes.cpp because it can't find the mlir/Transforms/Passes.h to include.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with transforms/CMakeLists.txt and transforms/passes.cpp, then inspect how torch-mlir and MLIR dependencies are exposed to external CMake projects. Done means a C++ example project can depend on torch-mlir and compile the shown include successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system, compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100