Skip to content

Commit 92bcb41

Browse files
authored
[SYCL] Use ICD registry keys instead of OCL_ICD_FILENAMES (#4984)
Change OpenCL CPU and FPGA emulator runtimes configuration on Windows to use OpenCL ICD registry records instead of OCL_ICD_FILENAMES. That is done to use the latest OpenCL ICD loader which ignores OCL_ICD_FILENAMES configuration in the administrative console. Update documentation accordingly.
1 parent 653bae9 commit 92bcb41

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

sycl/doc/GetStartedGuide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,10 @@ command:
416416
417417
```bash
418418
# Install OpenCL FPGA emulation RT
419-
# Answer N to clean previous OCL_ICD_FILENAMES configuration
419+
# Answer Y to clean previous OCL_ICD_FILENAMES configuration and ICD records cleanup
420420
c:\oclfpga_rt_<fpga_version>\install.bat c:\oneapi-tbb-<tbb_version>\redist\intel64\vc14
421421
# Install OpenCL CPU RT
422-
# Answer Y to setup CPU RT side-bi-side with FPGA RT
422+
# Answer N for ICD records cleanup
423423
c:\oclcpu_rt_<cpu_version>\install.bat c:\oneapi-tbb-<tbb_version>\redist\intel64\vc14
424424
```
425425

sycl/tools/install.bat

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
setlocal EnableDelayedExpansion
2+
setlocal EnableDelayedExpansion enableextensions
33
set OCL_RT_DIR=%~dp0
44

55
echo ###
@@ -12,28 +12,25 @@ IF NOT EXIST %OCL_RT_ENTRY_LIB% (
1212
set OCL_RT_ENTRY_LIB=%OCL_RT_DIR%intelocl64_emu.dll
1313
)
1414

15-
IF "%OCL_ICD_FILENAMES%" == "" (
16-
set EXTENDEXISTING=N
17-
) else (
15+
IF NOT "%OCL_ICD_FILENAMES%" == "" (
1816
echo OCL_ICD_FILENAMES is present and contains %OCL_ICD_FILENAMES%
1917
:USERINPUT
20-
set /P "EXTENDEXISTING=Should the OpenCL RT extend existing configuration (Y/N): "
21-
)
22-
IF "%EXTENDEXISTING%" == "N" (
23-
echo Clean up previous configuration
24-
set OCL_ICD_FILENAMES=%OCL_RT_ENTRY_LIB%
25-
) else (
26-
IF "%EXTENDEXISTING%" == "Y" (
27-
28-
set OCL_ICD_FILENAMES=%OCL_ICD_FILENAMES%;%OCL_RT_ENTRY_LIB%
29-
echo Extend previous configuration to %OCL_ICD_FILENAMES%;%OCL_RT_ENTRY_LIB%
18+
set /P "CLEAREXISTING=Should the OCL_ICD_FILENAMES be removed (Y/N): "
19+
IF "!CLEAREXISTING!" == "N" (
20+
echo Existing configuration is going to be preserved
3021
) else (
31-
echo WARNING: Incorrect input %EXTENDEXISTING%. Only Y and N are allowed.
32-
goto USERINPUT
22+
IF "!CLEAREXISTING!" == "Y" (
23+
echo Clean up previous configuration
24+
REG DELETE "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v OCL_ICD_FILENAMES
25+
echo Execute `set OCL_ICD_FILENAMES=` to remove variable from the current console
26+
27+
) else (
28+
echo WARNING: Incorrect input !CLEAREXISTING!. Only Y and N are allowed.
29+
goto USERINPUT
30+
)
3331
)
3432
)
3533

36-
3734
set SYSTEM_OCL_ICD_LOADER=C:\Windows\System32\OpenCL.dll
3835
set NEW_OCL_ICD_LOADER=%OCL_RT_DIR%\OpenCL.dll
3936
set INSTALL_ERRORS=0
@@ -103,11 +100,13 @@ IF %NEED_OPENCL_UPGRADE% == True (
103100

104101
echo.
105102
echo ###
106-
echo ### 3. Set the environment variable OCL_ICD_FILENAMES to %OCL_ICD_FILENAMES%
103+
echo ### 3. Configure ICD registry records
107104
echo ###
108-
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v OCL_ICD_FILENAMES /d "%OCL_ICD_FILENAMES%"
105+
echo Deleting all obsolete registry keys
106+
REG DELETE "HKLM\SOFTWARE\Khronos\OpenCL\Vendors" /va
107+
REG ADD "HKLM\SOFTWARE\Khronos\OpenCL\Vendors" /f /v %OCL_RT_ENTRY_LIB% /t REG_DWORD /d "0"
109108
IF ERRORLEVEL 1 (
110-
echo !!! Cannot set the environment variable OCL_ICD_FILENAMES
109+
echo !!! Cannot set ICD registry key
111110
set INSTALL_ERRORS=1
112111
)
113112

@@ -165,7 +164,7 @@ IF %INSTALL_ERRORS% == 1 (
165164
echo See recommendations printed above and perform the following actions manually:
166165
echo 1. Save %SYSTEM_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%.%SYSTEM_OPENCL_VER%
167166
echo 2. Copy %NEW_OCL_ICD_LOADER% to %SYSTEM_OCL_ICD_LOADER%
168-
echo 3. Add/set the environment variable OCL_ICD_FILENAMES to %OCL_RT_ENTRY_LIB%
167+
echo 3. Add/update registry string value in Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors\%OCL_RT_ENTRY_LIB% containing 0
169168
echo 4. Copy TBB libraries or create symbolic links in %OCL_RT_DIR%tbb.
170169
echo 5. Add/set the environment variable PATH to %OCL_RT_DIR%tbb
171170
echo Or try running this batch file as Administrator.

0 commit comments

Comments
 (0)