-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build light weight PyRuntime without llvm or onnx-mlir #3044
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4ab6256
pass test
chentong319 49034b5
package
chentong319 45b1d9d
clean makefile
chentong319 0ee214f
Merge remote-tracking branch 'upstream/main' into pyruntime-lit
chentong319 beff2e3
document
chentong319 28584dd
fix MLIR.cmake
chentong319 a92ccc2
fix script
chentong319 2037d8d
Merge remote-tracking branch 'upstream/main' into pyruntime-lit
chentong319 8ecd7ff
fix
chentong319 79ab54f
Merge remote-tracking branch 'upstream/main' into pyruntime-lit
chentong319 0bd61d2
Merge remote-tracking branch 'upstream/main' into pyruntime-lit
chentong319 0694678
add comments
chentong319 0d049a5
Merge remote-tracking branch 'upstream/main' into pyruntime-lit
chentong319 8c8a17f
LIGHT
chentong319 8ff28b1
Merge remote-tracking branch 'upstream/main' into pyruntime-lit
chentong319 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# How to build and use PyRuntime lit | ||
|
||
## Purpsoe | ||
|
||
PyRuntime lit is a different way to build the original PyRuntime (src/Runtime/python). | ||
All necessary dependence, such as llvm_project and onnx-mlir compiler is removed. The purpose is to easily build the python driver for the model execution on | ||
different systems. Currently, only the OMTenserUtils (src/Runtime), Python driver (src/Runtime/python), third_party/onnx and third_party/pybind11 are built. | ||
|
||
The build of PyRuntime lit is controlled by a CMake option: ONNX_MLIR_ENABLE_PYRUNTIME_LIT. Without this option to cmake, the whole system remains the same. | ||
|
||
## Functionalities | ||
1. Build the python driver without llvm_project and onnx-mlir compiler built. | ||
2. The python driver can be used with utils/RunONNXModel.py, or onnxmlir python package. | ||
3. With PyRuntime lit, the compiler has not been built locally and docker image of onnx-mlir has to be usd to compile the model. The onnxmlir package contains | ||
the python code to use python docker package to perform the compilation. Alternatively, the old script, onnx-mlir/docker/onnx-mlir.py, can do the fulfill the same task with subprocess and docker CLI. | ||
|
||
## How to use | ||
You can find the script for build and run at "onnx-mlir/utils/build-pyruntime-lit.sh. | ||
``` | ||
#!/bin/bash | ||
|
||
# Assume you are in an empty directory for build in cloned onnx-mlir. | ||
# Usually it is "your_path/onnx-mlir/build" | ||
# then you can run this script as "../util/build-pyruntime-lit.sh" | ||
|
||
cmake .. -DONNX_MLIR_ENABLE_PYRUNTIME_LIT=ON | ||
make | ||
make OMCreatePyRuntimePackage | ||
|
||
# Install the package | ||
pip3 install -e src/Runtime/python/onnxmlir | ||
# -e is necessary for current package. Need to add resource description | ||
# to install the pre-compiled binary | ||
|
||
# Run test case | ||
cd src/Runtime/python/onnxmlir/tests | ||
python3 test_1.py | ||
# Current limitation on where the model is | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a one liner comment on why this function is defined here.