Skip to content

[BE] Add Complex Kernel Test #97

[BE] Add Complex Kernel Test

[BE] Add Complex Kernel Test #97

Workflow file for this run

name: Tests
on:
push:
branches: [main, develop]
paths-ignore:
- "website/**"
- "docs/**"
- "*.md"
- ".gitignore"
pull_request:
branches: [main]
paths-ignore:
- "website/**"
- "docs/**"
- "*.md"
- ".gitignore"
workflow_dispatch:
inputs:
test-type:
description: "Type of tests to run"
required: true
default: "all"
type: choice
options:
- "all"
- "cpu"
- "cuda"
coverage:
description: "Enable coverage reporting"
required: true
default: false
type: boolean
jobs:
format-check:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install development dependencies
run: |
make install-dev
- name: Check code formatting
run: |
make format-check || (echo "❌ Format check failed. Please run 'make format' to fix formatting issues, then commit the changes." && echo "📖 For detailed formatting guide, see: https://github.com/pytorch-labs/tritonparse/wiki/05.-Code-Formatting" && exit 1)
- name: Check linting
run: |
make lint-check || (echo "❌ Linting failed. Please run 'make format' to fix formatting issues, then commit the changes." && echo "📖 For detailed formatting guide, see: https://github.com/pytorch-labs/tritonparse/wiki/05.-Code-Formatting" && exit 1)
test:
runs-on: 4-core-ubuntu-gpu-t4
timeout-minutes: 120
needs: format-check
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Get daily cache timestamp
id: daily-cache
run: |
# Calculate date (e.g., 2024-01-15) for daily cache expiration
DATE_STAMP=$(date +"%Y-%m-%d")
echo "date=$DATE_STAMP" >> $GITHUB_OUTPUT
echo "Using daily cache stamp: $DATE_STAMP"
- name: Get weekly cache timestamp
id: weekly-cache
run: |
# Calculate year-week (e.g., 2024-03) for weekly cache expiration
WEEK_STAMP=$(date +"%Y-%U")
echo "week=$WEEK_STAMP" >> $GITHUB_OUTPUT
echo "Using weekly cache stamp: $WEEK_STAMP"
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.11-${{ steps.daily-cache.outputs.date }}
restore-keys: |
${{ runner.os }}-pip-3.11-
- name: Get Triton latest commit
id: triton-commit
run: |
# Check if jq is available
if ! command -v jq &> /dev/null; then
echo "jq not found, installing..."
sudo apt-get update && sudo apt-get install -y jq
fi
# Get commit with error handling
echo "Fetching latest Triton commit..."
COMMIT=$(curl -s --max-time 30 --retry 3 https://api.github.com/repos/triton-lang/triton/commits/main | jq -r .sha 2>/dev/null || echo "")
if [ -n "$COMMIT" ] && [ "$COMMIT" != "null" ]; then
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
echo "cache-key=$COMMIT" >> $GITHUB_OUTPUT
echo "✅ Using Triton commit: $COMMIT"
else
echo "❌ Failed to get Triton commit, using 'main' as fallback"
# Force cache miss by using timestamp when API fails
TIMESTAMP=$(date +%Y%m%d%H%M%S)
echo "commit=main" >> $GITHUB_OUTPUT
echo "cache-key=main-fallback-$TIMESTAMP" >> $GITHUB_OUTPUT
echo "⚠️ Using fallback cache key: main-fallback-$TIMESTAMP"
fi
- name: Cache Triton source and build
uses: actions/cache@v3
with:
path: |
/tmp/triton
/tmp/triton-cache
key: ${{ runner.os }}-triton-source-${{ hashFiles('.ci/install-triton.sh') }}-${{ steps.triton-commit.outputs.cache-key }}
restore-keys: |
${{ runner.os }}-triton-source-${{ hashFiles('.ci/install-triton.sh') }}-
${{ runner.os }}-triton-source-
- name: Setup environment
env:
CONDA_ENV: tritonparse
PYTHON_VERSION: "3.11"
CUDA_VERSION: "12.8"
run: |
bash .ci/setup.sh
- name: Install Triton from source
env:
CONDA_ENV: tritonparse
TRITON_COMMIT: ${{ steps.triton-commit.outputs.commit }}
run: |
bash .ci/install-triton.sh
- name: Install project dependencies
env:
CONDA_ENV: tritonparse
run: |
bash .ci/install-project.sh
- name: Run tests
env:
CONDA_ENV: tritonparse
TEST_TYPE: ${{ github.event.inputs.test-type || 'all' }}
COVERAGE: ${{ github.event.inputs.coverage || 'false' }}
run: |
bash .ci/run-tests.sh