-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add ci * fix yml * add +x * fix script * don't use llvm prebuild for torch frontend * update llvm * clear workspace before and after * use prebuilt' * add yml change
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: TorchFrontend CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "frontends/torch-frontend/**" | ||
- "scripts/frontends/torch-frontend/**" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "frontends/torch-frontend/**" | ||
- "scripts/frontends/torch-frontend/**" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
torch_frontend_build_and_test: | ||
name: torch-frontend CI | ||
runs-on: self-hosted | ||
steps: | ||
- name: clear workspace | ||
run: rm -rf $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE | ||
- name: Checkout byteir repo | ||
uses: actions/checkout@v3 | ||
- name: Build and test TorchFrontend | ||
run: ./scripts/frontends/torch-frontend/build_and_test.sh ${{ secrets.TORCH_FRONTEND_LLVM_INSTALL_DIR }} | ||
shell: bash |
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,34 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
# path to script | ||
CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
# path to byteir root | ||
ROOT_PROJ_DIR="$CUR_DIR/../../.." | ||
# path to byteir/frontends/torch-frontend | ||
PROJ_DIR="$ROOT_PROJ_DIR/frontends/torch-frontend" | ||
|
||
source $CUR_DIR/envsetup.sh | ||
prepare_for_build | ||
|
||
LLVM_INSTALL_DIR="$1" | ||
|
||
pushd $PROJ_DIR | ||
cmake -S . \ | ||
-B ./build \ | ||
-GNinja \ | ||
-DMLIR_DIR="$LLVM_INSTALL_DIR/lib/cmake/mlir" \ | ||
-DLLVM_EXTERNAL_LIT=$(which lit) \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_C_COMPILER=gcc \ | ||
-DCMAKE_CXX_COMPILER=g++ \ | ||
-DPython3_EXECUTABLE=$(which python3) | ||
|
||
cmake --build ./build --target all | ||
|
||
python3 -m pip install -r ./torch-requirements.txt | ||
PYTHONPATH=./build/python_packages/ python3 -m pytest torch-frontend/python/test | ||
|
||
popd |
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,38 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
# path to script | ||
CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
# path to byteir root | ||
ROOT_PROJ_DIR="$CUR_DIR/../../.." | ||
# path to byteir/frontends/torch-frontend | ||
PROJ_DIR="$ROOT_PROJ_DIR/frontends/torch-frontend" | ||
# path to torch-mlir | ||
TORCH_MLIR_ROOT="$PROJ_DIR/third_party/torch-mlir" | ||
|
||
function apply_patches() { | ||
pushd $TORCH_MLIR_ROOT | ||
git clean -fd . | ||
for patch in ../patches/*; do | ||
git apply $patch | ||
done | ||
popd | ||
} | ||
|
||
function prepare_for_build() { | ||
pushd ${PROJ_DIR} | ||
# install requirements | ||
python3 -m pip install -r requirements.txt | ||
|
||
# init submodule | ||
git submodule update --init -f $TORCH_MLIR_ROOT | ||
pushd $TORCH_MLIR_ROOT | ||
git submodule update --init -f externals/mlir-hlo | ||
git submodule update --init -f externals/llvm-project | ||
popd | ||
|
||
# apply patches | ||
apply_patches | ||
} |