Skip to content

Commit a7016dd

Browse files
authored
Merge branch 'main' into tkuczynski/enable_test_device_assert
2 parents 6dfd8ff + 444bccd commit a7016dd

File tree

10 files changed

+254
-21
lines changed

10 files changed

+254
-21
lines changed

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

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ jobs:
127127
DEBUG=1
128128
python -m build --wheel --no-isolation && pip install dist/*.whl
129129
130+
- name: Build PTI
131+
run: |
132+
./scripts/install-pti.sh --build-level-zero
133+
130134
- name: Set test-triton command line
131135
id: test-triton
132136
run: |
@@ -175,6 +179,12 @@ jobs:
175179
name: triton-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
176180
path: dist/*.whl
177181

182+
- name: Upload PTI wheels
183+
uses: actions/upload-artifact@v4
184+
with:
185+
name: pti-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
186+
path: .scripts_cache/pti/dist/*.whl
187+
178188
- name: Upload test reports
179189
uses: actions/upload-artifact@v5
180190
with:
@@ -242,11 +252,23 @@ jobs:
242252
with:
243253
name: triton-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
244254

255+
- name: Download PTI wheels
256+
uses: actions/download-artifact@v5
257+
with:
258+
name: pti-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
259+
245260
- name: Install Triton
246261
run: |
247262
pip install triton-*.whl
248263
python -c 'import triton; print(triton.__version__)'
249264
265+
- name: Install PTI
266+
run: |
267+
pip install intel_pti-*.whl
268+
PTI_LIBS_DIR=$(python ./scripts/pti_lib.py)
269+
ls $PTI_LIBS_DIR
270+
echo "PTI_LIBS_DIR=$PTI_LIBS_DIR" | tee -a $GITHUB_ENV
271+
250272
- name: Report environment details
251273
run: |
252274
if [ "${{ matrix.suite }}" == "minicore" ]; then
@@ -283,21 +305,7 @@ jobs:
283305
- name: Build PTI && Run Proton tests
284306
if: matrix.suite == 'rest'
285307
run: |
286-
# `intel-pti` can be installed in "Setup PyTorch" step with `pytorch_mode==wheels`
287-
pip uninstall intel-pti -y
288-
PTI_COMMIT_ID="$(<.github/pins/pti.txt)"
289-
git clone https://github.com/intel/pti-gpu.git
290-
cd pti-gpu
291-
git checkout $PTI_COMMIT_ID
292-
cd sdk
293-
cmake --preset linux-icpx-release
294-
BUILD_TESTING=1 PTI_BUILD_SAMPLES=1 cmake --build --preset linux-icpx-release
295-
296-
PTI_LIBS_DIR="$(pwd)/build-linux-icpx-release/lib/"
297-
cd ../..
298-
299-
export LD_LIBRARY_PATH=$PTI_LIBS_DIR:$LD_LIBRARY_PATH
300-
export TRITON_XPUPTI_LIB_PATH=$PTI_LIBS_DIR
308+
export LD_LIBRARY_PATH=${{ env.PTI_LIBS_DIR }}:$LD_LIBRARY_PATH
301309
cd third_party/proton/test
302310
pytest test_api.py test_cmd.py test_lib.py test_profile.py test_viewer.py --device xpu -s -v
303311
cd ..

.github/workflows/e2e-reusable.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140

141141
- name: Install python test dependencies
142142
run: |
143-
pip install pyyaml pandas scipy 'numpy==1.26.4' psutil pyre_extensions torchrec
143+
pip install pyyaml pandas scipy psutil
144144
145145
- name: Install transformers package
146146
if: ${{ inputs.suite == 'huggingface' }}
@@ -189,11 +189,19 @@ jobs:
189189
if: ${{ inputs.suite == 'torchbench' }}
190190
run: |
191191
cd benchmark
192+
sed -i 's/^ *pynvml.*//' requirements.txt
193+
pip install -r requirements.txt
194+
# for dlrm
195+
pip install pyre-extensions
196+
curl -fsSL https://raw.githubusercontent.com/facebookresearch/dlrm/refs/heads/torchrec-dlrm/requirements.txt |xargs pip install
197+
# for soft_actor_critic, temp fix
198+
pip install git+https://github.com/nocoding03/gym@fix-np
199+
192200
if [[ "${{ inputs.only_one_model }}" ]]; then
193201
python install.py "${{ inputs.only_one_model }}"
194202
else
195203
# install all models
196-
python install.py
204+
python install.py --continue_on_fail
197205
fi
198206
pip install -e .
199207
@@ -203,6 +211,9 @@ jobs:
203211
run: |
204212
cd pytorch
205213
214+
# Some models are still not compatible with numpy>2.0
215+
pip install 'numpy==1.26.4'
216+
206217
export WORKSPACE=$GITHUB_WORKSPACE
207218
208219
if [[ "${{ inputs.TORCH_COMPILE_DEBUG }}" = "1" ]] ; then

python/test/unit/language/test_core.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,8 +3272,6 @@ def test_dot(M, N, K, num_warps, col_a, col_b, epilogue, input_precision, in_dty
32723272
pytest.xfail(f"input_precision {input_precision} is not supported in the interpreter")
32733273
else:
32743274
if is_xpu():
3275-
if input_precision in ("bf16x3", "bf16x6"):
3276-
pytest.skip(f"input_precision {input_precision} is not supported")
32773275
if (M < 8 or N < 16 or (K < 16 and in_dtype == 'float16') or (K < 8 and in_dtype == 'float32')):
32783276
pytest.xfail("XPU: small dots are not supported")
32793277
elif not is_hip() and K < 16:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
3+
project(
4+
pti-python-binaries
5+
VERSION 0.0.1
6+
LANGUAGES C CXX)
7+
8+
include(FetchContent)
9+
10+
if(DEFINED ENV{PTI_PINNED_COMMIT})
11+
set(PTI_PINNED_COMMIT $ENV{PTI_PINNED_COMMIT})
12+
else()
13+
message(FATAL_ERROR "PTI_PINNED_COMMIT env var not defined")
14+
endif()
15+
16+
if(DEFINED ENV{LEVELZERO_INCLUDE_DIR})
17+
set(LevelZero_INCLUDE_DIR "$ENV{LEVELZERO_INCLUDE_DIR}")
18+
else()
19+
message(STATUS "LEVELZERO_INCLUDE_DIR env var not defined; try to use system version")
20+
endif()
21+
22+
if(DEFINED ENV{LEVELZERO_LIBRARY})
23+
set(LevelZero_LIBRARY "$ENV{LEVELZERO_LIBRARY}")
24+
else()
25+
message(STATUS "LEVELZERO_LIBRARY env var not defined; try to use system version")
26+
endif()
27+
28+
FetchContent_Declare(
29+
pti-lib
30+
GIT_REPOSITORY https://github.com/intel/pti-gpu.git
31+
GIT_TAG ${PTI_PINNED_COMMIT}
32+
SOURCE_SUBDIR sdk
33+
)
34+
35+
if(NOT APPLE)
36+
list(APPEND CMAKE_INSTALL_RPATH $ORIGIN)
37+
endif()
38+
39+
# Sets the installation directories to be inside the root of the virtual
40+
# environment, .e.g., .venv/lib/libpti_view.so (note: this is non-standard).
41+
# However, this is what other oneAPI components and PyTorch XPU (Intel backend)
42+
# expects.
43+
set(CMAKE_INSTALL_LIBDIR "${SKBUILD_DATA_DIR}/lib")
44+
set(CMAKE_INSTALL_INCLUDEDIR "${SKBUILD_DATA_DIR}/include")
45+
set(CMAKE_INSTALL_BINDIR "${SKBUILD_DATA_DIR}/bin")
46+
set(CMAKE_INSTALL_DOCDIR "${SKBUILD_DATA_DIR}/share")
47+
48+
49+
FetchContent_MakeAvailable(pti-lib)

scripts/build_pti_data/README.md

Whitespace-only changes.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[project]
2+
name = "intel-pti"
3+
version = "0.14.0.dev1"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
license = "MIT"
7+
8+
requires-python = ">=3.9"
9+
dependencies = []
10+
classifiers = [
11+
"Development Status :: 5 - Production/Stable",
12+
13+
# Indicate who your project is intended for
14+
"Intended Audience :: Developers",
15+
"Intended Audience :: Education",
16+
"Intended Audience :: Science/Research",
17+
"Intended Audience :: System Administrators",
18+
"Intended Audience :: Other Audience",
19+
20+
"Topic :: Software Development :: Libraries",
21+
22+
"Operating System :: Microsoft :: Windows",
23+
"Operating System :: POSIX :: Linux",
24+
25+
"Environment :: GPU",
26+
]
27+
28+
[tool.scikit-build]
29+
build.verbose = true
30+
logging.level = "INFO"
31+
cmake.version = ">=3.20.0"
32+
cmake.build-type = "Release"
33+
cmake.args = ["-GNinja"]
34+
ninja.version = ">=1.13"
35+
minimum-version = "build-system.requires"
36+
sdist.exclude = ["levelzero", "level-zero", "src"]
37+
38+
[tool.uv]
39+
cache-keys = [{ file = "pyproject.toml" }, { file = "CMakeLists.txt" }]
40+
41+
[build-system]
42+
requires = ["scikit-build-core>=0.10"]
43+
build-backend = "scikit_build_core.build"
44+
45+
[project.urls]
46+
Homepage = "https://github.com/intel/pti-gpu/tree/master/sdk"
47+
Documentation = "https://github.com/intel/pti-gpu/blob/master/sdk/README.md"
48+
Repository = "https://github.com/intel/pti-gpu"
49+
Issues = "https://github.com/intel/pti-gpu/issues"

scripts/install-pti.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# Select what to build.
6+
BUILD_LEVEL_ZERO=false
7+
for arg in "$@"; do
8+
case $arg in
9+
--build-level-zero)
10+
BUILD_LEVEL_ZERO=true
11+
shift
12+
;;
13+
--help)
14+
echo "Example usage: ./install-pti.sh [--build-level-zero]"
15+
exit 1
16+
;;
17+
*)
18+
echo "Unknown argument: $arg."
19+
exit 1
20+
;;
21+
esac
22+
done
23+
24+
25+
# Configure, build and install PyTorch from source.
26+
27+
# intel-xpu-backend-for-triton project root
28+
ROOT=$(cd "$(dirname "$0")/.." && pwd)
29+
30+
SCRIPTS_DIR=$ROOT/scripts
31+
PTI_PROJ=$ROOT/.scripts_cache/pti
32+
LEVEL_ZERO_PROJ=$ROOT/.scripts_cache/level_zero_for_pti
33+
BASE=$(dirname "$PTI_PROJ")
34+
35+
echo "**** BASE is set to $BASE ****"
36+
echo "**** PTI_PROJ is set to $PTI_PROJ ****"
37+
mkdir -p $BASE
38+
39+
function build_level_zero {
40+
rm -rf "$LEVEL_ZERO_PROJ"
41+
mkdir -p "$LEVEL_ZERO_PROJ"
42+
cd "$LEVEL_ZERO_PROJ"
43+
LEVEL_ZERO_VERSION=1.24.2
44+
LEVEL_ZERO_SHA256=b77e6e28623134ee4e99e2321c127b554bdd5bfa3e80064922eba293041c6c52
45+
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"
49+
tar -xf "v${LEVEL_ZERO_VERSION}.tar.gz"
50+
cd "level-zero-${LEVEL_ZERO_VERSION}"
51+
echo "${LEVEL_ZERO_VERSION}" | awk -F. '{print $3}' > VERSION_PATCH
52+
mkdir build
53+
cd build
54+
cmake .. -DCMAKE_BUILD_TYPE=Release
55+
cmake --build . --config Release --parallel "$(nproc)"
56+
# cmake --build . --config Release --target install
57+
export LEVELZERO_INCLUDE_DIR="$LEVEL_ZERO_PROJ/level-zero-${LEVEL_ZERO_VERSION}"
58+
export LEVELZERO_LIBRARY="$LEVEL_ZERO_PROJ/level-zero-${LEVEL_ZERO_VERSION}/build/lib/libze_loader.so"
59+
}
60+
61+
function build_pti {
62+
rm -rf "$PTI_PROJ"
63+
mkdir -p "$PTI_PROJ"
64+
65+
echo "****** Building $PTI_PROJ ******"
66+
cd "$PTI_PROJ"
67+
cp "$SCRIPTS_DIR"/build_pti_data/* .
68+
pip install uv
69+
70+
export PTI_PINNED_COMMIT="$(<$ROOT/.github/pins/pti.txt)"
71+
72+
uv version 0.14.0.dev1
73+
uv build
74+
}
75+
76+
function install_pti {
77+
echo "****** Installing PTI ******"
78+
cd "$PTI_PROJ"
79+
pip install dist/*.whl
80+
}
81+
82+
if [ "$BUILD_LEVEL_ZERO" = true ]; then
83+
build_level_zero
84+
fi
85+
86+
build_pti
87+
install_pti

scripts/pti_lib.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""Prints a lib directory for pti."""
2+
3+
import importlib.metadata
4+
import pathlib
5+
6+
7+
def get_pti_lib_path() -> pathlib.Path:
8+
"""Returns library path for pti.
9+
10+
Raises:
11+
importlib.metadata.PackageNotFoundError: if 'intel-pti' not installed.
12+
AssertionError: if libpti_view.so not found.
13+
"""
14+
files = importlib.metadata.files('intel-pti') or []
15+
for f in files:
16+
if f.name == 'libpti_view.so':
17+
return pathlib.Path(f.locate()).parent.resolve()
18+
raise AssertionError('libpti_view.so not found')
19+
20+
21+
if __name__ == '__main__':
22+
print(get_pti_lib_path())

third_party/intel/backend/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class XPUOptions:
3030
supported_fp8_dtypes: Tuple[str] = ("fp8e5", "fp8e4nv", "fp8e4b15")
3131
deprecated_fp8_dot_operand_dtypes: Tuple[str] = ()
3232
default_dot_input_precision: str = "tf32"
33-
allowed_dot_input_precisions: Tuple[str] = ("tf32", "tf32x3", "ieee")
33+
allowed_dot_input_precisions: Tuple[str] = ("tf32", "tf32x3", "ieee", 'bf16x3', 'bf16x6')
3434
allow_fp8e4nv: bool = False
3535
allow_fp8e4b15: bool = True
3636
grf_mode: tuple = ('small', 'large', 'auto', 'default')

third_party/proton/proton/profile.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
from typing import Optional, Union
2+
import importlib.metadata
3+
import pathlib
4+
import os
15
import functools
26
import triton
37

@@ -6,7 +10,6 @@
610
from .flags import flags
711
from .hooks import HookManager, LaunchHook, InstrumentationHook
812
from .mode import BaseMode
9-
from typing import Optional, Union
1013

1114
DEFAULT_PROFILE_NAME = "proton"
1215
UTILS_CACHE_PATH = None
@@ -21,6 +24,12 @@ def _select_backend() -> str:
2124
elif backend == "xpu":
2225
global UTILS_CACHE_PATH
2326
UTILS_CACHE_PATH = triton.runtime.driver.active.build_proton_help_lib()
27+
files = importlib.metadata.files('intel-pti')
28+
if files is not None:
29+
for f in files:
30+
if f.name == 'libpti_view.so':
31+
os.environ["TRITON_XPUPTI_LIB_PATH"] = str(pathlib.Path(f.locate()).parent.resolve())
32+
break
2433
return "xpupti"
2534
else:
2635
raise ValueError("No backend is available for the current target.")

0 commit comments

Comments
 (0)