-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0f2ff62
Showing
1,187 changed files
with
61,067 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,5 @@ | ||
[flake8] | ||
count = 1 | ||
show-source = 1 | ||
select = E9,F63,F7,F82 | ||
exclude = lit.cfg.py |
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,37 @@ | ||
# See: https://github.com/llvm/torch-mlir/issues/1374 | ||
name: Publish releases page | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
scrape_and_publish_releases: | ||
name: "Scrape and publish releases" | ||
runs-on: ubuntu-latest | ||
|
||
# Don't run this in everyone's forks. | ||
if: github.repository == 'nod-ai/SHARK' | ||
|
||
steps: | ||
- name: Checking out repository | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.NODAI_INVOCATION_TOKEN }} | ||
- name: Run scrape releases script | ||
run: python ./build_tools/scrape_releases.py nod-ai SHARK > /tmp/index.html | ||
shell: bash | ||
- run: git fetch --all | ||
- run: git switch github-pages | ||
- run: git config --global user.email "none@none.com" | ||
- run: git config --global user.name "nod-ai" | ||
- run: mv /tmp/index.html package-index/index.html | ||
- run: git add package-index/index.html | ||
|
||
# Only try to make a commit if the file has changed. | ||
- run: git diff --cached --exit-code || git commit -m "Update releases." | ||
|
||
- name: GitHub Push | ||
uses: ad-m/github-push-action@v0.6.0 | ||
with: | ||
github_token: ${{ secrets.NODAI_INVOCATION_TOKEN }} | ||
branch: github-pages |
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,153 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Nightly Release | ||
|
||
on: | ||
schedule: | ||
- cron: '0 5 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
windows-build: | ||
runs-on: 7950X | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Compute version | ||
shell: powershell | ||
run: | | ||
$package_version = $(Get-Date -UFormat "%Y%m%d")+"."+${{ github.run_number }} | ||
$package_version_ = $(Get-Date -UFormat "%Y%m%d")+"_"+${{ github.run_number }} | ||
$tag_name=$package_version | ||
echo "package_version=$package_version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
echo "package_version_=$package_version_" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
echo "tag_name=$tag_name" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.NODAI_INVOCATION_TOKEN }} | ||
with: | ||
tag_name: ${{ env.tag_name }} | ||
release_name: nod.ai SHARK ${{ env.tag_name }} | ||
body: | | ||
Automatic snapshot release of nod.ai SHARK. | ||
draft: true | ||
prerelease: true | ||
|
||
- name: Build Package | ||
shell: powershell | ||
run: | | ||
./setup_venv.ps1 | ||
$env:SHARK_PACKAGE_VERSION=${{ env.package_version }} | ||
pip wheel -v -w dist . --pre -f https://download.pytorch.org/whl/nightly/cpu -f https://llvm.github.io/torch-mlir/package-index/ -f https://nod-ai.github.io/SHARK-Runtime/pip-release-links.html | ||
python process_skipfiles.py | ||
pyinstaller .\apps\stable_diffusion\shark_sd.spec | ||
mv ./dist/shark_sd.exe ./dist/nodai_shark_sd_${{ env.package_version_ }}.exe | ||
signtool sign /f c:\g\shark_02152023.cer /csp "eToken Base Cryptographic Provider" /k "${{ secrets.CI_CERT }}" ./dist/nodai_shark_sd_${{ env.package_version_ }}.exe | ||
- name: Upload Release Assets | ||
id: upload-release-assets | ||
uses: dwenegar/upload-release-assets@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.NODAI_INVOCATION_TOKEN }} | ||
with: | ||
release_id: ${{ steps.create_release.outputs.id }} | ||
assets_path: ./dist/nodai* | ||
#asset_content_type: application/vnd.microsoft.portable-executable | ||
|
||
- name: Publish Release | ||
id: publish_release | ||
uses: eregon/publish-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.NODAI_INVOCATION_TOKEN }} | ||
with: | ||
release_id: ${{ steps.create_release.outputs.id }} | ||
|
||
linux-build: | ||
|
||
runs-on: a100 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.11"] | ||
backend: [IREE, SHARK] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Setup pip cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest toml | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt -f https://llvm.github.io/torch-mlir/package-index/ -f https://nod-ai.github.io/SHARK-Runtime/pip-release-links.html; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude shark.venv,lit.cfg.py | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude shark.venv,lit.cfg.py | ||
- name: Build and validate the IREE package | ||
if: ${{ matrix.backend == 'IREE' }} | ||
continue-on-error: true | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
USE_IREE=1 VENV_DIR=iree.venv ./setup_venv.sh | ||
source iree.venv/bin/activate | ||
package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')" | ||
SHARK_PACKAGE_VERSION=${package_version} \ | ||
pip wheel -v -w wheelhouse . --pre -f https://download.pytorch.org/whl/nightly/torch -f https://llvm.github.io/torch-mlir/package-index/ -f https://openxla.github.io/iree/pip-release-links.html | ||
# Install the built wheel | ||
pip install ./wheelhouse/nodai* | ||
# Validate the Models | ||
/bin/bash "$GITHUB_WORKSPACE/build_tools/populate_sharktank_ci.sh" | ||
pytest --ci --ci_sha=${SHORT_SHA} --local_tank_cache="./gen_shark_tank/" -k "not metal" | | ||
tail -n 1 | | ||
tee -a pytest_results.txt | ||
if !(grep -Fxq " failed" pytest_results.txt) | ||
then | ||
export SHA=$(git log -1 --format='%h') | ||
gsutil -m cp -r $GITHUB_WORKSPACE/gen_shark_tank/* gs://shark_tank/${DATE}_$SHA | ||
gsutil -m cp -r gs://shark_tank/${DATE}_$SHA/* gs://shark_tank/nightly/ | ||
fi | ||
rm -rf ./wheelhouse/nodai* | ||
- name: Build and validate the SHARK Runtime package | ||
if: ${{ matrix.backend == 'SHARK' }} | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
./setup_venv.sh | ||
source shark.venv/bin/activate | ||
package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')" | ||
SHARK_PACKAGE_VERSION=${package_version} \ | ||
pip wheel -v -w wheelhouse . --pre -f https://download.pytorch.org/whl/nightly/torch -f https://llvm.github.io/torch-mlir/package-index/ -f https://nod-ai.github.io/SHARK-Runtime/pip-release-links.html | ||
# Install the built wheel | ||
pip install ./wheelhouse/nodai* | ||
# Validate the Models | ||
pytest --ci --ci_sha=${SHORT_SHA} -k "not metal" | | ||
tail -n 1 | | ||
tee -a pytest_results.txt |
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,163 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Validate Models on Shark Runtime | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
- 'shark/examples/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
- 'shark/examples/**' | ||
workflow_dispatch: | ||
|
||
# Ensure that only a single job or workflow using the same | ||
# concurrency group will run at a time. This would cancel | ||
# any in-progress jobs in the same github workflow and github | ||
# ref (e.g. refs/heads/main or refs/pull/<pr_number>/merge). | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-validate: | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [7950x, icelake, a100, MacStudio, ubuntu-latest] | ||
suite: [cpu,cuda,vulkan] | ||
python-version: ["3.11"] | ||
include: | ||
- os: ubuntu-latest | ||
suite: lint | ||
exclude: | ||
- os: ubuntu-latest | ||
suite: vulkan | ||
- os: ubuntu-latest | ||
suite: cuda | ||
- os: ubuntu-latest | ||
suite: cpu | ||
- os: MacStudio | ||
suite: cuda | ||
- os: MacStudio | ||
suite: cpu | ||
- os: icelake | ||
suite: vulkan | ||
- os: icelake | ||
suite: cuda | ||
- os: a100 | ||
suite: cpu | ||
- os: 7950x | ||
suite: cpu | ||
- os: 7950x | ||
suite: cuda | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
if: matrix.os != '7950x' | ||
|
||
- name: Set Environment Variables | ||
if: matrix.os != '7950x' | ||
run: | | ||
echo "SHORT_SHA=`git rev-parse --short=4 HEAD`" >> $GITHUB_ENV | ||
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | ||
- name: Set up Python Version File ${{ matrix.python-version }} | ||
if: matrix.os == 'a100' || matrix.os == 'ubuntu-latest' || matrix.os == 'icelake' | ||
run: | | ||
# See https://github.com/actions/setup-python/issues/433 | ||
echo ${{ matrix.python-version }} >> $GITHUB_WORKSPACE/.python-version | ||
- name: Set up Python ${{ matrix.python-version }} | ||
if: matrix.os == 'a100' || matrix.os == 'ubuntu-latest' || matrix.os == 'icelake' | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '${{ matrix.python-version }}' | ||
#cache: 'pip' | ||
#cache-dependency-path: | | ||
# **/requirements-importer.txt | ||
# **/requirements.txt | ||
|
||
- uses: actions/checkout@v2 | ||
if: matrix.os == '7950x' | ||
|
||
- name: Install dependencies | ||
if: matrix.suite == 'lint' | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest toml black | ||
- name: Lint with flake8 | ||
if: matrix.suite == 'lint' | ||
run: | | ||
# black format check | ||
black --version | ||
black --check . | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --isolated --count --exit-zero --max-complexity=10 --max-line-length=127 \ | ||
--statistics --exclude lit.cfg.py | ||
- name: Validate Models on CPU | ||
if: matrix.suite == 'cpu' | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYTHON=python${{ matrix.python-version }} IMPORTER=1 ./setup_venv.sh | ||
source shark.venv/bin/activate | ||
pytest --forked --benchmark=native --ci --ci_sha=${SHORT_SHA} --update_tank --tank_url="gs://shark_tank/nightly/" -k cpu | ||
gsutil cp ./bench_results.csv gs://shark-public/builder/bench_results/${DATE}/bench_results_cpu_${SHORT_SHA}.csv | ||
gsutil cp gs://shark-public/builder/bench_results/${DATE}/bench_results_cpu_${SHORT_SHA}.csv gs://shark-public/builder/bench_results/latest/bench_results_cpu_latest.csv | ||
- name: Validate Models on NVIDIA GPU | ||
if: matrix.suite == 'cuda' | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYTHON=python${{ matrix.python-version }} ./setup_venv.sh | ||
source shark.venv/bin/activate | ||
pytest --forked --benchmark=native --ci --ci_sha=${SHORT_SHA} --update_tank --tank_url="gs://shark_tank/nightly/" -k cuda | ||
gsutil cp ./bench_results.csv gs://shark-public/builder/bench_results/${DATE}/bench_results_cuda_${SHORT_SHA}.csv | ||
gsutil cp gs://shark-public/builder/bench_results/${DATE}/bench_results_cuda_${SHORT_SHA}.csv gs://shark-public/builder/bench_results/latest/bench_results_cuda_latest.csv | ||
# Disabled due to black image bug | ||
# python build_tools/stable_diffusion_testing.py --device=cuda | ||
- name: Validate Vulkan Models (MacOS) | ||
if: matrix.suite == 'vulkan' && matrix.os == 'MacStudio' | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYTHON=python${{ matrix.python-version }} ./setup_venv.sh | ||
source shark.venv/bin/activate | ||
export DYLD_LIBRARY_PATH=/usr/local/lib/ | ||
echo $PATH | ||
pip list | grep -E "torch|iree" | ||
pytest --ci --ci_sha=${SHORT_SHA} --local_tank_cache="/Volumes/builder/anush/shark_cache" --tank_url="gs://shark_tank/nightly/" -k vulkan | ||
- name: Validate Vulkan Models (a100) | ||
if: matrix.suite == 'vulkan' && matrix.os == 'a100' | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYTHON=python${{ matrix.python-version }} ./setup_venv.sh | ||
source shark.venv/bin/activate | ||
pytest --forked --benchmark="native" --ci --ci_sha=${SHORT_SHA} --update_tank --tank_url="gs://shark_tank/nightly/" -k vulkan | ||
python build_tools/stable_diffusion_testing.py --device=vulkan | ||
- name: Validate Vulkan Models (Windows) | ||
if: matrix.suite == 'vulkan' && matrix.os == '7950x' | ||
run: | | ||
./setup_venv.ps1 | ||
pytest -k vulkan -s --ci | ||
- name: Validate Stable Diffusion Models (Windows) | ||
if: matrix.suite == 'vulkan' && matrix.os == '7950x' | ||
run: | | ||
./setup_venv.ps1 | ||
python process_skipfiles.py | ||
pyinstaller .\apps\stable_diffusion\shark_sd.spec | ||
python build_tools/stable_diffusion_testing.py --device=vulkan |
Oops, something went wrong.