Skip to content

Commit d262fd3

Browse files
authored
Fix test_subprocess.py/test_print by installing and using dev PTI && enable PTI build on windows (#5406)
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent e39c908 commit d262fd3

File tree

7 files changed

+51
-10
lines changed

7 files changed

+51
-10
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ jobs:
255255
pip install intel_pti-*.whl
256256
PTI_LIBS_DIR=$(python ./scripts/pti_lib.py)
257257
ls $PTI_LIBS_DIR
258-
echo "PTI_LIBS_DIR=$PTI_LIBS_DIR" | tee -a $GITHUB_ENV
258+
echo "LD_LIBRARY_PATH=$PTI_LIBS_DIR:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
259259
260260
- name: Report environment details
261261
timeout-minutes: 1
@@ -294,7 +294,6 @@ jobs:
294294
- name: Run Proton tests
295295
if: matrix.suite == 'rest'
296296
run: |
297-
export LD_LIBRARY_PATH=${{ env.PTI_LIBS_DIR }}:$LD_LIBRARY_PATH
298297
cd third_party/proton/test
299298
pytest test_api.py test_cmd.py test_lib.py test_profile.py test_viewer.py --device xpu -s -v
300299
cd ..

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ jobs:
123123
pip install -U pybind11 cmake
124124
pip install -v '.[build,tests,tutorials]'
125125
126+
- name: Build && Install PTI
127+
run: |
128+
.venv\Scripts\activate.ps1
129+
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
130+
cd ${{ env.NEW_WORKSPACE }}
131+
bash -c './scripts/install-pti.sh --build-level-zero'
132+
$PTI_LIBS_DIR = python ./scripts/pti_lib.py
133+
ls $PTI_LIBS_DIR
134+
echo "PATH=$PTI_LIBS_DIR;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
135+
126136
- name: Triton version
127137
run: |
128138
.venv\Scripts\activate.ps1

.github/workflows/pip-test-windows.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ jobs:
101101
.venv\Scripts\activate.ps1
102102
python -c 'import triton; print(triton.__version__)'
103103
104+
- name: Build && Install PTI
105+
run: |
106+
.venv\Scripts\activate.ps1
107+
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
108+
cd ${{ env.NEW_WORKSPACE }}
109+
bash -c './scripts/install-pti.sh --build-level-zero'
110+
$PTI_LIBS_DIR = python ./scripts/pti_lib.py
111+
ls $PTI_LIBS_DIR
112+
echo "PATH=$PTI_LIBS_DIR;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
113+
104114
- name: Install test dependencies
105115
run: |
106116
.venv\Scripts\activate.ps1

.github/workflows/pip-test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ jobs:
5555
- name: Install Triton
5656
uses: ./.github/actions/setup-triton
5757

58+
- name: Build && Install PTI
59+
run: |
60+
./scripts/install-pti.sh --build-level-zero
61+
PTI_LIBS_DIR=$(python ./scripts/pti_lib.py)
62+
ls $PTI_LIBS_DIR
63+
echo "LD_LIBRARY_PATH=$PTI_LIBS_DIR:$LD_LIBRARY_PATH" | tee -a $GITHUB_ENV
64+
5865
- name: Install runtime dependencies
5966
run: |
6067
curl -sSLO --retry 10 https://raw.githubusercontent.com/pytorch/pytorch/$(<.github/pins/pytorch.txt)/.github/scripts/generate_binary_build_matrix.py

python/test/unit/language/test_subprocess.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ def test_print(func_type: str, data_type: str, device: str):
5353
return
5454

5555
outs = [line for line in proc.stdout.decode("UTF-8").splitlines() if line]
56-
# FIXME: workaround for DLE 2025.2, namely PTI 0.13.1
57-
# https://github.com/intel/intel-xpu-backend-for-triton/issues/4998
58-
outs = filter(lambda elem: "Another subscriber already subscribed to Sycl runtime events" not in elem, outs)
5956
# The total number of elements in the 1-D tensor to print.
6057
N = 128
6158

scripts/install-pti.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,23 @@ function build_level_zero {
4343
LEVEL_ZERO_VERSION=1.24.2
4444
LEVEL_ZERO_SHA256=b77e6e28623134ee4e99e2321c127b554bdd5bfa3e80064922eba293041c6c52
4545

46-
wget --progress=dot:giga -e use_proxy=yes "https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz"
47-
echo "${LEVEL_ZERO_SHA256} v${LEVEL_ZERO_VERSION}.tar.gz" > "v${LEVEL_ZERO_VERSION}.tar.gz.sha256"
48-
sha256sum -c "v${LEVEL_ZERO_VERSION}.tar.gz.sha256"
46+
if [[ $OSTYPE = msys ]]; then
47+
pwsh -Command \
48+
"Invoke-WebRequest -Uri 'https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz' -OutFile 'v${LEVEL_ZERO_VERSION}.tar.gz'"
49+
ls . -alh
50+
FILE_HASH=$(pwsh -Command "Get-FileHash -Algorithm SHA256 v${LEVEL_ZERO_VERSION}.tar.gz | Select-Object -ExpandProperty Hash")
51+
# convert to lowercase
52+
FILE_HASH=${FILE_HASH,,}
53+
echo $FILE_HASH
54+
if [[ "$FILE_HASH" != "${LEVEL_ZERO_SHA256}" ]]; then
55+
echo "ERROR: Checksum does not match!"
56+
exit 1
57+
fi
58+
else
59+
wget "https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz"
60+
echo "${LEVEL_ZERO_SHA256} v${LEVEL_ZERO_VERSION}.tar.gz" > "v${LEVEL_ZERO_VERSION}.tar.gz.sha256"
61+
sha256sum -c "v${LEVEL_ZERO_VERSION}.tar.gz.sha256"
62+
fi
4963
tar -xf "v${LEVEL_ZERO_VERSION}.tar.gz"
5064
cd "level-zero-${LEVEL_ZERO_VERSION}"
5165
echo "${LEVEL_ZERO_VERSION}" | awk -F. '{print $3}' > VERSION_PATCH
@@ -56,7 +70,11 @@ function build_level_zero {
5670
cmake --build . --config Release --parallel "$(nproc)"
5771
cmake --build . --config Release --target install
5872
export LEVELZERO_INCLUDE_DIR="$L0_INSTALL_PATH/include"
59-
export LEVELZERO_LIBRARY="$L0_INSTALL_PATH/lib/libze_loader.so"
73+
if [[ $OSTYPE = msys ]]; then
74+
export LEVELZERO_LIBRARY="$L0_INSTALL_PATH/lib/ze_loader.lib"
75+
else
76+
export LEVELZERO_LIBRARY="$L0_INSTALL_PATH/lib/libze_loader.so"
77+
fi
6078
}
6179

6280
function build_pti {

scripts/pti_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def get_pti_lib_path() -> pathlib.Path:
1313
"""
1414
files = importlib.metadata.files('intel-pti') or []
1515
for f in files:
16-
if f.name == 'libpti_view.so':
16+
if f.name in ('libpti_view.so', 'pti_view.lib'):
1717
return pathlib.Path(f.locate()).parent.resolve()
1818
raise AssertionError('libpti_view.so not found')
1919

0 commit comments

Comments
 (0)