Repository navigation
[MAINT] Add Windows OS compiler workflow #2419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0171b18
add Windows OS compiler workflow
ndgrigorian 84ba234
link clang-cl targets through the compiler driver
ndgrigorian 95dd48d
register the Windows CPU runtime in the registry
ndgrigorian 7ddd835
create missing parent keys for the OpenCL vendors registry key
ndgrigorian bc6c1aa
keep user-provided make rules overrides
ndgrigorian c1c9b41
scope GH_TOKEN to the steps that use gh
ndgrigorian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| # Open source SYCL build deps, loaded by os-llvm-sycl-build.yml and bumped by | ||
| # bump-sycl-deps.yml from intel/llvm devops/dependencies.json. | ||
| # Open source SYCL build deps, loaded by os-llvm-sycl-build.yml and | ||
| # os-llvm-sycl-build-windows.yml, and bumped by bump-sycl-deps.yml from | ||
| # intel/llvm devops/dependencies.json. | ||
| # Kept out of .github/workflows/ since GITHUB_TOKEN can't push workflow files. | ||
| DRIVER_PATH=2026-WW28 | ||
| OCLCPUEXP_FN=oclcpuexp-2026.22.6.1.17_160000_rel.tar.gz | ||
| WIN_OCLCPUEXP_FN=win-oclcpuexp-2026.22.6.1.17_160000_rel.zip | ||
| TBB_URL=https://github.com/uxlfoundation/oneTBB/releases/download/v2023.1.0/ | ||
| TBB_INSTALL_DIR=oneapi-tbb-2023.1.0 | ||
| TBB_FN=oneapi-tbb-2023.1.0-lin.tgz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| name: Build with Open Source LLVM SYCL compiler on Windows | ||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [master] | ||
| workflow_dispatch: | ||
| inputs: | ||
| nightly-tag: | ||
| description: "intel/llvm nightly tag, e.g. nightly-2026-11-03 (default: latest with a Windows build)" | ||
| required: false | ||
| default: "" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| install-compiler: | ||
| name: Build with nightly build of DPC++ toolchain on Windows | ||
| runs-on: windows-latest | ||
| timeout-minutes: 120 | ||
|
|
||
| env: | ||
| PINS: .github/sycl-build-deps.env | ||
|
|
||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Load pinned SYCL build deps | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| # checkout may convert line endings to CRLF | ||
| VARS=$(grep -E '^(DRIVER_PATH|WIN_OCLCPUEXP_FN)=' "${PINS}" | tr -d '\r' || true) | ||
| if [[ $(wc -l <<< "${VARS}") -ne 2 ]]; then | ||
| echo "::error::expected 2 pins in ${PINS}, got:" | ||
| echo "${VARS}" | ||
| exit 1 | ||
| fi | ||
| echo "${VARS}" | tee -a "${GITHUB_ENV}" | ||
|
|
||
| - name: Resolve nightly build | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| NIGHTLY_TAG: ${{ inputs.nightly-tag }} | ||
| run: | | ||
| set -euo pipefail | ||
| if [[ -z "${NIGHTLY_TAG}" ]]; then | ||
| NIGHTLY_TAG=$(gh api 'repos/intel/llvm/releases?per_page=30' \ | ||
| --jq '[.[] | select(.tag_name | startswith("nightly-")) | ||
| | select(any(.assets[]; .name == "sycl_windows.tar.gz"))][0].tag_name // empty') | ||
| fi | ||
| if [[ ! "${NIGHTLY_TAG}" =~ ^nightly-[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then | ||
| echo "::error::unexpected nightly tag: ${NIGHTLY_TAG}" | ||
| exit 1 | ||
| fi | ||
| echo "NIGHTLY_TAG=${NIGHTLY_TAG}" | tee -a "${GITHUB_ENV}" | ||
|
|
||
| - name: Download and install nightly and components | ||
| shell: pwsh | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| $ProgressPreference = 'SilentlyContinue' | ||
|
|
||
| $root = Join-Path $env:RUNNER_TEMP 'sycl_bundle' | ||
| $compiler = Join-Path $root 'dpcpp_compiler' | ||
| $oclcpu = Join-Path $root 'oclcpuexp' | ||
| New-Item -ItemType Directory -Force -Path $compiler, $oclcpu | Out-Null | ||
|
|
||
| gh release download $env:NIGHTLY_TAG -R intel/llvm -p sycl_windows.tar.gz -D $root | ||
| $bundle = Join-Path $root 'sycl_windows.tar.gz' | ||
| & "$env:SystemRoot\System32\tar.exe" -xzf $bundle -C $compiler | ||
| Remove-Item $bundle | ||
|
|
||
| gh release download $env:DRIVER_PATH -R intel/llvm -p $env:WIN_OCLCPUEXP_FN -D $root | ||
| $zip = Join-Path $root $env:WIN_OCLCPUEXP_FN | ||
| Expand-Archive -Path $zip -DestinationPath $oclcpu | ||
| Remove-Item $zip | ||
|
|
||
| # register the CPU runtime with the ICD loader without install.bat; | ||
| # runner steps are elevated, so the loader ignores OCL_ICD_FILENAMES | ||
| $vendors = 'HKLM:\SOFTWARE\Khronos\OpenCL\Vendors' | ||
| if (-not (Test-Path $vendors)) { | ||
| # -Force creates the missing parent keys | ||
| New-Item -Path $vendors -Force | Out-Null | ||
| } | ||
| New-ItemProperty -Path $vendors -Name (Join-Path $oclcpu 'intelocl64.dll') ` | ||
| -PropertyType DWord -Value 0 -Force | Out-Null | ||
| # the runtime directory on PATH also provides tbb12.dll | ||
| Add-Content -Path $env:GITHUB_ENV -Value "SYCL_BUNDLE_FOLDER=$root" | ||
| Add-Content -Path $env:GITHUB_PATH -Value $oclcpu | ||
| Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $compiler 'bin') | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | ||
| with: | ||
| python-version: '3.15' | ||
| architecture: x64 | ||
|
|
||
| - name: Create virtual environment | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
|
|
||
| $venv = Join-Path $env:RUNNER_TEMP 'venv' | ||
| python -m venv $venv | ||
| # dpctl adds <venv>\Library\bin to the DLL search path, so link it to | ||
| # the DPC++ runtime | ||
| New-Item -ItemType Directory -Path (Join-Path $venv 'Library') | Out-Null | ||
| New-Item -ItemType Junction -Path (Join-Path $venv 'Library\bin') ` | ||
| -Target (Join-Path $env:SYCL_BUNDLE_FOLDER 'dpcpp_compiler\bin') | Out-Null | ||
| Add-Content -Path $env:GITHUB_ENV -Value "VIRTUAL_ENV=$venv" | ||
| Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $venv 'Scripts') | ||
|
|
||
| - name: Install dpctl dependencies | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| python -m pip install numpy cython "setuptools<80" pytest scikit-build cmake ninja "versioneer[toml]==0.29" | ||
|
|
||
| - name: Report compiler version | ||
| shell: pwsh | ||
| run: clang-cl --version | ||
|
|
||
| - name: Run sycl-ls | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| $devices = sycl-ls | ||
| $devices | ||
| if (-not ($devices -match '^\[opencl:cpu\]')) { | ||
| sycl-ls --verbose | ||
| Write-Output '::error::no OpenCL CPU device found' | ||
| exit 1 | ||
| } | ||
|
|
||
| - name: Build dpctl | ||
| shell: cmd | ||
| run: | | ||
| set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" | ||
| for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VS_PATH=%%i" | ||
| if not defined VS_PATH ( | ||
| echo ::error::Visual Studio with MSVC x64 tools not found | ||
| exit /b 1 | ||
| ) | ||
| call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat" || exit /b 1 | ||
| rem -fsycl links sycl9.lib, which the linker looks up on LIB | ||
| set "LIB=%SYCL_BUNDLE_FOLDER%\dpcpp_compiler\lib;%LIB%" | ||
| rem link.exe can't link the LTO bitcode pybind11 would otherwise build | ||
| python scripts\build_locally.py --c-compiler=clang-cl.exe --cxx-compiler=clang-cl.exe ^ | ||
| --compiler-root="%SYCL_BUNDLE_FOLDER%\dpcpp_compiler\bin" ^ | ||
| --cmake-opts="-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF" || exit /b 1 | ||
|
|
||
| - name: Run lsplatforms | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| python -m dpctl -f | ||
|
|
||
| - name: Run dpctl/tests | ||
| shell: pwsh | ||
| env: | ||
| SYCL_CACHE_PERSISTENT: 1 | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| python -m pytest -sv dpctl/tests | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # CMake links clang-cl targets by calling the linker directly, so link options | ||
| # such as -fsycl never reach the compiler driver. Link through the driver | ||
| # instead, like Platform/Windows-IntelLLVM does for icx, passing linker flags | ||
| # with -Xlinker (clang-cl drops -Wl, arguments). | ||
|
|
||
| if(CMAKE_GENERATOR MATCHES "Visual Studio") | ||
| return() | ||
| endif() | ||
|
|
||
| foreach(_lang C CXX) | ||
| if(NOT CMAKE_${_lang}_COMPILER_ID STREQUAL "Clang" | ||
| OR NOT CMAKE_${_lang}_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" | ||
| OR CMAKE_${_lang}_LINK_MODE STREQUAL "DRIVER") | ||
| continue() | ||
| endif() | ||
|
|
||
| if(NOT _dpctl_clang_cl_linker_flags_wrapped) | ||
| set(_dpctl_clang_cl_linker_flags_wrapped TRUE) | ||
| foreach(_t EXE SHARED MODULE) | ||
| foreach(_cfg "" _DEBUG _RELEASE _RELWITHDEBINFO _MINSIZEREL) | ||
| set(_var CMAKE_${_t}_LINKER_FLAGS${_cfg}_INIT) | ||
| separate_arguments(_flags WINDOWS_COMMAND "${${_var}}") | ||
| list(TRANSFORM _flags PREPEND "-Xlinker ") | ||
| list(JOIN _flags " " ${_var}) | ||
| endforeach() | ||
| endforeach() | ||
| set(CMAKE_LIBRARY_PATH_FLAG "-Xlinker /LIBPATH:") | ||
| set(CMAKE_LINK_DEF_FILE_FLAG "-Xlinker /DEF:") | ||
| endif() | ||
|
|
||
| set(CMAKE_${_lang}_LINK_MODE DRIVER) | ||
| set(CMAKE_${_lang}_LINKER_WRAPPER_FLAG "-Xlinker" " ") | ||
| unset(CMAKE_${_lang}_LINKER_WRAPPER_FLAG_SEP) | ||
| set(CMAKE_${_lang}_LINK_DEF_FILE_FLAG "-Xlinker /DEF:") | ||
| set(CMAKE_${_lang}_CREATE_WIN32_EXE "-Xlinker /subsystem:windows") | ||
| set(CMAKE_${_lang}_CREATE_CONSOLE_EXE "-Xlinker /subsystem:console") | ||
|
|
||
| set(CMAKE_${_lang}_LINK_EXECUTABLE | ||
| "${_CMAKE_VS_LINK_EXE}<CMAKE_${_lang}_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <LINK_FLAGS> <LINK_LIBRARIES> -link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") | ||
| set(CMAKE_${_lang}_CREATE_SHARED_LIBRARY | ||
| "${_CMAKE_VS_LINK_DLL}<CMAKE_${_lang}_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} -LD <LINK_FLAGS> <LINK_LIBRARIES> -link /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} ${CMAKE_END_TEMP_FILE}") | ||
| set(CMAKE_${_lang}_CREATE_SHARED_MODULE "${CMAKE_${_lang}_CREATE_SHARED_LIBRARY}") | ||
| endforeach() | ||
|
|
||
| unset(_lang) | ||
| unset(_t) | ||
| unset(_cfg) | ||
| unset(_var) | ||
| unset(_flags) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.