Skip to content

Commit 32c9be1

Browse files
authored
Convert inductor-tests.yml to reusable workflow (#2097)
1 parent d7e5226 commit 32c9be1

File tree

2 files changed

+145
-103
lines changed

2 files changed

+145
-103
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Pytorch inductor tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
pytorch_ref:
7+
description: PyTorch ref, keep empty for default
8+
type: string
9+
default: ""
10+
suite:
11+
description: Space separated lists of test suites, all if empty
12+
type: string
13+
default: ""
14+
runner_label:
15+
description: Runner label, keep empty for default
16+
type: string
17+
default: ""
18+
python_version:
19+
description: Python version
20+
type: string
21+
default: "3.9"
22+
pytorch_repo:
23+
description: PyTorch repo (e.g. user/repo)
24+
type: string
25+
default: "pytorch/pytorch"
26+
27+
permissions: read-all
28+
29+
env:
30+
PYTHON_VERSION: "${{ inputs.python_version }}"
31+
PYTORCH_REPO: "${{ inputs.pytorch_repo }}"
32+
33+
jobs:
34+
build:
35+
name: Test
36+
runs-on:
37+
- ${{ inputs.runner_label || 'max1550' }}
38+
timeout-minutes: 720
39+
defaults:
40+
run:
41+
shell: bash -noprofile --norc -eo pipefail -c "source /home/runner/intel/oneapi/setvars.sh > /dev/null; source {0}"
42+
steps:
43+
- name: Print inputs
44+
run: |
45+
cat <<EOF
46+
${{ toJSON(inputs) }}
47+
EOF
48+
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
52+
- name: Load pip cache
53+
id: pip-cache
54+
uses: ./.github/actions/load
55+
with:
56+
path: $HOME/.cache/pip
57+
# pip cache per commit id just to minimize network traffic
58+
key: pip-$PYTHON_VERSION-$GITHUB_SHA
59+
60+
- name: Install Python
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: ${{ env.PYTHON_VERSION }}
64+
65+
- name: Setup PyTorch
66+
uses: ./.github/actions/setup-pytorch
67+
with:
68+
repository: ${{ env.PYTORCH_REPO}}
69+
ref: ${{ inputs.pytorch_ref }}
70+
71+
- name: Setup Triton
72+
uses: ./.github/actions/setup-triton
73+
74+
- name: Install python test dependencies
75+
run: |
76+
pip install pandas scipy tqdm
77+
78+
- name: Run inductor tests
79+
run: |
80+
cd pytorch
81+
pip install -r .ci/docker/requirements-ci.txt
82+
83+
export PYTORCH_TESTING_DEVICE_ONLY_FOR="xpu"
84+
85+
test_cmd="python test/run_test.py --include "
86+
if [[ -z "${{ github.event.inputs.suite }}" ]]; then
87+
for test in $(ls test/inductor | grep test);
88+
do
89+
test_cmd="${test_cmd} inductor/$test"
90+
done
91+
else
92+
for test in ${{ github.event.inputs.suite }};
93+
do
94+
test_cmd="${test_cmd} $test"
95+
done
96+
fi
97+
eval $test_cmd
98+
99+
- name: Report environment details
100+
if: always()
101+
run: |
102+
source ./scripts/capture-hw-details.sh --quiet
103+
TIMESTAMP=$(date '+%Y%m%d%H%M%S')
104+
mkdir -p pytorch/test/test-reports
105+
cat <<EOF | tee pytorch/test/test-reports/.env
106+
TIMESTAMP=$TIMESTAMP
107+
JOB_NAME=${{ join(matrix.*, '-') }}
108+
GITHUB_RUN_ID=$GITHUB_RUN_ID
109+
GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER
110+
GITHUB_RUN_ATTEMPT=$GITHUB_RUN_ATTEMPT
111+
PYTHON_VERSION=$PYTHON_VERSION
112+
PYTORCH_REPO=$PYTORCH_REPO
113+
PYTORCH_COMMIT_ID=$PYTORCH_COMMIT_ID
114+
TRITON_REPO=$GITHUB_REPOSITORY
115+
TRITON_COMMIT_ID=$GITHUB_SHA
116+
TORCHVISION_COMMIT_ID=$TORCHVISION_COMMIT_ID
117+
LIBIGC1_VERSION=$LIBIGC1_VERSION
118+
LEVEL_ZERO_VERSION=$LEVEL_ZERO_VERSION
119+
GPU_DEVICE=$GPU_DEVICE
120+
AGAMA_VERSION=$AGAMA_VERSION
121+
EOF
122+
123+
- name: Upload test logs
124+
if: always()
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: logs-${{ env.PYTHON_VERSION }}
128+
path: pytorch/test/test-reports
129+
include-hidden-files: true
130+
131+
- name: Save pip cache
132+
if: ${{ steps.pip-cache.outputs.status == 'miss' }}
133+
uses: ./.github/actions/save
134+
with:
135+
path: ${{ steps.pip-cache.outputs.path }}
136+
dest: ${{ steps.pip-cache.outputs.dest }}

.github/workflows/inductor-tests.yml

Lines changed: 9 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -28,106 +28,12 @@ env:
2828
PYTORCH_REPO: pytorch/pytorch
2929

3030
jobs:
31-
build:
32-
name: Test
33-
runs-on:
34-
- ${{ inputs.runner_label || 'max1550' }}
35-
timeout-minutes: 720
36-
defaults:
37-
run:
38-
shell: bash -noprofile --norc -eo pipefail -c "source /home/runner/intel/oneapi/setvars.sh > /dev/null; source {0}"
39-
steps:
40-
- name: Print inputs
41-
run: |
42-
cat <<EOF
43-
${{ toJSON(inputs) }}
44-
EOF
45-
46-
- name: Checkout repository
47-
uses: actions/checkout@v4
48-
49-
- name: Load pip cache
50-
id: pip-cache
51-
uses: ./.github/actions/load
52-
with:
53-
path: $HOME/.cache/pip
54-
# pip cache per commit id just to minimize network traffic
55-
key: pip-$PYTHON_VERSION-$GITHUB_SHA
56-
57-
- name: Install Python
58-
uses: actions/setup-python@v5
59-
with:
60-
python-version: ${{ env.PYTHON_VERSION }}
61-
62-
- name: Setup PyTorch
63-
uses: ./.github/actions/setup-pytorch
64-
with:
65-
repository: ${{ env.PYTORCH_REPO}}
66-
ref: ${{ inputs.pytorch_ref }}
67-
68-
- name: Setup Triton
69-
uses: ./.github/actions/setup-triton
70-
71-
- name: Install python test dependencies
72-
run: |
73-
pip install pandas scipy tqdm
74-
75-
- name: Run inductor tests
76-
run: |
77-
cd pytorch
78-
pip install -r .ci/docker/requirements-ci.txt
79-
80-
export PYTORCH_TESTING_DEVICE_ONLY_FOR="xpu"
81-
82-
test_cmd="python test/run_test.py --include "
83-
if [[ -z "${{ github.event.inputs.suite }}" ]]; then
84-
for test in $(ls test/inductor | grep test);
85-
do
86-
test_cmd="${test_cmd} inductor/$test"
87-
done
88-
else
89-
for test in ${{ github.event.inputs.suite }};
90-
do
91-
test_cmd="${test_cmd} $test"
92-
done
93-
fi
94-
eval $test_cmd
95-
96-
- name: Report environment details
97-
if: always()
98-
run: |
99-
source ./scripts/capture-hw-details.sh --quiet
100-
TIMESTAMP=$(date '+%Y%m%d%H%M%S')
101-
mkdir -p pytorch/test/test-reports
102-
cat <<EOF | tee pytorch/test/test-reports/.env
103-
TIMESTAMP=$TIMESTAMP
104-
JOB_NAME=${{ join(matrix.*, '-') }}
105-
GITHUB_RUN_ID=$GITHUB_RUN_ID
106-
GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER
107-
GITHUB_RUN_ATTEMPT=$GITHUB_RUN_ATTEMPT
108-
PYTHON_VERSION=$PYTHON_VERSION
109-
PYTORCH_REPO=$PYTORCH_REPO
110-
PYTORCH_COMMIT_ID=$PYTORCH_COMMIT_ID
111-
TRITON_REPO=$GITHUB_REPOSITORY
112-
TRITON_COMMIT_ID=$GITHUB_SHA
113-
TORCHVISION_COMMIT_ID=$TORCHVISION_COMMIT_ID
114-
LIBIGC1_VERSION=$LIBIGC1_VERSION
115-
LEVEL_ZERO_VERSION=$LEVEL_ZERO_VERSION
116-
GPU_DEVICE=$GPU_DEVICE
117-
AGAMA_VERSION=$AGAMA_VERSION
118-
EOF
119-
120-
- name: Upload test logs
121-
if: always()
122-
uses: actions/upload-artifact@v4
123-
with:
124-
name: logs-${{ env.PYTHON_VERSION }}
125-
path: pytorch/test/test-reports
126-
include-hidden-files: true
127-
128-
- name: Save pip cache
129-
if: ${{ steps.pip-cache.outputs.status == 'miss' }}
130-
uses: ./.github/actions/save
131-
with:
132-
path: ${{ steps.pip-cache.outputs.path }}
133-
dest: ${{ steps.pip-cache.outputs.dest }}
31+
run_tests:
32+
name: Run inductor tests
33+
uses: ./.github/workflows/inductor-tests-reusable.yml
34+
with:
35+
pytorch_repo: ${{ env.PYTORCH_REPO }}
36+
python_version: ${{ env.PYTHON_VERSION }}
37+
runner_label: ${{ inputs.runner_label }}
38+
suite: ${{ inputs.suite }}
39+
pytorch_ref: ${{ inputs.pytorch_ref }}

0 commit comments

Comments
 (0)