Skip to content

Commit 370c4f5

Browse files
committed
Moved to a separate workflow
1 parent bac9ccd commit 370c4f5

File tree

3 files changed

+216
-52
lines changed

3 files changed

+216
-52
lines changed

.github/workflows/build-test-reusable.yml

Lines changed: 12 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ on:
5656
description: Runner label for version
5757
type: string
5858
default: runner-0.0.19
59-
env_manager:
60-
description: Environment manager
61-
default: base
62-
type: string
6359

6460
permissions: read-all
6561

@@ -73,71 +69,48 @@ jobs:
7369
runs-on: ${{ fromJson(inputs.runner_label && format('["{0}"]', inputs.runner_label) || format('["{0}", "{1}", "{2}"]', inputs.device, inputs.driver_version, inputs.runner_version)) }}
7470
defaults:
7571
run:
76-
shell: bash -noprofile --norc -eo pipefail scripts/run-${{ inputs.env_manager }}.sh {0}
72+
shell: bash -noprofile --norc -eo pipefail -c "source /opt/intel/oneapi/setvars.sh > /dev/null; source {0}"
7773
steps:
78-
- name: Checkout repository
79-
uses: actions/checkout@v4
80-
81-
- name: Load conda cache
82-
id: conda-cache
83-
uses: ./.github/actions/load
84-
env:
85-
CACHE_NUMBER: 6
86-
with:
87-
path: $HOME/miniforge3/envs/triton
88-
key: conda-${{ inputs.env_manager }}-py${{ matrix.python }}-${{ hashFiles('scripts/triton.yml', 'python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}
89-
90-
- name: Install Manager Environment
91-
shell: bash --noprofile --norc -eo pipefail {0}
92-
run: |
93-
scripts/install-${{ inputs.env_manager }}.sh --python-version ${{ inputs.python_version }}
94-
echo $HOME/miniforge3/bin >>$GITHUB_PATH
95-
9674
- name: Print inputs
9775
run: |
9876
cat <<EOF
9977
${{ toJSON(inputs) }}
10078
EOF
10179
80+
- name: Checkout repository
81+
uses: actions/checkout@v4
82+
10283
- name: Load pip cache
103-
if: inputs.env_manager == 'base'
10484
id: pip-cache
10585
uses: ./.github/actions/load
10686
env:
10787
# Increase this value to reset cache
108-
CACHE_NUMBER: 2
88+
CACHE_NUMBER: 1
10989
with:
11090
path: $HOME/.cache/pip
11191
key: pip-${{ inputs.python_version }}-${{ hashFiles('python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}
11292

11393
- name: Install Python ${{ inputs.python_version }}
114-
if: inputs.env_manager == 'base'
11594
uses: actions/setup-python@v5
11695
with:
11796
python-version: ${{ inputs.python_version }}
11897

11998
- name: Setup PyTorch
120-
if: inputs.env_manager == 'base'
12199
uses: ./.github/actions/setup-pytorch
122100
with:
123101
repository: pytorch/pytorch
124102
ref: ${{ inputs.pytorch_ref }}
125103
mode: ${{ inputs.pytorch_mode }}
126104

105+
- name: Install pass_rate dependencies
106+
run: |
107+
pip install defusedxml
108+
127109
- name: Setup Triton
128-
if: inputs.env_manager == 'base'
129110
uses: ./.github/actions/setup-triton
130111
with:
131112
build_llvm: ${{ inputs.build_llvm }}
132113

133-
- name: Setup Triton, Torch and Transformers
134-
if: inputs.env_manager != 'base'
135-
uses: ./.github/actions/install-wheels
136-
with:
137-
gh_token: ${{ secrets.GITHUB_TOKEN }}
138-
install_cmd: conda run --no-capture-output -n triton pip install
139-
python_version: ${{ inputs.python_version }}
140-
141114
- name: Create test-triton command line
142115
run: |
143116
if [[ -n "${{ inputs.skip_list }}" ]]; then
@@ -160,13 +133,12 @@ jobs:
160133
} | tee -a $GITHUB_ENV
161134
162135
- name: Run unit tests
163-
if: inputs.env_manager == 'base'
164136
run: |
165137
${{ env.TRITON_TEST_CMD }} --unit
166138
167139
- name: Run core tests
168140
run: |
169-
${{ env.TRITON_TEST_CMD }} --core
141+
${{ env.TRITON_TEST_CMD }} --core --skip-pip-install
170142
171143
- name: Run interpreter tests
172144
run: |
@@ -177,47 +149,36 @@ jobs:
177149
${{ env.TRITON_TEST_CMD }} --tutorial --skip-pip-install
178150
179151
- name: Run instrumentation tests
180-
if: inputs.env_manager == 'base'
181152
run: |
182153
${{ env.TRITON_TEST_CMD }} --instrumentation --skip-pip-install
183154
184155
- name: Get transformers version
185-
if: inputs.env_manager == 'base'
186156
run: |
187157
cd pytorch
188158
TRANSFORMERS_VERSION="$(<.ci/docker/ci_commit_pins/huggingface.txt)"
189159
echo "TRANSFORMERS_VERSION=$TRANSFORMERS_VERSION" | tee -a $GITHUB_ENV
190160
191161
- name: Install transformers
192-
if: inputs.env_manager == 'base'
193162
uses: ./.github/actions/install-dependency
194163
with:
195164
package: transformers
196165
repository: huggingface/transformers
197166
ref: ${{ env.TRANSFORMERS_VERSION }}
198167
try-tag-prefix: v
199168

200-
- name: Run inductor test
169+
- name: Run E2E test
201170
run: |
202171
${{ env.TRITON_TEST_CMD }} --inductor --skip-pip-install
203172
204173
- name: Save pip cache
205-
if: (inputs.env_manager == 'base') && (steps.pip-cache.outputs.status == 'miss')
174+
if: ${{ steps.pip-cache.outputs.status == 'miss' }}
206175
uses: ./.github/actions/save
207176
with:
208177
path: ${{ steps.pip-cache.outputs.path }}
209178
dest: ${{ steps.pip-cache.outputs.dest }}
210179

211-
- name: Save conda cache
212-
if: (inputs.env_manager != 'base') && (steps.conda-cache.outputs.status == 'miss')
213-
uses: ./.github/actions/save
214-
with:
215-
path: ${{ steps.conda-cache.outputs.path }}
216-
dest: ${{ steps.conda-cache.outputs.dest }}
217-
218180
- name: Pass rate
219181
run: |
220-
pip install defusedxml
221182
source ./scripts/capture-hw-details.sh
222183
python3 scripts/pass_rate.py --reports reports ${{ env.SKIPLIST }}
223184
python3 scripts/pass_rate.py --reports reports --json ${{ env.SKIPLIST }} > pass_rate.json
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
name: Build and test reusable workflow
2+
run-name: ${{ inputs.run_name }} - ${{ inputs.python_version }} - ${{ inputs.runner_label || 'default'}}
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
device:
8+
description: Device
9+
type: string
10+
default: max1100
11+
driver_version:
12+
description: Driver version
13+
type: string
14+
default: rolling
15+
runner_label:
16+
description: Runner label, keep empty for default
17+
type: string
18+
default: ""
19+
pytorch_ref:
20+
description: PyTorch ref, keep empty for default
21+
type: string
22+
default: ""
23+
pytorch_mode:
24+
description: PyTorch mode, source or wheels
25+
type: string
26+
default: "source"
27+
python_version:
28+
description: Python version
29+
type: string
30+
required: true
31+
upload_test_reports:
32+
description: Upload test reports
33+
type: boolean
34+
default: false
35+
ignore_errors:
36+
description: Ignore test errors
37+
type: boolean
38+
default: false
39+
skip_list:
40+
description: Skip list
41+
type: string
42+
default: ""
43+
run_name:
44+
description: Custom run name
45+
type: string
46+
default: Build and test
47+
build_llvm:
48+
description: Build LLVM
49+
type: boolean
50+
default: false
51+
enable_unskip:
52+
description: Ignore pytest.skip
53+
type: boolean
54+
default: false
55+
runner_version:
56+
description: Runner label for version
57+
type: string
58+
default: runner-0.0.19
59+
env_manager:
60+
description: Environment manager
61+
default: conda
62+
type: string
63+
64+
permissions: read-all
65+
66+
env:
67+
TRITON_DISABLE_LINE_INFO: 1
68+
TEST_UNSKIP: ${{ inputs.enable_unskip }}
69+
70+
jobs:
71+
integration-tests:
72+
name: Integration tests
73+
runs-on: ${{ fromJson(inputs.runner_label && format('["{0}"]', inputs.runner_label) || format('["{0}", "{1}", "{2}"]', inputs.device, inputs.driver_version, inputs.runner_version)) }}
74+
defaults:
75+
run:
76+
shell: bash -noprofile --norc -eo pipefail scripts/run-${{ inputs.env_manager }}.sh {0}
77+
steps:
78+
- name: Checkout repository
79+
uses: actions/checkout@v4
80+
81+
- name: Load conda cache
82+
id: conda-cache
83+
uses: ./.github/actions/load
84+
env:
85+
CACHE_NUMBER: 6
86+
with:
87+
path: $HOME/miniforge3/envs/triton
88+
key: conda-${{ inputs.env_manager }}-py${{ matrix.python }}-${{ hashFiles('scripts/triton.yml', 'python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}
89+
90+
- name: Install Manager Environment
91+
shell: bash --noprofile --norc -eo pipefail {0}
92+
run: |
93+
scripts/install-${{ inputs.env_manager }}.sh --python-version ${{ inputs.python_version }}
94+
echo $HOME/miniforge3/bin >>$GITHUB_PATH
95+
96+
- name: Print inputs
97+
run: |
98+
cat <<EOF
99+
${{ toJSON(inputs) }}
100+
EOF
101+
102+
- name: Setup Triton, Torch and Transformers
103+
uses: ./.github/actions/install-wheels
104+
with:
105+
gh_token: ${{ secrets.GITHUB_TOKEN }}
106+
install_cmd: conda run --no-capture-output -n triton pip install
107+
python_version: ${{ inputs.python_version }}
108+
109+
- name: Create test-triton command line
110+
run: |
111+
if [[ -n "${{ inputs.skip_list }}" ]]; then
112+
skiplist="$GITHUB_WORKSPACE/scripts/skiplist/${{ inputs.skip_list }}"
113+
elif [[ -n "${{ inputs.driver_version }}" ]]; then
114+
skiplist="$GITHUB_WORKSPACE/scripts/skiplist/${{ inputs.driver_version }}"
115+
else
116+
skiplist="$GITHUB_WORKSPACE/scripts/skiplist/default"
117+
fi
118+
119+
if [ -d "$skiplist" ]; then
120+
skiplist="--skip-list $skiplist"
121+
else
122+
skiplist=
123+
fi
124+
125+
{
126+
echo SKIPLIST="$skiplist"
127+
echo TRITON_TEST_CMD="bash -v -x scripts/test-triton.sh --warning-reports --skip-pytorch-install --reports-dir $GITHUB_WORKSPACE/reports ${{ inputs.ignore_errors && '--ignore-errors' || '' }} $skiplist"
128+
} | tee -a $GITHUB_ENV
129+
130+
- name: Run core tests
131+
run: |
132+
${{ env.TRITON_TEST_CMD }} --core
133+
134+
- name: Run interpreter tests
135+
run: |
136+
${{ env.TRITON_TEST_CMD }} --interpreter --skip-pip-install
137+
138+
- name: Run Tutorials
139+
run: |
140+
${{ env.TRITON_TEST_CMD }} --tutorial --skip-pip-install
141+
142+
- name: Run inductor test
143+
run: |
144+
${{ env.TRITON_TEST_CMD }} --inductor --skip-pip-install
145+
146+
- name: Save conda cache
147+
if: steps.conda-cache.outputs.status == 'miss'
148+
uses: ./.github/actions/save
149+
with:
150+
path: ${{ steps.conda-cache.outputs.path }}
151+
dest: ${{ steps.conda-cache.outputs.dest }}
152+
153+
- name: Pass rate
154+
run: |
155+
pip install defusedxml
156+
source ./scripts/capture-hw-details.sh
157+
python3 scripts/pass_rate.py --reports reports ${{ env.SKIPLIST }}
158+
python3 scripts/pass_rate.py --reports reports --json ${{ env.SKIPLIST }} > pass_rate.json
159+
python3 scripts/pass_rate.py --reports reports --suite tutorials --json ${{ env.SKIPLIST }} > pass_rate_tutorials.json
160+
161+
- name: Report environment details
162+
run: |
163+
source ./scripts/capture-hw-details.sh --quiet
164+
cat <<EOF | tee .env
165+
TIMESTAMP=$(date '+%Y%m%d%H%M%S')
166+
GITHUB_RUN_ID=$GITHUB_RUN_ID
167+
GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER
168+
GITHUB_RUN_ATTEMPT=$GITHUB_RUN_ATTEMPT
169+
PYTHON_VERSION=${{ inputs.python_version }}
170+
PYTORCH_REPO=$PYTORCH_REPO
171+
PYTORCH_COMMIT_ID=$PYTORCH_COMMIT_ID
172+
PYTORCH_VERSION=$PYTORCH_VERSION
173+
TRITON_REPO=$GITHUB_REPOSITORY
174+
LIBIGC1_VERSION=$LIBIGC1_VERSION
175+
LEVEL_ZERO_VERSION=$LEVEL_ZERO_VERSION
176+
GPU_DEVICE=$GPU_DEVICE
177+
AGAMA_VERSION=$AGAMA_VERSION
178+
EOF
179+
180+
- name: Upload pass rate report
181+
# upload reports only for the default branch
182+
if: github.ref_name == 'main'
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: pass_rate-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
186+
path: pass_rate*.json
187+
188+
- name: Upload tutorials performance report
189+
uses: actions/upload-artifact@v4
190+
with:
191+
name: tutorials-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
192+
if-no-files-found: warn
193+
include-hidden-files: true
194+
path: |
195+
reports/*/*.csv
196+
.env
197+
198+
- name: Upload test reports
199+
if: inputs.upload_test_reports
200+
uses: actions/upload-artifact@v4
201+
with:
202+
name: test-reports-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
203+
path: reports

.github/workflows/conda-build-test.yml renamed to .github/workflows/conda-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
strategy:
7575
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
7676

77-
uses: ./.github/workflows/build-test-reusable.yml
77+
uses: ./.github/workflows/conda-test-reusable.yml
7878
with:
7979
driver_version: ${{ matrix.driver }}
8080
runner_label: ${{ inputs.runner_label }}

0 commit comments

Comments
 (0)