|
| 1 | +name: Build with Open Source LLVM SYCL compiler on Windows |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + nightly-tag: |
| 9 | + description: "intel/llvm nightly tag, e.g. nightly-2026-11-03 (default: latest with a Windows build)" |
| 10 | + required: false |
| 11 | + default: "" |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + install-compiler: |
| 22 | + name: Build with nightly build of DPC++ toolchain on Windows |
| 23 | + runs-on: windows-latest |
| 24 | + timeout-minutes: 120 |
| 25 | + |
| 26 | + env: |
| 27 | + PINS: .github/sycl-build-deps.env |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout repo |
| 31 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 32 | + with: |
| 33 | + persist-credentials: false |
| 34 | + fetch-depth: 0 |
| 35 | + |
| 36 | + - name: Load pinned SYCL build deps |
| 37 | + shell: bash |
| 38 | + run: | |
| 39 | + set -euo pipefail |
| 40 | + # checkout may convert line endings to CRLF |
| 41 | + VARS=$(grep -E '^(DRIVER_PATH|WIN_OCLCPUEXP_FN)=' "${PINS}" | tr -d '\r' || true) |
| 42 | + if [[ $(wc -l <<< "${VARS}") -ne 2 ]]; then |
| 43 | + echo "::error::expected 2 pins in ${PINS}, got:" |
| 44 | + echo "${VARS}" |
| 45 | + exit 1 |
| 46 | + fi |
| 47 | + echo "${VARS}" | tee -a "${GITHUB_ENV}" |
| 48 | +
|
| 49 | + - name: Resolve nightly build |
| 50 | + shell: bash |
| 51 | + env: |
| 52 | + GH_TOKEN: ${{ github.token }} |
| 53 | + NIGHTLY_TAG: ${{ inputs.nightly-tag }} |
| 54 | + run: | |
| 55 | + set -euo pipefail |
| 56 | + if [[ -z "${NIGHTLY_TAG}" ]]; then |
| 57 | + NIGHTLY_TAG=$(gh api 'repos/intel/llvm/releases?per_page=30' \ |
| 58 | + --jq '[.[] | select(.tag_name | startswith("nightly-")) |
| 59 | + | select(any(.assets[]; .name == "sycl_windows.tar.gz"))][0].tag_name // empty') |
| 60 | + fi |
| 61 | + if [[ ! "${NIGHTLY_TAG}" =~ ^nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then |
| 62 | + echo "::error::unexpected nightly tag: ${NIGHTLY_TAG}" |
| 63 | + exit 1 |
| 64 | + fi |
| 65 | + echo "NIGHTLY_TAG=${NIGHTLY_TAG}" | tee -a "${GITHUB_ENV}" |
| 66 | +
|
| 67 | + - name: Download and install nightly and components |
| 68 | + shell: pwsh |
| 69 | + env: |
| 70 | + GH_TOKEN: ${{ github.token }} |
| 71 | + run: | |
| 72 | + $ErrorActionPreference = 'Stop' |
| 73 | + $PSNativeCommandUseErrorActionPreference = $true |
| 74 | + $ProgressPreference = 'SilentlyContinue' |
| 75 | +
|
| 76 | + $root = Join-Path $env:RUNNER_TEMP 'sycl_bundle' |
| 77 | + $compiler = Join-Path $root 'dpcpp_compiler' |
| 78 | + $oclcpu = Join-Path $root 'oclcpuexp' |
| 79 | + New-Item -ItemType Directory -Force -Path $compiler, $oclcpu | Out-Null |
| 80 | +
|
| 81 | + gh release download $env:NIGHTLY_TAG -R intel/llvm -p sycl_windows.tar.gz -D $root |
| 82 | + $bundle = Join-Path $root 'sycl_windows.tar.gz' |
| 83 | + & "$env:SystemRoot\System32\tar.exe" -xzf $bundle -C $compiler |
| 84 | + Remove-Item $bundle |
| 85 | +
|
| 86 | + gh release download $env:DRIVER_PATH -R intel/llvm -p $env:WIN_OCLCPUEXP_FN -D $root |
| 87 | + $zip = Join-Path $root $env:WIN_OCLCPUEXP_FN |
| 88 | + Expand-Archive -Path $zip -DestinationPath $oclcpu |
| 89 | + Remove-Item $zip |
| 90 | +
|
| 91 | + # register the CPU runtime with the ICD loader without install.bat; |
| 92 | + # runner steps are elevated, so the loader ignores OCL_ICD_FILENAMES |
| 93 | + $vendors = 'HKLM:\SOFTWARE\Khronos\OpenCL\Vendors' |
| 94 | + if (-not (Test-Path $vendors)) { |
| 95 | + # -Force creates the missing parent keys |
| 96 | + New-Item -Path $vendors -Force | Out-Null |
| 97 | + } |
| 98 | + New-ItemProperty -Path $vendors -Name (Join-Path $oclcpu 'intelocl64.dll') ` |
| 99 | + -PropertyType DWord -Value 0 -Force | Out-Null |
| 100 | + # the runtime directory on PATH also provides tbb12.dll |
| 101 | + Add-Content -Path $env:GITHUB_ENV -Value "SYCL_BUNDLE_FOLDER=$root" |
| 102 | + Add-Content -Path $env:GITHUB_PATH -Value $oclcpu |
| 103 | + Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $compiler 'bin') |
| 104 | +
|
| 105 | + - name: Setup Python |
| 106 | + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 |
| 107 | + with: |
| 108 | + python-version: '3.15' |
| 109 | + architecture: x64 |
| 110 | + |
| 111 | + - name: Create virtual environment |
| 112 | + shell: pwsh |
| 113 | + run: | |
| 114 | + $ErrorActionPreference = 'Stop' |
| 115 | + $PSNativeCommandUseErrorActionPreference = $true |
| 116 | +
|
| 117 | + $venv = Join-Path $env:RUNNER_TEMP 'venv' |
| 118 | + python -m venv $venv |
| 119 | + # dpctl adds <venv>\Library\bin to the DLL search path, so link it to |
| 120 | + # the DPC++ runtime |
| 121 | + New-Item -ItemType Directory -Path (Join-Path $venv 'Library') | Out-Null |
| 122 | + New-Item -ItemType Junction -Path (Join-Path $venv 'Library\bin') ` |
| 123 | + -Target (Join-Path $env:SYCL_BUNDLE_FOLDER 'dpcpp_compiler\bin') | Out-Null |
| 124 | + Add-Content -Path $env:GITHUB_ENV -Value "VIRTUAL_ENV=$venv" |
| 125 | + Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $venv 'Scripts') |
| 126 | +
|
| 127 | + - name: Install dpctl dependencies |
| 128 | + shell: pwsh |
| 129 | + run: | |
| 130 | + $ErrorActionPreference = 'Stop' |
| 131 | + $PSNativeCommandUseErrorActionPreference = $true |
| 132 | + python -m pip install numpy cython "setuptools<80" pytest scikit-build cmake ninja "versioneer[toml]==0.29" |
| 133 | +
|
| 134 | + - name: Report compiler version |
| 135 | + shell: pwsh |
| 136 | + run: clang-cl --version |
| 137 | + |
| 138 | + - name: Run sycl-ls |
| 139 | + shell: pwsh |
| 140 | + run: | |
| 141 | + $ErrorActionPreference = 'Stop' |
| 142 | + $PSNativeCommandUseErrorActionPreference = $true |
| 143 | + $devices = sycl-ls |
| 144 | + $devices |
| 145 | + if (-not ($devices -match '^\[opencl:cpu\]')) { |
| 146 | + sycl-ls --verbose |
| 147 | + Write-Output '::error::no OpenCL CPU device found' |
| 148 | + exit 1 |
| 149 | + } |
| 150 | +
|
| 151 | + - name: Build dpctl |
| 152 | + shell: cmd |
| 153 | + run: | |
| 154 | + set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" |
| 155 | + for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VS_PATH=%%i" |
| 156 | + if not defined VS_PATH ( |
| 157 | + echo ::error::Visual Studio with MSVC x64 tools not found |
| 158 | + exit /b 1 |
| 159 | + ) |
| 160 | + call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat" || exit /b 1 |
| 161 | + rem -fsycl links sycl9.lib, which the linker looks up on LIB |
| 162 | + set "LIB=%SYCL_BUNDLE_FOLDER%\dpcpp_compiler\lib;%LIB%" |
| 163 | + rem link.exe can't link the LTO bitcode pybind11 would otherwise build |
| 164 | + python scripts\build_locally.py --c-compiler=clang-cl.exe --cxx-compiler=clang-cl.exe ^ |
| 165 | + --compiler-root="%SYCL_BUNDLE_FOLDER%\dpcpp_compiler\bin" ^ |
| 166 | + --cmake-opts="-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF" || exit /b 1 |
| 167 | +
|
| 168 | + - name: Run lsplatforms |
| 169 | + shell: pwsh |
| 170 | + run: | |
| 171 | + $ErrorActionPreference = 'Stop' |
| 172 | + $PSNativeCommandUseErrorActionPreference = $true |
| 173 | + python -m dpctl -f |
| 174 | +
|
| 175 | + - name: Run dpctl/tests |
| 176 | + shell: pwsh |
| 177 | + env: |
| 178 | + SYCL_CACHE_PERSISTENT: 1 |
| 179 | + run: | |
| 180 | + $ErrorActionPreference = 'Stop' |
| 181 | + $PSNativeCommandUseErrorActionPreference = $true |
| 182 | + python -m pytest -sv dpctl/tests |
0 commit comments