mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[CD] Enable triton xpu windows build (#147637)
Depends on #147727, which introduce triton xpu windows support Pull Request resolved: https://github.com/pytorch/pytorch/pull/147637 Approved by: https://github.com/atalman
This commit is contained in:
committed by
PyTorch MergeBot
parent
f7c0c230b0
commit
5f1c79ba2b
17
.github/scripts/windows/build_triton.bat
vendored
Normal file
17
.github/scripts/windows/build_triton.bat
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@echo on
|
||||
|
||||
set PYTHON_PREFIX=%PY_VERS:.=%
|
||||
set PYTHON_PREFIX=py%PYTHON_PREFIX:;=;py%
|
||||
call .ci/pytorch/win-test-helpers/installation-helpers/activate_miniconda3.bat
|
||||
:: Create a new conda environment
|
||||
if "%PY_VERS%" == "3.13t" (
|
||||
call conda create -n %PYTHON_PREFIX% -y -c=conda-forge python-freethreading python=3.13
|
||||
) else (
|
||||
call conda create -n %PYTHON_PREFIX% -y -c=conda-forge python=%PY_VERS%
|
||||
)
|
||||
call conda run -n %PYTHON_PREFIX% pip install wheel pybind11 certifi cython cmake setuptools==72.1.0 ninja
|
||||
|
||||
dir "%VC_INSTALL_PATH%"
|
||||
|
||||
call "%VC_INSTALL_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x64
|
||||
call conda run -n %PYTHON_PREFIX% python .github/scripts/build_triton_wheel.py --device=%BUILD_DEVICE% %RELEASE%
|
35
.github/scripts/windows/install_vs2022.ps1
vendored
Normal file
35
.github/scripts/windows/install_vs2022.ps1
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
# Enable long paths on Windows
|
||||
Set-ItemProperty -Path "HKLM:\\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1
|
||||
|
||||
$VC_VERSION_major = [int] ${env:VC_VERSION}.split(".")[0]
|
||||
$VC_DOWNLOAD_LINK = "https://aka.ms/vs/$VC_VERSION_major/release/vs_BuildTools.exe"
|
||||
$VC_INSTALL_ARGS = @("--nocache","--quiet","--norestart","--wait", "--add Microsoft.VisualStudio.Workload.VCTools",
|
||||
"--add Microsoft.Component.MSBuild",
|
||||
"--add Microsoft.VisualStudio.Component.Roslyn.Compiler",
|
||||
"--add Microsoft.VisualStudio.Component.TextTemplating",
|
||||
"--add Microsoft.VisualStudio.Component.VC.CoreBuildTools",
|
||||
"--add Microsoft.VisualStudio.Component.VC.CoreIde",
|
||||
"--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
|
||||
"--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
|
||||
"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||
"--add Microsoft.VisualStudio.Component.Windows11SDK.22621")
|
||||
|
||||
|
||||
echo "Downloading Visual Studio installer from $VC_DOWNLOAD_LINK."
|
||||
curl.exe --retry 3 -kL $VC_DOWNLOAD_LINK --output vs_installer.exe
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
echo "Download of the VS ${env:VC_YEAR} Version ${env:VC_VERSION} installer failed"
|
||||
exit 1
|
||||
}
|
||||
$InstallationPath = ${env:VC_INSTALL_PATH}
|
||||
$VC_INSTALL_ARGS = "--installPath `"$InstallationPath`"" + " " + $VC_INSTALL_ARGS
|
||||
echo "Installing Visual Studio version ${env:VC_VERSION} in $InstallationPath."
|
||||
$process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VC_INSTALL_ARGS -NoNewWindow -Wait -PassThru
|
||||
Remove-Item -Path vs_installer.exe -Force
|
||||
$exitCode = $process.ExitCode
|
||||
if (($exitCode -ne 0) -and ($exitCode -ne 3010)) {
|
||||
echo "VS ${env:VC_YEAR} installer exited with code $exitCode, which should be one of [0, 3010]."
|
||||
exit 1
|
||||
}
|
89
.github/workflows/build-triton-wheel.yml
vendored
89
.github/workflows/build-triton-wheel.yml
vendored
@ -155,9 +155,96 @@ jobs:
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
if: always()
|
||||
|
||||
build-wheel-win:
|
||||
name: "Build Triton Windows Wheel"
|
||||
needs: get-label-type
|
||||
runs-on: "${{ needs.get-label-type.outputs.label-type }}windows.4xlarge"
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
py_vers: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t" ]
|
||||
device: ["xpu"]
|
||||
timeout-minutes: 40
|
||||
env:
|
||||
PY_VERS: ${{ matrix.py_vers }}
|
||||
BUILD_DEVICE: ${{ matrix.device }}
|
||||
VC_INSTALL_PATH: "C:\\MSVC-BuildTools-2022"
|
||||
steps:
|
||||
- name: Display EC2 information
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
function get_ec2_metadata() {
|
||||
# Pulled from instance metadata endpoint for EC2
|
||||
# see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
|
||||
category=$1
|
||||
curl -H "X-aws-ec2-metadata-token: $(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 30")" -fsSL "http://169.254.169.254/latest/meta-data/${category}"
|
||||
}
|
||||
echo "ami-id: $(get_ec2_metadata ami-id)"
|
||||
echo "instance-id: $(get_ec2_metadata instance-id)"
|
||||
echo "instance-type: $(get_ec2_metadata instance-type)"
|
||||
echo "system info $(uname -a)"
|
||||
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
continue-on-error: true
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Enable git long paths and symlinks on Windows and disable fsmonitor daemon
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global core.longpaths true
|
||||
git config --global core.symlinks true
|
||||
# https://git-scm.com/docs/git-fsmonitor--daemon. The daemon could lock
|
||||
# the directory on Windows and prevent GHA from checking out as reported
|
||||
# in https://github.com/actions/checkout/issues/1018
|
||||
git config --global core.fsmonitor false
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
submodules: false
|
||||
path: pytorch
|
||||
show-progress: false
|
||||
- name: Clean PyTorch checkout
|
||||
run: |
|
||||
# Remove any artifacts from the previous checkouts
|
||||
git clean -fxd
|
||||
working-directory: pytorch
|
||||
- name: Enable long paths on Windows and install VS2022 17.13.2
|
||||
env:
|
||||
VC_YEAR: 2022
|
||||
VC_VERSION: 17.13.2
|
||||
shell: bash
|
||||
working-directory: pytorch
|
||||
run: |
|
||||
powershell .github/scripts/windows/install_vs2022.ps1
|
||||
- name: Build Triton wheel
|
||||
env:
|
||||
IS_RELEASE_TAG: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
|
||||
working-directory: pytorch
|
||||
shell: bash
|
||||
run: |
|
||||
set -x
|
||||
export RELEASE=""
|
||||
if [[ "${IS_RELEASE_TAG}" == true ]]; then
|
||||
export RELEASE="--release"
|
||||
fi
|
||||
.github/scripts/windows/build_triton.bat
|
||||
mkdir -p "${RUNNER_TEMP}/artifacts/"
|
||||
mv ./*.whl "${RUNNER_TEMP}/artifacts/"
|
||||
|
||||
- uses: actions/upload-artifact@v4.4.0
|
||||
with:
|
||||
name: pytorch-triton-wheel-${{ matrix.py_vers }}-${{ matrix.device }}
|
||||
if-no-files-found: error
|
||||
path: ${{ runner.temp }}/artifacts/*
|
||||
|
||||
|
||||
upload-wheel:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build-wheel
|
||||
needs:
|
||||
- build-wheel
|
||||
- build-wheel-win
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
Reference in New Issue
Block a user