Build light weight PyRuntime without llvm or onnx-mlir #3044
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Python driver is needed to run the compiled model. Currently, the driver is built with onnx-mlir and can only be run in the env where onnx-mlir is built, typically inside the onnx-mlir docker image. When the compilation can be done by calling the onnx-mlir docker image, we'd like to run the compiled .so with python driver in the local env, so that all the packages installed in the local env can be used, rather than installing them on top of docker.
In order to reach this goal, the PR tried to remove the unnecessary dependencies of pyruntime if the light-weight pyruntime is the target, how onnx-mlir is built and used remains as it was previously.
Details can be found in docs/build-pyruntime-lit.md.
I tried the build on a z16 machine: it takes less than 2 minutes.
Components in this PR
ONNX_MLIR_ENABLE_PYRUNTIME_LIT
is used to control Cmake, and consequently a compile definitionENABLE_PYRUNTIME_LIT
issued to control the source code.Test
Run successfully with utils/BuildPyRuntimeLit.sh.
Future works: