Skip to content

Commit

Permalink
Add check-onnx-backend to Mac CI. (llvm#1069)
Browse files Browse the repository at this point in the history
* Add check-onnx-backend to Mac CI.

Signed-off-by: Ettore Tiotto <etiotto@ca.ibm.com>
  • Loading branch information
Ettore Tiotto committed Jan 10, 2022
1 parent 2065ca8 commit 745e5b9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/macos-amd64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ jobs:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.9'
- name: install tools that are needed for compilation
run: brew install ninja protobuf llvm
- name: install pytest-xdist
run: pip3 install pytest-xdist
run: brew install ninja protobuf pybind11
- name: cache MLIR directory
id: cache-mlir
uses: actions/cache@v2
Expand All @@ -30,10 +28,18 @@ jobs:
cd ~/work/onnx-mlir
sh ~/work/onnx-mlir/onnx-mlir/utils/clone-mlir.sh
sh ~/work/onnx-mlir/onnx-mlir/utils/build-mlir.sh
- name: install third_party/onnx
run: |
cd ~/work/onnx-mlir/onnx-mlir
pip3 install -e third_party/onnx
- name: build onnx-mlir
run: |
cd ~/work/onnx-mlir
sh ~/work/onnx-mlir/onnx-mlir/utils/install-onnx-mlir.sh
- name: run onnx-mlir backend tests
run: |
cd ~/work/onnx-mlir
sh ~/work/onnx-mlir/onnx-mlir/utils/check-onnx-backend.sh
- name: run onnx-mlir numerical tests
run: |
cd ~/work/onnx-mlir
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ if (WIN32)
# installed on the machine.
set(Python3_FIND_REGISTRY NEVER)
endif()

find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED COMPONENTS Interpreter Development)

# Don't require AWT to allow headless JDK to reduce docker image size
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ git clone --recursive https://github.com/onnx/onnx-mlir.git
export MLIR_DIR=$(pwd)/llvm-project/build/lib/cmake/mlir

mkdir onnx-mlir/build && cd onnx-mlir/build
cmake -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/c++ ..
if [[ -z "$pythonLocation" ]]; then
cmake -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/c++ ..
else
cmake -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/c++ -DPython3_ROOT_DIR=$pythonLocation ..
fi
cmake --build .

# Run lit tests:
Expand All @@ -163,7 +167,8 @@ cmake --build . --target check-onnx-lit
```

If you are running on OSX Big Sur, you need to add `-DCMAKE_CXX_COMPILER=/usr/bin/c++`
to the `cmake ..` command due to changes in the compilers.
to the `cmake ..` command due to changes in the compilers. The environment variable
`$pythonLocation` may be used to specify the base directory of the Python compiler.
After the above commands succeed, an `onnx-mlir` executable should appear in the `bin` directory.

##### LLVM and ONNX-MLIR CMake variables
Expand Down
3 changes: 3 additions & 0 deletions utils/check-onnx-backend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Run backend tests.
cd onnx-mlir/build
cmake --build . --target check-onnx-backend
6 changes: 5 additions & 1 deletion utils/install-onnx-mlir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
export MLIR_DIR=$(pwd)/llvm-project/build/lib/cmake/mlir

mkdir onnx-mlir/build && cd onnx-mlir/build
cmake -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/c++ ..
if [[ -z "$pythonLocation" ]]; then
cmake -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/c++ ..
else
cmake -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/c++ -DPython3_ROOT_DIR=$pythonLocation ..
fi
cmake --build .

# Run lit tests:
Expand Down

0 comments on commit 745e5b9

Please sign in to comment.