Skip to content

Commit 60279d8

Browse files
authored
GTA asset creation (#645)
1 parent a8dfc3b commit 60279d8

18 files changed

+2943
-118
lines changed

.github/workflows/build-gta-test-runner.yaml

Lines changed: 58 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
- self-hosted
2727
- linux
2828
- cpu-generic
29-
defaults:
30-
run:
31-
shell: bash -noprofile --norc -eo pipefail -c "source /opt/intel/oneapi/setvars.sh > /dev/null; source {0}"
29+
# defaults:
30+
# run:
31+
# shell: bash -noprofile --norc -eo pipefail -c "source /opt/intel/oneapi/setvars.sh > /dev/null; source {0}"
3232
steps:
3333
- name: Checkout repository
3434
uses: actions/checkout@v4
@@ -53,8 +53,9 @@ jobs:
5353
run: |
5454
# PYTHON_VERSION=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
5555
REPO="intel/intel-xpu-backend-for-triton"
56-
RUN_ID=$(gh run list --workflow nightly-wheels.yml -R "$REPO" --json databaseId,conclusion | jq -r '[.[] | select(.conclusion=="success")][0].databaseId')
56+
RUN_ID=$(gh run list --workflow nightly-wheels.yml -R "$REPO" --branch main --json databaseId,conclusion | jq -r '[.[] | select(.conclusion=="success")][0].databaseId')
5757
echo "Run id - $RUN_ID"
58+
echo "RUN_ID=$RUN_ID" >> $GITHUB_ENV
5859
mkdir -p wheels
5960
WHEEL_PATTERN="wheels-pytorch-py${PYTHON_VERSION}*"
6061
echo "WHEEL_PATTERN=$WHEEL_PATTERN"
@@ -75,55 +76,79 @@ jobs:
7576
pip install packaging
7677
pip install wheels/*
7778
TRITON_COMMIT=$(python -c "import importlib.metadata; import packaging.version; print(packaging.version.Version(importlib.metadata.version('triton')).local[3:])")
78-
git clone --single-branch -b main --recurse-submodules https://github.com/intel/intel-xpu-backend-for-triton.git
79-
cd intel-xpu-backend-for-triton
79+
git clone --single-branch -b main --recurse-submodules https://github.com/intel/intel-xpu-backend-for-triton.git snapshot
80+
cd snapshot
81+
echo "Checking out Triton commit $TRITON_COMMIT"
8082
git checkout "$TRITON_COMMIT"
8183
82-
- name: Setup Triton kernels benchmark
83-
uses: ./.github/actions/setup-triton-kernels-benchmark
84-
with:
85-
clone_repo: false
86-
conda_env: wheels
84+
# TODO: https://github.com/intel-tools/intel-xpu-backend-for-triton/issues/501
85+
# - name: Setup Triton kernels benchmark
86+
# uses: ./.github/actions/setup-triton-kernels-benchmark
87+
# with:
88+
# clone_repo: false
89+
# conda_env: wheels
8790

8891
- name: Prepare all binary artifacts to be packaged in the installer
92+
env:
93+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8994
run: |
9095
source ~/miniforge3/bin/activate
9196
9297
conda activate wheels
9398
94-
pip install -r intel-xpu-backend-for-triton/scripts/requirements-test.txt
99+
gh auth status
100+
101+
pip install -r scripts/requirements-test.txt
95102
pip install defusedxml
96103
97104
pip install build
98-
cd intel-xpu-backend-for-triton/scripts/triton_utils
105+
cd scripts/triton_utils
99106
python -m build --wheel
100107
pip install dist/triton_utils-*.whl
101-
cd ../../..
102-
cp intel-xpu-backend-for-triton/scripts/triton_utils/dist/*.whl wheels/
108+
cd ../..
109+
cp scripts/triton_utils/dist/*.whl wheels/
110+
111+
# TODO: use pinned nightly gh run id from step "Get nightly wheels" instead of latest
112+
python scripts/gta_integration/constructor/abn_metadata.py
103113
104-
pip uninstall -y torch triton triton-kernels-benchmark triton_utils
114+
# TODO: https://github.com/intel-tools/intel-xpu-backend-for-triton/issues/501
115+
# pip uninstall -y torch triton triton-kernels-benchmark triton_utils
116+
pip uninstall -y torch triton triton_utils
105117
pip freeze >requirements-offline.txt
106118
pip download -r requirements-offline.txt -d wheels
107119
108120
# Create Triton test env wheels and repo tarballs
109-
cp -L intel-xpu-backend-for-triton/benchmarks/dist/*.whl wheels/
121+
# TODO: https://github.com/intel-tools/intel-xpu-backend-for-triton/issues/501
122+
# cp -L intel-xpu-backend-for-triton/benchmarks/dist/*.whl wheels/
123+
cp scripts/gta_integration/constructor/test_triton.py snapshot/scripts/test_triton.py
124+
cp scripts/gta_integration/constructor/test_triton_config.json snapshot/scripts/test_triton_config.json
110125
tar -czvf wheels.tar.gz wheels
111-
tar -czvf intel-xpu-backend-for-triton.tar.gz intel-xpu-backend-for-triton
126+
tar -czvf intel-xpu-backend-for-triton.tar.gz snapshot
112127
113128
# Download DLE and Vulkan SDK
114129
wget -O intel-deep-learning-essentials_offline.sh "${ONEAPI_DOWNLOAD_URL}${DLE_INSTALLER}"
115130
wget -O vulkan-sdk.tar.xz https://sdk.lunarg.com/sdk/download/latest/linux/vulkan-sdk.tar.xz
116131
117-
# Prepare run_triton_tests.sh script for upload
118-
cp gta_integration/constructor/run_triton_tests.sh .
119-
# cp scripts/pass_rate_utils.py .
132+
- name: Upload test reports
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: test_reports
136+
path: |
137+
reports-nightly/**
138+
139+
- name: Upload abn_metadata
140+
uses: actions/upload-artifact@v4
141+
with:
142+
name: abn_metadata
143+
path: |
144+
abn_metadata.json
120145
121146
- name: Build constructor installer
122147
run: |
123148
source ~/miniforge3/bin/activate
124149
conda create -n constructor python=$PYTHON_VERSION constructor
125150
conda activate constructor
126-
constructor gta_integration/constructor/
151+
constructor scripts/gta_integration/constructor/
127152
128153
- name: Upload built installer artifact and tests runner script
129154
uses: actions/upload-artifact@v4
@@ -133,99 +158,14 @@ jobs:
133158
TritonXPU-GTA.sh
134159
run_triton_tests.sh
135160
136-
137-
test-installer:
138-
name: Test GTA installer
139-
needs: [build-installer]
140-
runs-on:
141-
- glados
142-
- pvc
143-
144-
strategy:
145-
matrix:
146-
suite:
147-
- language
148-
# - triton-benchmarks
149-
# - tutorials
150-
151-
steps:
152-
- name: Checkout repository
153-
uses: actions/checkout@v4
154-
155-
- name: Download built installer artifact
156-
uses: actions/download-artifact@v4
157-
with:
158-
name: triton-xpu-installer
159-
160-
- name: Install Python
161-
uses: actions/setup-python@v5
162-
with:
163-
python-version: ${{ inputs.python }}
164-
165-
- name: Run the installer in silent mode
166-
continue-on-error: true
167-
run: |
168-
sudo rm -rf /home/runner/intel
169-
# FIX for the offline installer issue - https://jira.devtools.intel.com/browse/INST-26161
170-
sudo chown -R runner:runner /tmp/runner
171-
export LC_ALL=C.UTF-8
172-
/bin/sh -x TritonXPU-GTA.sh -b
173-
174-
- name: Run ${{ matrix.suite }} tests
175-
continue-on-error: true
176-
run: |
177-
bash -x run_triton_tests.sh ${{ matrix.suite }}
178-
179-
- name: Upload test reports
180-
uses: actions/upload-artifact@v4
181-
with:
182-
name: test_reports_${{ matrix.suite }}
183-
path: |
184-
/home/runner/reports/*.xml
185-
/home/runner/reports/**/*.csv
186-
187-
188-
# test-installer-benchmarks:
189-
# name: Generate abn_metadata.json
190-
# needs: [test-installer]
191-
# runs-on:
192-
# - glados
193-
194-
# steps:
195-
# - name: Checkout repository
196-
# uses: actions/checkout@v4
197-
198-
# - name: Install Python
199-
# uses: actions/setup-python@v5
200-
# with:
201-
# python-version: ${{ inputs.python }}
202-
203-
# - name: Download all matrix test reports
204-
# uses: actions/download-artifact@v4
205-
# with:
206-
# pattern: test_reports_*
207-
# path: reports
208-
# merge-multiple: true
209-
210-
# # - name: Merge downloaded report files
211-
# # run: |
212-
# # mkdir -p reports
213-
# # for entry in reports_raw/*; do
214-
# # if [ -d "$entry" ]; then
215-
# # cp "$entry"/* reports/ 2>/dev/null || true
216-
# # elif [ -f "$entry" ]; then
217-
# # cp "$entry" reports/ 2>/dev/null || true
218-
# # fi
219-
# # done
220-
221-
# - name: Generate abn_metadata.json
222-
# run: |
223-
# pip install defusedxml
224-
# python scripts/pass_rate_utils.py --reports reports
225-
226-
# - name: Upload generated abn_metadata.json
227-
# uses: actions/upload-artifact@v4
228-
# with:
229-
# name: testmetadata
230-
# path: |
231-
# abn_metadata.json
161+
# - name: Upload asset to GTA artifactory
162+
# run: |
163+
# TIMESTAMP=$(date '+%Y%m%d_%H-%M-%S')
164+
# echo "TIMESTAMP=$TIMESTAMP" >> "${GITHUB_ENV}"
165+
# mkdir triton-xpu-installer
166+
# mv TritonXPU-GTA.sh triton-xpu-installer/
167+
# mv run_triton_tests.sh triton-xpu-installer/
168+
# mv abn_metadata.json triton-xpu-installer/
169+
# /gta/gta-asset push gfx-ocl-abn-assets-igk/oneAPI/linux triton-xpu ${{ env.TIMESTAMP }} triton-xpu-installer \
170+
# --root-url=https://gfx-assets.igk.intel.com/ \
171+
# -u glados --password ${{ secrets.GLADOS_DEVTOOLS_ARTIFACTORY_TOKEN }}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Targeted use cases
2+
3+
## 1. Functional regression testing for Dev IGC, NEO and Agama / Koubuk (Rolling) builds
4+
## 2. Functional issues bisection by GTA Validation Team
5+
## 3. Functional issues bisection by GTA Validation Team / IGC Team
6+
## 4. Triton Env creation IGC Team
7+
8+
# Requirements
9+
10+
## 1. Self contained one file installer which should include everything needed to run Triton UT and Tutorials which should include:
11+
12+
Assumptions on the runtime:
13+
14+
- Bare metal machine
15+
- Vanilla OS installation - Ubuntu 22.04 only in the initial implementation
16+
- GPU HW - PVC / BMG
17+
- GPU drivers are installed (UMD and KMD)
18+
19+
### 1.1 Python, to be independent of the system Python version
20+
21+
- Use minimal supported Python version. 3.10 as of now
22+
23+
### 1.2 Triton wheel for the selected Python version
24+
25+
- Use wheel from the latest nightly set
26+
27+
### 1.3 Triton test / scripts set which matches Triton wheel by commit id
28+
29+
- Implementation approach: include repo snapshot by commit id
30+
31+
### 1.4 Matching nightly pytorch wheel
32+
33+
- Use wheel from the latest nightly set
34+
35+
### 1.5 Matching oneAPI package (DLE)
36+
37+
- Publicly available latest DDLE and PTI versions should be used, use of the pre-release bits is out of scope for the initial implementation
38+
39+
### 1.6 All PyPI wheels which are needed by Triton / PyTorch runtimes plus test dependencies
40+
41+
- Implementation approach: create full env, remove triton and pytorch packages, run pip freeze and pip download
42+
43+
### 1.7 ABN metadata for GTA
44+
45+
- [Old approach] Generate ABN metadata based on installer test results
46+
- [New approach] Generate ABN metadata based on the test reports for nightly wheels by commit id
47+
48+
## 2. GTA technical integration
49+
50+
### 2.1 Documentation / Links
51+
52+
- https://wiki.ith.intel.com/display/VPGOpenCL/Creating+GTA+TI+using+DynamicTest
53+
- https://wiki.ith.intel.com/display/VPGOpenCL/Requests+to+Compute+PostSI+Validation
54+
- Initial integration request: https://jira.devtools.intel.com/browse/VCV-12520
55+
56+
### 2.2 GTA asset upload
57+
58+
Assets to upload:
59+
60+
- self-contained installer
61+
- run_triton_tests.sh
62+
- pass_rate_utils.py
63+
- abn_metadata.json
64+
65+
Command to upload:
66+
67+
```
68+
gta-asset push gfx-ocl-abn-assets-igk/oneAPI/linux triton-xpu 2024100801 triton-xpu-installer --user vpenkin --root-url=https://gfx-assets.igk.intel.com/artifactory
69+
```
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import argparse
2+
from pathlib import Path
3+
4+
import json
5+
6+
import triton_utils
7+
8+
9+
def normalize_key(raw_key: str) -> str:
10+
return raw_key.replace("::", "__").replace("/", "_").replace(".", "___")
11+
12+
13+
def main():
14+
parser = argparse.ArgumentParser()
15+
parser.add_argument(
16+
"--reports",
17+
"--r",
18+
type=str,
19+
required=False,
20+
default="reports-nightly",
21+
help="Path to the reports folder",
22+
)
23+
args = parser.parse_args()
24+
25+
script_dir = Path(__file__).parent
26+
json_path = script_dir / "test_triton_config.json"
27+
with json_path.open("r", encoding="utf-8") as f:
28+
test_triton_config = json.load(f)
29+
30+
ignore_testsuites = list(test_triton_config["exclude"].keys())
31+
32+
config = triton_utils.Config(
33+
status_filter=["passed"],
34+
ignore_testsuite_filter=ignore_testsuites,
35+
_download_dir=args.reports,
36+
reports=args.reports,
37+
tests_with_multiple_testsuites=True,
38+
merge_test_results=True,
39+
file_name="abn_metadata.json",
40+
latest_nightly_gh_run=True,
41+
_report_grouping_level="testsuite",
42+
)
43+
triton_utils.DownloadReportsActionRunner(config)()
44+
report = triton_utils.PassRateActionRunner(config)
45+
print(report.summary)
46+
print(report.summary_detailed)
47+
tests = list(report.tests)
48+
json_data = {}
49+
# Remove this after the option to run tutorials as pytest tests will be added
50+
tests.append(triton_utils.Test(testsuite="tutorials", testname="all_tutorials"))
51+
for test in tests:
52+
json_data[normalize_key(f"{test.testsuite}__{test.testname}")] = {
53+
"api": "L0",
54+
"commandLine": f"run_triton_tests.sh --suite {test.testsuite} --test {test.testname}",
55+
"validReturnCodes": [0],
56+
"passRatesFunctionalCheck": True,
57+
"passRatesRegex": {
58+
"blockCount": "",
59+
"errorCount": "",
60+
"failCount": 'failed": (\\d+)',
61+
"passCount": 'passed": (\\d+)',
62+
"skipCount": "",
63+
"totalCount": "",
64+
},
65+
}
66+
with open(config.file_name, "w", encoding="utf-8") as f:
67+
json.dump(json_data, f, indent=4)
68+
69+
70+
if __name__ == "__main__":
71+
main()

0 commit comments

Comments
 (0)