@@ -151,13 +151,44 @@ jobs:
151151 run : |
152152 conda info && conda list -n ${{ env.TEST_ENV_NAME }}
153153
154+ # The OpenCL ICD loader finds the CPU driver either through OCL_ICD_FILENAMES,
155+ # which a conda activation script sets, or through the registry. Under the
156+ # elevated privileges that GitHub Actions runners have, only the registry is
157+ # consulted. How the key gets written depends on which build of
158+ # intel-opencl-rt the solver picks, and it picks both across this matrix: the
159+ # Intel channel build ships a script that writes it, while the conda-forge
160+ # repack of the same name instead installs ICD vendor files and leaves
161+ # discovery to khronos-opencl-icd-loader, so those have to be registered here.
162+ - name : Register the OpenCL CPU driver with the ICD loader
163+ shell : pwsh
164+ run : |
165+ $vendors = "HKLM:\SOFTWARE\Khronos\OpenCL\Vendors"
166+ $script = "$env:CONDA_PREFIX\Scripts\set-intel-ocl-icd-registry.ps1"
167+ $icds = @(Get-ChildItem -ErrorAction SilentlyContinue -Path "$env:CONDA_PREFIX\Library\etc\OpenCL\vendors\*.icd")
168+ if (Test-Path $script) {
169+ Write-Host "running $script"
170+ & $script
171+ } elseif ($icds.Count -gt 0) {
172+ if (-not (Test-Path $vendors)) { New-Item -Path $vendors -Force | Out-Null }
173+ foreach ($icd in $icds) {
174+ # conda substitutes the environment prefix into these text files with
175+ # forward slashes, which LoadLibrary does not accept as a separator
176+ $dll = (Get-Content -Path $icd.FullName -TotalCount 1).Trim().Replace("/", "\")
177+ if (-not (Test-Path $dll)) { throw "driver $dll named by $($icd.Name) does not exist" }
178+ Write-Host "registering $dll"
179+ New-ItemProperty -Path $vendors -Name $dll -Value 0 -PropertyType DWord -Force | Out-Null
180+ }
181+ } else {
182+ throw "intel-opencl-rt provided neither $script nor any ICD vendor file"
183+ }
184+ Get-ItemProperty -Path $vendors
185+
154186 - name : Smoke test
155187 shell : cmd /C CALL {0}
188+ env :
189+ SYCL_UR_TRACE : 1
156190 run : |
157191 call conda activate ${{ env.TEST_ENV_NAME }}
158- set "OCL_ICD_FILENAMES="
159- call "%CONDA_PREFIX%\etc\conda\activate.d\khronos-opencl-icd-loader_activate.bat"
160- echo OCL_ICD_FILENAMES=%OCL_ICD_FILENAMES%
161192 python -m dpctl -f
162193 python -c "import dpctl; assert dpctl.has_cpu_devices(), 'no SYCL CPU device found'"
163194
@@ -175,7 +206,4 @@ jobs:
175206 working-directory : ${{ env.workdir }}\test_tmp
176207 run : |
177208 call conda activate ${{ env.TEST_ENV_NAME }}
178- set "OCL_ICD_FILENAMES="
179- call "%CONDA_PREFIX%\etc\conda\activate.d\khronos-opencl-icd-loader_activate.bat"
180- echo OCL_ICD_FILENAMES=%OCL_ICD_FILENAMES%
181209 python -m pytest -v -s --pyargs ${{ env.MODULE_NAME }}
0 commit comments