Intel® XPU Backend for Triton* support for Windows is currently experimental and requires compiling PyTorch and Intel® XPU Backend for Triton* from source.
-
Windows 11
-
GPU card
- Intel® Arc™ A-Series Graphics for Desktops
- Intel® Arc™ B-Series Graphics for Desktops
-
Latest GPU driver
In the following sections, all commands need to be executed in PowerShell.
Enable long paths for Windows file system.
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
Reboot your computer to apply the change to the file system.
Install Microsoft Visual Studio 2022 and make sure the following components are installed:
- Microsoft.VisualStudio.Component.VC.Tools.x86.x64
- Microsoft.VisualStudio.Component.Windows11SDK.22621
- Microsoft.VisualStudio.Component.VC.CMake.Project
Install the latest Intel® Deep Learning Essentials.
By default, it is installed to C:\Program Files (x86)\Intel\oneAPI
.
Identify Level Zero version installed with the GPU Driver:
(Get-Item C:\Windows\system32\ze_loader.dll).VersionInfo.ProductVersion
Find the corresponding release in https://github.com/oneapi-src/level-zero/releases, download its archive and extract to c:\level_zero
or other location.
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Restart your PowerShell session to make sure chocolatey
is properly initialized.
If you do not have a system Python installed at this step, you can install one with chocolatey
.
For example:
choco install python --version=3.9.13
Install git
with other POSIX tools, such as bash
:
choco install -y git.install --params "'/GitAndUnixToolsOnPath /WindowsTerminal /NoAutoCrlf'"
Restart your PowerShell session to make sure git
and other tools are properly initialized.
Enable symbolic links and long paths:
git config --global core.longpaths true
git config --global core.symlinks true
choco install -y ninja
The module Pscx is required for Invoke-BatchFile
, a command to call bat/cmd script and set environment variables in the existing PowerShell session.
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module Pscx -Scope CurrentUser -Force -AllowClobber
Clone repository:
git clone https://github.com/intel/intel-xpu-backend-for-triton.git
Create a new virtual environment:
cd intel-xpu-backend-for-triton
python -m venv .venv
Activate the virtual environment:
.venv\Scripts\activate.ps1
Initialize Intel® Deep Learning Essentials, for example:
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
Set ZE_PATH
to the location of Level Zero SDK, for example:
$env:ZE_PATH = "C:\level_zero"
Build and install PyTorch:
$env:CMAKE_SHARED_LINKER_FLAGS = "/FORCE:MULTIPLE"
$env:CMAKE_MODULE_LINKER_FLAGS = "/FORCE:MULTIPLE"
$env:CMAKE_EXE_LINKER_FLAGS = "/FORCE:MULTIPLE"
bash -c "./scripts/install-pytorch.sh --source"
Check that PyTorch is installed:
python -c 'import torch;print(torch.__version__)'
Install build dependencies:
pip install -U wheel pybind11 cython cmake 'setuptools>=65.6.1'
Build and install Triton:
cd python
pip install -v --no-build-isolation '.[build,tests,tutorials]'
cd ..
Check that Triton is installed:
python -c 'import triton; print(triton.__version__)'
In a new PowerShell session, make sure the current directory is intel-xpu-backend-for-triton
(a clone of the repository).
Initialize environment variables:
.venv\Scripts\activate.ps1
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
$env:ZE_PATH = "C:\level_zero"
Check that PyTorch and Triton are available:
python -c 'import torch;print(torch.__version__)'
python -c 'import triton; print(triton.__version__)'