Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/actions/setup-tico-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Setup TICO test environment
description: Install ONE, a selected PyTorch channel, TICO, and test dependencies

inputs:
torch-version:
description: PyTorch family, nightly, or nightly-latest
required: true
one-version:
description: ONE compiler release used by tests
required: false
default: 1.30.1

runs:
using: composite
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Resolve ONE package name
id: one
shell: bash
env:
ONE_VERSION: ${{ inputs.one-version }}
run: |
CODENAME="$(lsb_release -cs)"
echo "filename=one-compiler-${CODENAME}_${ONE_VERSION}_amd64.deb" >> "$GITHUB_OUTPUT"

- name: Download ONE compiler
shell: bash
working-directory: ./.github/actions/download-release-asset
env:
ONE_VERSION: ${{ inputs.one-version }}
ONE_PACKAGE: ${{ steps.one.outputs.filename }}
run: |
chmod +x entrypoint.sh
./entrypoint.sh Samsung ONE "$ONE_VERSION" "$ONE_PACKAGE"

- name: Install ONE compiler
shell: bash
working-directory: ./.github/actions/download-release-asset
env:
ONE_PACKAGE: ${{ steps.one.outputs.filename }}
run: |
sudo dpkg -i "$ONE_PACKAGE" || sudo apt-get install -f -y
onecc --version

- name: Trust the checkout for versioningit
shell: bash
run: git config --global --add safe.directory '*'

- name: Install TICO and configure tests
shell: bash
env:
TORCH_VERSION: ${{ inputs.torch-version }}
run: |
./ccex install --dist --torch_ver "$TORCH_VERSION" --cpu_only
pt2-to-circle -h
./ccex configure test --torch_ver "$TORCH_VERSION" --cpu_only

- name: Show installed package versions
shell: bash
run: |
python3 - <<'PY'
import torch
import torchvision
import tico

print(f"torch={torch.__version__}")
print(f"torchvision={torchvision.__version__}")
print(f"tico={tico.__version__}")
PY
170 changes: 98 additions & 72 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on:
- main
- rel/*

permissions:
contents: read

concurrency:
group: check-pr-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check-commit-message:
name: Check commit message
Expand All @@ -16,18 +23,15 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
# Checkout PR head commit
# Checkout Action use merge commit as default
# Checkout PR head commit. The default is the synthetic merge commit.
ref: ${{ github.event.pull_request.head.sha }}
# Fetch all history and branch (default: 1)
fetch-depth: 0
- name: "Check signed-off"

- name: Check signed-off
run: |
# Get commit body
git log origin/"$GITHUB_BASE_REF"..HEAD --format=%b > commit_msg.txt
sed "/^$/d" commit_msg.txt > commit_body.txt

# Check string starting from "TICO-DCO-1.0-Signed-off-by:"
count="$(grep -c "TICO-DCO-1.0-Signed-off-by:" commit_body.txt)"
if [[ ! "$count" -ge "1" ]]; then
echo "Your commit message does not contain the expected signoff information."
Expand All @@ -38,97 +42,119 @@ jobs:

echo "TICO-DCO-1.0-Signed-off-by is OK"


check-style:
name: Check style
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: "Run configure"
run: |
./ccex configure format
- name: Run configure
run: ./ccex configure format

- name: Run linters
run: ./ccex format --no-apply-patches

resolve_torch_policy:
name: Resolve PyTorch policy
runs-on: ubuntu-24.04
outputs:
default_family: ${{ steps.policy.outputs.default_family }}
pr_smoke_matrix: ${{ steps.policy.outputs.pr_smoke_matrix }}

steps:
- uses: actions/checkout@v4

- name: "Run linters"
- name: Read central policy
id: policy
run: |
./ccex format --no-apply-patches
POLICY=tico/utils/compat/torch_version_policy.py
python3 "$POLICY" validate
echo "default_family=$(python3 "$POLICY" default-family)" >> "$GITHUB_OUTPUT"
echo "pr_smoke_matrix=$(python3 "$POLICY" ci-matrix pr-smoke)" >> "$GITHUB_OUTPUT"

build-and-test:
build_package:
name: Build package once
runs-on: ubuntu-24.04
strategy:
matrix:
torch-version: ["2.5", "2.6", "2.7", "2.8", "nightly"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Import all commit history and tag
fetch-depth: 0

- name: Get Ubuntu codename
id: os
run: |
CODENAME=$(lsb_release -cs)
echo "codename=$CODENAME" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Specify ONE version and binary
id: one
run: |
VERSION=1.30.1
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "filename=one-compiler-${{ steps.os.outputs.codename }}_${VERSION}_amd64.deb" >> "$GITHUB_OUTPUT"
- name: Build wheel
run: ./ccex build

- name: Download one-compiler package
id: download
uses: ./.github/actions/download-release-asset
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
owner: Samsung
repo: ONE
tag: ${{ steps.one.outputs.version }}
filename: ${{ steps.one.outputs.filename }}
name: tico-wheel
path: ./dist/
retention-days: 1

test_default:
name: Full test (default torch ${{ needs.resolve_torch_policy.outputs.default_family }})
needs:
- resolve_torch_policy
- build_package
runs-on: ubuntu-24.04

- name: "Install one-compiler"
working-directory: ./.github/actions/download-release-asset
run: |
sudo dpkg -i ${{ steps.one.outputs.filename }}
sudo apt-get install -f -y
onecc --version || echo "Installation failed."
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Trust all directories for Git
run: |
# Enable access to git from 'versioningit'
git config --global --add safe.directory "*"
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: tico-wheel
path: ./dist/

- name: "Build package"
run: |
pip install build
./ccex build
- name: Set up test environment
uses: ./.github/actions/setup-tico-test
with:
torch-version: ${{ needs.resolve_torch_policy.outputs.default_family }}

- name: "Run install"
shell: bash
run: |
TORCH_VERSION=${{ matrix.torch-version }}
./ccex install --dist --torch_ver $TORCH_VERSION
pt2-to-circle -h
- name: Run all tests
run: ./ccex test

- name: "Configure test"
shell: bash
run: |
TORCH_VERSION=${{ matrix.torch-version }}
./ccex configure test --torch_ver $TORCH_VERSION
test_compatibility:
name: Smoke (${{ matrix.tier }}, torch ${{ matrix.torch-version }})
needs:
- resolve_torch_policy
- build_package
runs-on: ubuntu-24.04
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.resolve_torch_policy.outputs.pr_smoke_matrix) }}

- name: "Show torch package versions"
shell: bash
run: |
pip list | grep torch
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Run test"
shell: bash
run: |
./ccex test
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: tico-wheel
path: ./dist/

- name: "Upload artifact"
uses: actions/upload-artifact@v4
- name: Set up test environment
uses: ./.github/actions/setup-tico-test
with:
name: "wheel-${{ matrix.torch-version }}"
path: "./dist/"
torch-version: ${{ matrix.torch-version }}

- name: Run export and quantization smoke tests
run: |
./ccex test -k SimpleAdd
python3 -m unittest \
test.quantization.wrapq.test_cnn_quantized_export.CNNQuantizedExportTest.test_uint8_circle_export \
-v
Loading
Loading