2021-09-24 10:30:35 +08:00
|
|
|
# torch-mlir-lsp-server is always linked dynamically as we want to distribute the
|
2021-08-04 07:47:38 +08:00
|
|
|
# binaries with the python packages for hacking/debugging.
|
2022-01-21 00:20:54 +08:00
|
|
|
add_llvm_executable(torch-mlir-lsp-server torch-mlir-lsp-server.cpp)
|
|
|
|
|
|
|
|
install(TARGETS torch-mlir-lsp-server
|
|
|
|
EXPORT TorchMLIRTargets
|
|
|
|
RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
|
|
|
|
COMPONENT torch-mlir-lsp-server)
|
2021-08-04 07:47:38 +08:00
|
|
|
|
2023-11-03 10:45:55 +08:00
|
|
|
# get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
|
|
|
|
# get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
|
|
|
|
# get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
|
2021-08-04 07:47:38 +08:00
|
|
|
|
2021-09-24 10:30:35 +08:00
|
|
|
target_link_libraries(torch-mlir-lsp-server PRIVATE
|
2021-08-04 07:47:38 +08:00
|
|
|
MLIRLspServerLib
|
[torch-mlir earthmoving (1/N)] C/C++ code movement.
This creates the `external/torch-mlir` directory as an
LLVM_EXTERNAL_PROJECTS-compatible project (analogous to
`iree-dialects`) and completes movement/rename of all pure MLIR C/C++
compiler code into there. The next step will be to move all the Python
code / code that links/includes PyTorch C++ code (which currently lives
in `frontends/pytorch`) into a subdirectory here.
I call this "earthmoving" because it is mostly mechanical changes and
renames. As a quick summary (we can change this down the road easily)
- C++ `mlir::NPCOMP::Torch -> mlir::torch::Torch`
- CAPI `npcompTorchListTypeGet -> torchMlirTorchListTypeGet`
- preprocessor `#ifndef NPCOMP_ -> #ifndef TORCHMLIR_`
- CMake `NPCOMPFoo -> TorchMLIRFoo`
The goal of this is to create a standalone project creating a center of
mass for entry into the MLIR ecosystem from PyTorch, suitable in scope
for eventual inclusion/ownership in PyTorch. The idea is that
`external/torch-mlir` will some day be pulled out into its own
repository, and then npcomp will simply pull it in as a submodule.
Layering-wise, what lives in `torch-mlir` lowers code from PyTorch
(currently TorchScript, but TorchFX or pytorch/xla-style tracing are
possible extensions) down to what we have been calling the "Torch
backend contract" which is cleaned up IR (inlining, simplifcation,
conversion to value tensors, ...) entirely in the `torch` dialect. This
is the branching off point for further lowering, of which npcomp takes
one opinion (outside `torch-mlir` of course!), namely the
`TorchConversion` dialect/transforms which lower to IR suitable for IREE
and other linalg-on-tensors based lower-level compilers.
Summary of changes:
- move `{include,lib,test}/Dialect/Torch` into `torch-mlir`
- move relevant parts of CAPI into `torch-mlir`.
- leave a few things related to the `torch-mlir` Python build commented
out, which should be resolved in a subsequent change.
2021-09-10 03:24:10 +08:00
|
|
|
TorchMLIRInitAll
|
2021-08-04 07:47:38 +08:00
|
|
|
|
2023-11-03 10:45:55 +08:00
|
|
|
# # TODO: Remove these in favor of interface deps.
|
|
|
|
# ${dialect_libs}
|
|
|
|
# ${conversion_libs}
|
|
|
|
# ${extension_libs}
|
2021-08-04 07:47:38 +08:00
|
|
|
)
|
|
|
|
|
2021-09-24 10:30:35 +08:00
|
|
|
mlir_check_all_link_libraries(torch-mlir-lsp-server)
|