Skip to content

Commit

Permalink
Merge branch 'main' into mixtral
Browse files Browse the repository at this point in the history
  • Loading branch information
archana-ramalingam authored Nov 23, 2024
2 parents dd29409 + eacbd9b commit b01d5a5
Show file tree
Hide file tree
Showing 426 changed files with 37,706 additions and 6,079 deletions.
158 changes: 158 additions & 0 deletions .github/workflows/build_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Copyright 2024 Advanced Micro Devices, Inc.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: Build packages

on:
workflow_dispatch:
schedule:
# Runs at 11:00 AM UTC, which is 3:00 AM PST (UTC-8)
- cron: '0 11 * * *'

permissions:
contents: read

jobs:
# Note: metadata generation could happen in a separate trigger/schedule
# workflow. For cross platform builds, it's useful to just generate the
# metadata on Linux and pass that to later jobs using artifacts.
setup_metadata:
if: ${{ github.repository_owner == 'nod-ai' || github.event_name != 'schedule' }}
runs-on: ubuntu-24.04
outputs:
shark_package_version: ${{ steps.version.outputs.shark_package_version }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: false
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12
cache: "pip"
- name: Install Python packages
run: |
pip install packaging
pip freeze
- name: Generate release candidate versions
id: version_rc
run: |
version_suffix="$(printf 'rc%(%Y%m%d)T')"
echo "version_suffix=${version_suffix}" >> $GITHUB_ENV
sharktank_package_version=$(python3 build_tools/python_deploy/compute_local_version.py --version-suffix=${version_suffix} sharktank)
shortfin_package_version=$(python3 build_tools/python_deploy/compute_local_version.py --version-suffix=${version_suffix} shortfin)
sharkai_package_version=$(python3 build_tools/python_deploy/compute_common_version.py -rc --version-suffix=${version_suffix} --write-json)
- name: Upload version_local.json
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: version_local
path: |
sharktank/version_local.json
shortfin/version_local.json
shark-ai/version_local.json
build_packages:
name: "${{ matrix.package }} :: ${{ matrix.platform }} :: ${{ matrix.python-version }}"
runs-on: ${{ matrix.runs-on }}
permissions:
contents: write
needs: [setup_metadata]
strategy:
fail-fast: false
matrix:
include:
# Ubuntu packages.
- runs-on: ubuntu-24.04
platform: linux-x86_64
package: shark-ai
python-version: cp311-cp311 # Ignored (generic wheel), set for workflow naming
- runs-on: ubuntu-24.04
platform: linux-x86_64
package: sharktank
python-version: cp311-cp311 # Ignored (generic wheel), set for workflow naming
- runs-on: ubuntu-24.04
platform: linux-x86_64
package: shortfin
python-version: cp310-cp310
- runs-on: ubuntu-24.04
platform: linux-x86_64
package: shortfin
python-version: cp311-cp311
- runs-on: ubuntu-24.04
platform: linux-x86_64
package: shortfin
python-version: cp312-cp312
- runs-on: ubuntu-24.04
platform: linux-x86_64
package: shortfin
python-version: cp313-cp313
- runs-on: ubuntu-24.04
platform: linux-x86_64
package: shortfin
python-version: cp313-cp313t

# TODO(#130): macOS platform
# TODO(#130): Windows platform

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: "c" # Windows can hit path length limits, so use a short path.
submodules: false

- name: Download version_local.json
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: version_local
path: ./c/
merge-multiple: true

- name: Build shark-ai (Linux x86_64)
if: "matrix.package == 'shark-ai' && matrix.platform == 'linux-x86_64'"
env:
OUTPUT_DIR: "${{ github.workspace }}/bindist"
run: |
[ -e ./bindist/* ] && rm ./bindist/*
./c/build_tools/python_deploy/write_requirements.py --version-suffix=${version_suffix}
./c/shark-ai/build_tools/build_linux_package.sh
- name: Build sharktank (Linux x86_64)
if: "matrix.package == 'sharktank' && matrix.platform == 'linux-x86_64'"
env:
OUTPUT_DIR: "${{ github.workspace }}/bindist"
run: |
[ -e ./bindist/* ] && rm ./bindist/*
./c/sharktank/build_tools/build_linux_package.sh
- name: Build shortfin (Linux x86_64, ${{ matrix.python-version }})
if: "matrix.package == 'shortfin' && matrix.platform == 'linux-x86_64'"
env:
OUTPUT_DIR: "${{ github.workspace }}/bindist"
OVERRIDE_PYTHON_VERSIONS: "${{ matrix.python-version }}"
run: |
[ -e ./bindist/* ] && rm ./bindist/*
./c/shortfin/build_tools/build_linux_package.sh
- name: Upload python wheels
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
if-no-files-found: error
name: snapshot-${{ matrix.package }}-${{ matrix.platform }}-${{ matrix.python-version }}
path: bindist

- name: Release python wheels
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
artifacts: bindist/*.whl
tag: "dev-wheels"
name: "dev-wheels"
body: "Automatic snapshot release of shark-ai python wheels."
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: false
93 changes: 93 additions & 0 deletions .github/workflows/ci-llama-large-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Copyright 2024 Advanced Micro Devices, Inc.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: Llama Benchmarking Tests

on:
workflow_dispatch:
schedule:
# Weekdays at 4:00 AM UTC = 9:00 PM PST.
- cron: "0 4 * * 1-5"

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
test_llama_large:
if: ${{ github.repository_owner == 'nod-ai' || github.event_name != 'schedule' }}
name: "Llama Benchmarking Tests"
strategy:
matrix:
version: [3.11]
fail-fast: false
runs-on: llama-mi300x-1
defaults:
run:
shell: bash
env:
PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache"
VENV_DIR: ${{ github.workspace }}/.venv
steps:
- name: Get Current Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: "Setting up Python"
id: setup_python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{matrix.version}}

- name: "Checkout Code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Cache Pip Packages
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
id: cache-pip
with:
path: ${{ env.PIP_CACHE_DIR }}
key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements.txt') }}

- name: Install pip deps
run: |
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install latest iree-turbine.
pip install --no-compile -f https://iree.dev/pip-release-links.html --src deps \
-e "git+https://github.com/iree-org/iree-turbine.git#egg=iree-turbine"
# Test with nightly releases, not what iree-turbine uses.
pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \
iree-base-compiler \
iree-base-runtime
- name: Run llama tests
run: pytest sharktank/tests/models/llama/benchmark_amdgpu_test.py -v -s --run-nightly-llama-tests --iree-hip-target=gfx942 --html=out/llm/llama/benchmark/index.html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.SHARK_PLATFORM_GH_TOKEN }}
publish_dir: ./out/llm/llama/benchmark
destination_dir: ./llm/llama/benchmark
keep_files: true

- name: Upload llama executable files
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: llama-files
path: ${{ github.workspace }}/${{ steps.date.outputs.date }}
85 changes: 85 additions & 0 deletions .github/workflows/ci-llama-quick-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copyright 2024 Advanced Micro Devices, Inc.
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: Llama Benchmarking 8B Tests

on:
workflow_dispatch:
pull_request:
push:
branches:
- main

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
test_llama_quick:
name: "Llama Benchmarking 8B Tests"
strategy:
matrix:
version: [3.11]
fail-fast: false
runs-on: llama-mi300x-1
defaults:
run:
shell: bash
env:
PIP_CACHE_DIR: "${{ github.workspace }}/.pip-cache"
VENV_DIR: ${{ github.workspace }}/.venv
steps:
- name: Get Current Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: "Setting up Python"
id: setup_python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{matrix.version}}

- name: "Checkout Code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Cache Pip Packages
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
id: cache-pip
with:
path: ${{ env.PIP_CACHE_DIR }}
key: pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('*requirements.txt') }}

- name: Install pip deps
run: |
python -m pip install --no-compile --upgrade pip
# Note: We install in three steps in order to satisfy requirements
# from non default locations first. Installing the PyTorch CPU
# wheels saves multiple minutes and a lot of bandwidth on runner setup.
pip install --no-compile -r pytorch-cpu-requirements.txt
pip install --no-compile -r requirements.txt -r sharktank/requirements-tests.txt -e sharktank/
# Install latest iree-turbine.
pip install --no-compile -f https://iree.dev/pip-release-links.html --src deps \
-e "git+https://github.com/iree-org/iree-turbine.git#egg=iree-turbine"
# Test with nightly releases, not what iree-turbine uses.
pip install -f https://iree.dev/pip-release-links.html --upgrade --pre \
iree-base-compiler \
iree-base-runtime
- name: Run llama 8b f16 decomposed test
run: pytest sharktank/tests/models/llama/benchmark_amdgpu_test.py -v -s --iree-hip-target=gfx942 --run-quick-llama-test

- name: Upload llama executable files
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: llama-files
path: ${{ github.workspace }}/${{ steps.date.outputs.date }}
Loading

0 comments on commit b01d5a5

Please sign in to comment.