Skip to content

[Draft] Compare microkernel IR against main for PRs #3308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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
141 changes: 141 additions & 0 deletions .github/workflows/build-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Build and test reusable workflow
run-name: ${{ inputs.run_name }} - ${{ inputs.python_version }} - ${{ inputs.runner_label || 'default'}}

on:
workflow_call:
inputs:
device:
description: Device
type: string
default: max1100
python_version:
description: Python version
type: string
required: true
run_name:
description: Custom run name
type: string
default: Build and test
use_pyenv_python:
description: Use Python built with pyenv
type: boolean
default: false

permissions: read-all

env:
PYTHON_VERSION: "3.10"
BENCHMARKING_METHOD: ${{ inputs.benchmarking_method || 'UPSTREAM_PYTORCH_PROFILER' }}
VERIFY: ${{ (github.event_name == 'pull_request' || github.event_name == 'schedule' || inputs.verify) && '1' || '0' }}
TAG: ${{ inputs.tag || (github.event_name == 'pull_request' && format('pr-{0}', github.event.number)) || (github.event_name == 'schedule' && 'ci') || 'test' }}


jobs:
build:
name: build
runs-on: Linux
defaults:
run:
shell: bash -noprofile --norc -eo pipefail -c "source /opt/intel/oneapi/setvars.sh > /dev/null; source {0}"
steps:
- name: Print inputs
run: |
cat <<EOF
${{ toJSON(inputs) }}
EOF

- name: print files and git base
run: |
echo "Base SHA: ${{ github.event.pull_request.base.sha }}"

echo "++++++++++++++"

- name: Checkout repository
uses: actions/checkout@v4


- name: Install Python
if: ${{ !(inputs.use_pyenv_python || false) }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Install Python (using actions/setup-python) ${{ inputs.python_version }}
if: ${{ !inputs.use_pyenv_python }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}

- name: Install Python (from pyenv) ${{ inputs.python_version }}
if: ${{ inputs.use_pyenv_python }}
uses: ./.github/actions/setup-pyenv-python
with:
python-version: ${{ inputs.python_version }}

- name: Identify Python version
run: |
PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info[0]}.{ sys.version_info[1]}")')"
echo "PYTHON_VERSION=$PYTHON_VERSION" | tee -a $GITHUB_ENV

- name: Install Python build dependencies
run: |
pip install wheel cmake

- name: Setup PyTorch
uses: ./.github/actions/setup-pytorch


- name: Setup Triton
uses: ./.github/actions/setup-triton
with:
command: DEBUG=1 python setup.py bdist_wheel

- name: Install benchmark dependencies
run: |
pip install matplotlib pandas tabulate

- name: Install Triton
run: |
pip install python/dist/*.whl

- name: print files and git log
run: |
ls -l
echo "old--"
git log
git branch
pip list
python benchmarks/triton_kernels_benchmark/benchmarks_to_compare_irs.py
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"


- name: clean up before re-install
run: |
mv ~/.triton ~/.triton_original
pip uninstall -y triton


- name: Checkout repository
uses: actions/checkout@v4
with:
ref: '${{ github.event.pull_request.base.sha }}'


- name: Setup Triton
uses: ./.github/actions/setup-triton
with:
command: DEBUG=1 python setup.py bdist_wheel

- name: Install Triton
run: |
pip install python/dist/*.whl

- name: print files and git log after second checkout
run: |
ls -l
echo "old--"
git log
git branch
pip list
python benchmarks/triton_kernels_benchmark/benchmarks_to_compare_irs.py
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
2 changes: 2 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ on:
default: false

pull_request:
branches-ignore:
- arunjose696/ir-compare
branches:
- main
- release/**
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
branches:
- main
- release/**
branches-ignore:
- arunjose696/ir-compare
push:
branches:
- main
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/compare-ir.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Run benchmark and upload IRs
run-name: ${{ inputs.run_name }}

on:
pull_request:
types: [opened, synchronize, reopened]



jobs:

prepare:
name: Prepare
runs-on: Linux

outputs:
matrix: ${{ steps.matrix.outputs.matrix }}

steps:
- name: Inputs
run: |
cat <<EOF
${{ toJSON(inputs) }}
EOF

- name: Matrix
id: matrix
run: |
if [[ -n "${{ inputs.runner_label }}" ]]; then
matrix='{"python": ["3.9"]}'
else
matrix='{"python": ["3.9"], "driver": ["rolling", "lts"]}'
fi
echo "matrix=$matrix" | tee -a $GITHUB_OUTPUT




run-kernels-to-compare:
name: run-kernels
needs: prepare
strategy:
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
uses: ./.github/workflows/build-reusable.yml
with:
# For this workflow, use max1550 runners to reduce cache consumption on max1100 runners.

python_version: ${{ matrix.python }}
run_name: ${{ 'compare-ir' }}
use_pyenv_python: ${{false }}
6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ name: Integration Tests
on:
workflow_dispatch:
pull_request:
branches-ignore: ['llvm-**']
branches-ignore: ['llvm-**','arunjose696/ir-compare' ]
merge_group:
branches: [main, 'dev-**']
types: [checks_requested]
push:
branches: [main]
# push:
# branches: [main]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Integration Tests
on:
workflow_dispatch:
pull_request:
branches-ignore: ['llvm-**']
branches-ignore: ['llvm-**','arunjose696/ir-compare']
merge_group:
branches: [main, 'dev-**']
types: [checks_requested]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pip-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches:
- main
branches-ignore:
- arunjose696/ir-compare
paths:
- third_party/intel/backend/driver.py
push:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pip-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches:
- main
branches-ignore:
- arunjose696/ir-compare
paths:
- third_party/intel/backend/driver.py
push:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/triton-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ on:
pull_request:
branches:
- main
branches-ignore:
- arunjose696/ir-compare
paths:
- .github/workflows/triton-benchmarks.yml
- benchmarks/**
Expand Down
Loading
Loading