Skip to content

[SYCL] Use ICD registry keys instead of OCL_ICD_FILENAMES #4984

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 2 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sycl/doc/GetStartedGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,10 @@ command:

```bash
# Install OpenCL FPGA emulation RT
# Answer N to clean previous OCL_ICD_FILENAMES configuration
# Answer Y to clean previous OCL_ICD_FILENAMES configuration and ICD records cleanup
c:\oclfpga_rt_<fpga_version>\install.bat c:\oneapi-tbb-<tbb_version>\redist\intel64\vc14
# Install OpenCL CPU RT
# Answer Y to setup CPU RT side-bi-side with FPGA RT
# Answer N for ICD records cleanup
c:\oclcpu_rt_<cpu_version>\install.bat c:\oneapi-tbb-<tbb_version>\redist\intel64\vc14
```

Expand Down
41 changes: 20 additions & 21 deletions sycl/tools/install.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
setlocal EnableDelayedExpansion
setlocal EnableDelayedExpansion enableextensions
set OCL_RT_DIR=%~dp0

echo ###
Expand All @@ -12,28 +12,25 @@ IF NOT EXIST %OCL_RT_ENTRY_LIB% (
set OCL_RT_ENTRY_LIB=%OCL_RT_DIR%intelocl64_emu.dll
)

IF "%OCL_ICD_FILENAMES%" == "" (
set EXTENDEXISTING=N
) else (
IF NOT "%OCL_ICD_FILENAMES%" == "" (
echo OCL_ICD_FILENAMES is present and contains %OCL_ICD_FILENAMES%
:USERINPUT
set /P "EXTENDEXISTING=Should the OpenCL RT extend existing configuration (Y/N): "
)
IF "%EXTENDEXISTING%" == "N" (
echo Clean up previous configuration
set OCL_ICD_FILENAMES=%OCL_RT_ENTRY_LIB%
) else (
IF "%EXTENDEXISTING%" == "Y" (

set OCL_ICD_FILENAMES=%OCL_ICD_FILENAMES%;%OCL_RT_ENTRY_LIB%
echo Extend previous configuration to %OCL_ICD_FILENAMES%;%OCL_RT_ENTRY_LIB%
set /P "CLEAREXISTING=Should the OCL_ICD_FILENAMES be removed (Y/N): "
IF "!CLEAREXISTING!" == "N" (
echo Existing configuration is going to be preserved
) else (
echo WARNING: Incorrect input %EXTENDEXISTING%. Only Y and N are allowed.
goto USERINPUT
IF "!CLEAREXISTING!" == "Y" (
echo Clean up previous configuration
REG DELETE "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v OCL_ICD_FILENAMES
echo Execute `set OCL_ICD_FILENAMES=` to remove variable from the current console

) else (
echo WARNING: Incorrect input !CLEAREXISTING!. Only Y and N are allowed.
goto USERINPUT
)
)
)


set SYSTEM_OCL_ICD_LOADER=C:\Windows\System32\OpenCL.dll
set NEW_OCL_ICD_LOADER=%OCL_RT_DIR%\OpenCL.dll
set INSTALL_ERRORS=0
Expand Down Expand Up @@ -103,11 +100,13 @@ IF %NEED_OPENCL_UPGRADE% == True (

echo.
echo ###
echo ### 3. Set the environment variable OCL_ICD_FILENAMES to %OCL_ICD_FILENAMES%
echo ### 3. Configure ICD registry records
echo ###
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v OCL_ICD_FILENAMES /d "%OCL_ICD_FILENAMES%"
echo Deleting all obsolete registry keys
REG DELETE "HKLM\SOFTWARE\Khronos\OpenCL\Vendors" /va
REG ADD "HKLM\SOFTWARE\Khronos\OpenCL\Vendors" /f /v %OCL_RT_ENTRY_LIB% /t REG_DWORD /d "0"
IF ERRORLEVEL 1 (
echo !!! Cannot set the environment variable OCL_ICD_FILENAMES
echo !!! Cannot set ICD registry key
set INSTALL_ERRORS=1
)

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