pax_global_header00006660000000000000000000000064150377630570014527gustar00rootroot0000000000000052 comment=ad770a1b64c6b8d5f2ed4e153f22e4f45939f27f OpenCL-ICD-Loader-2025.07.22/000077500000000000000000000000001503776305700150515ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/.github/000077500000000000000000000000001503776305700164115ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/.github/workflows/000077500000000000000000000000001503776305700204465ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/.github/workflows/presubmit.yml000066400000000000000000001020461503776305700232060ustar00rootroot00000000000000name: Presubmit on: push: paths-ignore: - '**/*.md' pull_request: paths-ignore: - '**/*.md' jobs: linux: runs-on: ubuntu-latest defaults: run: shell: bash strategy: matrix: CMAKE: [3.26.4] C_COMPILER: - gcc-11 - gcc-13 - clang-14 - clang-16 BIN: [64] CONF: - GEN: Unix Makefiles CONFIG: Debug - GEN: Unix Makefiles CONFIG: Release - GEN: Ninja Multi-Config CONFIG: Release IMAGE: - khronosgroup/docker-images:opencl-sdk-intelcpu-ubuntu-22.04.20230717 include: - CMAKE: system C_COMPILER: gcc-9 BIN: 64 CONF: GEN: Unix Makefiles CONFIG: Debug IMAGE: khronosgroup/docker-images:opencl-sdk-intelcpu-ubuntu-20.04.20230717 - CMAKE: system C_COMPILER: gcc-9 BIN: 64 CONF: GEN: Unix Makefiles CONFIG: Release IMAGE: khronosgroup/docker-images:opencl-sdk-intelcpu-ubuntu-20.04.20230717 - CMAKE: system C_COMPILER: gcc-9 BIN: 32 CONF: GEN: Unix Makefiles CONFIG: Debug IMAGE: khronosgroup/docker-images:opencl-sdk-intelcpu-ubuntu-20.04.20230717 - CMAKE: system C_COMPILER: gcc-9 BIN: 32 CONF: GEN: Unix Makefiles CONFIG: Release IMAGE: khronosgroup/docker-images:opencl-sdk-intelcpu-ubuntu-20.04.20230717 container: ${{matrix.IMAGE}} env: CMAKE_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/cmake CPACK_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/cpack CTEST_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/ctest CC: ${{matrix.C_COMPILER}} CFLAGS: -Wall -Wextra -Werror -pedantic -m${{matrix.BIN}} DEB_INSTALLATION_PATH: /usr steps: - name: Install system CMake if: ${{matrix.CMAKE}} == 'system' run: apt-get update -qq && apt-get install -y cmake && echo "CMAKE_EXE=cmake" >> "$GITHUB_ENV" && echo "CPACK_EXE=cpack" >> "$GITHUB_ENV" && echo "CTEST_EXE=ctest" >> "$GITHUB_ENV" - name: Checkout OpenCL-ICD-Loader uses: actions/checkout@v4 - name: Checkout OpenCL-Headers uses: actions/checkout@v4 with: path: external/OpenCL-Headers repository: KhronosGroup/OpenCL-Headers - name: Configure, install & package OpenCL-Headers run: $CMAKE_EXE -G "${{matrix.CONF.GEN}}" `if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi` -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-Headers/install -D CPACK_PACKAGING_INSTALL_PREFIX=$DEB_INSTALLATION_PATH -D BUILD_TESTING=OFF -S $GITHUB_WORKSPACE/external/OpenCL-Headers -B $GITHUB_WORKSPACE/external/OpenCL-Headers/build && $CMAKE_EXE --build $GITHUB_WORKSPACE/external/OpenCL-Headers/build --target install --parallel `nproc` && $CPACK_EXE --config "$GITHUB_WORKSPACE/external/OpenCL-Headers/build/CPackConfig.cmake" -G DEB -C ${{matrix.CONF.CONFIG}} -B "$GITHUB_WORKSPACE/external/OpenCL-Headers/package-deb" - name: Configure run: $CMAKE_EXE -G "${{matrix.CONF.GEN}}" `if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi` -D BUILD_TESTING=ON -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install -D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/install -D CPACK_PACKAGING_INSTALL_PREFIX=$DEB_INSTALLATION_PATH -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build - name: Build run: if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then $CMAKE_EXE --build $GITHUB_WORKSPACE/build --config ${{matrix.CONF.CONFIG}} --parallel `nproc`; else $CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Debug; $CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Release; fi - name: Test working-directory: ${{runner.workspace}}/OpenCL-ICD-Loader/build run: if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then $CTEST_EXE --output-on-failure --no-tests=error --parallel `nproc`; else $CTEST_EXE --output-on-failure --no-tests=error -C Debug --parallel `nproc`; $CTEST_EXE --output-on-failure --no-tests=error -C Release --parallel `nproc`; fi - name: Package DEB run: $CPACK_EXE --config "$GITHUB_WORKSPACE/build/CPackConfig.cmake" -G DEB -C ${{matrix.CONF.CONFIG}} -B "$GITHUB_WORKSPACE/package-deb" - name: Consume (DEB) run: dpkg -i $GITHUB_WORKSPACE/external/OpenCL-Headers/package-deb/*.deb && dpkg -i $GITHUB_WORKSPACE/package-deb/*.deb && $CMAKE_EXE -G "${{matrix.CONF.GEN}}" `if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi` -D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/`if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "libOpenCLDriverStub.so"; else echo "${{ matrix.CONF.CONFIG }}/libOpenCLDriverStub.so"; fi` -S $GITHUB_WORKSPACE/test/pkgconfig/bare -B $GITHUB_WORKSPACE/build_package && if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then $CMAKE_EXE --build $GITHUB_WORKSPACE/build_package --config ${{matrix.CONF.CONFIG}} --parallel `nproc`; else $CMAKE_EXE --build $GITHUB_WORKSPACE/build_package --config Debug; $CMAKE_EXE --build $GITHUB_WORKSPACE/build_package --config Release; fi - name: Run consume test (DEB) if: matrix.BIN != 32 working-directory: ${{runner.workspace}}/OpenCL-ICD-Loader/build_package run: if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then $CTEST_EXE -C ${{matrix.CONF.CONFIG}} --output-on-failure --no-tests=error --parallel `nproc`; else $CTEST_EXE -C Debug --output-on-failure --no-tests=error --parallel `nproc`; $CTEST_EXE -C Release --output-on-failure --no-tests=error --parallel `nproc`; fi - name: Test pkg-config (DEB) # We expect no pre-processor and compile flags (--cflags) but we do expect link flags (--libs) run: if [[ $(pkg-config OpenCL --cflags) ]]; then exit 1; fi && pkg-config OpenCL --libs | grep -q "\-lOpenCL" - name: Test cllayerinfo (DEB) run: cllayerinfo - name: Uninstall (DEB) run: apt-get remove -y "khronos-opencl-loader*" opencl-c-headers - name: Test install run: $CMAKE_EXE --build $GITHUB_WORKSPACE/build --target install --config ${{matrix.CONF.CONFIG}} --parallel `nproc` - name: Consume (install) run: $CMAKE_EXE -G "${{matrix.CONF.GEN}}" `if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi` -D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/install;$GITHUB_WORKSPACE/external/OpenCL-Headers/install" -D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/`if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "libOpenCLDriverStub.so"; else echo "${{ matrix.CONF.CONFIG }}/libOpenCLDriverStub.so"; fi` -S $GITHUB_WORKSPACE/test/pkgconfig/bare -B $GITHUB_WORKSPACE/build_install && if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then $CMAKE_EXE --build $GITHUB_WORKSPACE/build_install --parallel `nproc`; else $CMAKE_EXE --build $GITHUB_WORKSPACE/build_install --config Debug; $CMAKE_EXE --build $GITHUB_WORKSPACE/build_install --config Release; fi - name: Run consume test (install) if: matrix.BIN != 32 working-directory: ${{runner.workspace}}/OpenCL-ICD-Loader/build_install run: if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then $CTEST_EXE -C ${{matrix.CONF.CONFIG}} --output-on-failure --no-tests=error --parallel `nproc`; else $CTEST_EXE -C Debug --output-on-failure --no-tests=error --parallel `nproc`; $CTEST_EXE -C Release --output-on-failure --no-tests=error --parallel `nproc`; fi - name: Test pkg-config (install) # We expect no pre-processor and compile flags (--cflags) but we do expect link flags (--libs) run: export PKG_CONFIG_PATH="$GITHUB_WORKSPACE/install/lib/pkgconfig:$GITHUB_WORKSPACE/external/OpenCL-Headers/install/share/pkgconfig" && pkg-config OpenCL --cflags | grep -q "\-I$GITHUB_WORKSPACE/external/OpenCL-Headers/install/include" && pkg-config OpenCL --libs | grep -q "\-L$GITHUB_WORKSPACE/install/lib \-lOpenCL" windows: runs-on: windows-latest defaults: run: shell: pwsh strategy: matrix: VER: [v142, v143, clangcl] GEN: [Visual Studio 17 2022, Ninja Multi-Config] BIN: [x64] exclude: - VER: clangcl GEN: Ninja Multi-Config include: - VER: v142 GEN: Visual Studio 17 2022 BIN: x86 env: NINJA_URL: https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip NINJA_ROOT: C:\Tools\Ninja VS_ROOT: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise' UseMultiToolTask: true # Better parallel MSBuild execution EnforceProcessCountAcrossBuilds: 'true' MultiProcMaxCount: '3' # C4152: nonstandard extension, function/data pointer conversion in expression # C4201: nonstandard extension used: nameless struct/union # C4310: cast truncates constant value CFLAGS: /W4 /WX /wd4152 /wd4201 /wd4310 steps: - name: Cache Ninja install if: matrix.GEN == 'Ninja Multi-Config' id: ninja-install uses: actions/cache@v4 with: path: | C:\Tools\Ninja key: ${{runner.os}}-ninja-${{env.NINJA_URL}} - name: Install Ninja if: matrix.GEN == 'Ninja Multi-Config' && steps.ninja-install.outputs.cache-hit != 'true' run: | Invoke-WebRequest ${env:NINJA_URL} -OutFile ~\Downloads\ninja-win.zip Expand-Archive ~\Downloads\ninja-win.zip -DestinationPath ${env:NINJA_ROOT}\ Remove-Item ~\Downloads\* - name: Checkout OpenCL-ICD-Loader uses: actions/checkout@v4 - name: Checkout OpenCL-Headers uses: actions/checkout@v4 with: repository: KhronosGroup/OpenCL-Headers path: external/OpenCL-Headers - name: Build & install OpenCL-Headers (MSBuild) if: matrix.GEN == 'Visual Studio 17 2022' run: | $BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'} & cmake ` -G "${{matrix.GEN}}" ` -A $BIN ` -T ${{matrix.VER}} ` -D BUILD_TESTING=OFF ` -D CMAKE_C_EXTENSIONS=OFF ` -D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install ` -S ${env:GITHUB_WORKSPACE}\external\OpenCL-Headers ` -B ${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\build if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-Headers failed." } & cmake ` --build "${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\build" ` --target install ` -- ` /verbosity:minimal ` /maxCpuCount ` /noLogo if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-Headers failed." } - name: Build & install OpenCL-Headers (Ninja Multi-Config) if: matrix.GEN == 'Ninja Multi-Config' run: | $VER = switch ('${{matrix.VER}}') { ` 'v142' {'14.2'} ` 'v143' {'14.4'} } Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER" & cmake ` -G "${{matrix.GEN}}" ` -D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" ` -D BUILD_TESTING=OFF ` -D CMAKE_C_EXTENSIONS=OFF ` -D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install ` -S ${env:GITHUB_WORKSPACE}\external\OpenCL-Headers ` -B ${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\build if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-Headers failed." } & cmake ` --build "${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\build" ` --target install ` -- ` -j ${env:NUMBER_OF_PROCESSORS} if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-Headers failed." } - name: Configure (MSBuild) if: matrix.GEN == 'Visual Studio 17 2022' run: | $BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'} & cmake ` -G "${{matrix.GEN}}" ` -A $BIN ` -T ${{matrix.VER}} ` -D BUILD_TESTING=ON ` -D CMAKE_C_EXTENSIONS=OFF ` -D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\install ` -D CMAKE_PREFIX_PATH=${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install ` -S ${env:GITHUB_WORKSPACE} ` -B ${env:GITHUB_WORKSPACE}\build if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-ICD-Loader failed." } - name: Configure (Ninja Multi-Config) if: matrix.GEN == 'Ninja Multi-Config' run: | $VER = switch ('${{matrix.VER}}') { ` 'v142' {'14.2'} ` 'v143' {'14.4'} } Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER" & cmake ` -G "${{matrix.GEN}}" ` -D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" ` -D BUILD_TESTING=ON ` -D CMAKE_C_EXTENSIONS=OFF ` -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL ` -D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\install ` -D CMAKE_PREFIX_PATH=${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install ` -S ${env:GITHUB_WORKSPACE} ` -B ${env:GITHUB_WORKSPACE}\build if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-ICD-Loader failed." } - name: Build (MSBuild) if: matrix.GEN == 'Visual Studio 17 2022' run: | foreach ($Config in 'Release','Debug') { & cmake ` --build "${env:GITHUB_WORKSPACE}\build" ` --config $Config ` -- ` /verbosity:minimal ` /maxCpuCount ` /noLogo if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-ICD-Loader in $Config failed." } } - name: Build (Ninja Multi-Config) if: matrix.GEN == 'Ninja Multi-Config' run: | $VER = switch ('${{matrix.VER}}') { ` 'v142' {'14.2'} ` 'v143' {'14.4'} } Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER" foreach ($Config in 'Release','Debug') { & cmake ` --build "${env:GITHUB_WORKSPACE}\build" ` --config $Config ` -- ` -j ${env:NUMBER_OF_PROCESSORS} if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-ICD-Loader in $Config failed." } } - name: Test working-directory: ${{runner.workspace}}/OpenCL-ICD-Loader/build run: | $REG = if('${{matrix.BIN}}' -eq 'x64') {"reg"} else {"${env:SystemRoot}\Syswow64\reg.exe"} $KEY_NAME = "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors" foreach ($Config in 'Release','Debug') { $VALUE_NAME = "${env:GITHUB_WORKSPACE}/build/$Config/OpenCLDriverStub.dll" $VALUE_NAME_2 = "${env:GITHUB_WORKSPACE}/build/$Config/OpenCLDriverStubICD2.dll" & $REG ADD $KEY_NAME /v $VALUE_NAME /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG ADD $KEY_NAME /v $VALUE_NAME_2 /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & ctest -C $Config --output-on-failure --no-tests=error --parallel ${env:NUMBER_OF_PROCESSORS} if ($LASTEXITCODE -ne 0) { throw "Testing OpenCL-ICD-Loader in $Config failed." } & $REG DELETE $KEY_NAME /v $VALUE_NAME_2 /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG DELETE $KEY_NAME /v $VALUE_NAME /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } } - name: Install run: | & cmake ` --build "${env:GITHUB_WORKSPACE}\build" ` --config Release ` --target install if ($LASTEXITCODE -ne 0) { throw "Installing OpenCL-ICD-Loader failed." } - name: "Consume (MSBuild standalone): Configure/Build/Test" if: matrix.GEN == 'Visual Studio 17 2022' run: | $BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'} & cmake ` -G '${{matrix.GEN}}' ` -A $BIN ` -T ${{matrix.VER}} ` -D CMAKE_C_EXTENSIONS=OFF ` -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL ` -D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\install" ` -D DRIVER_STUB_PATH="${env:GITHUB_WORKSPACE}\build\Release\OpenCLDriverStub.dll" ` -S "${env:GITHUB_WORKSPACE}\test\pkgconfig\bare" ` -B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare" if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-ICD-Loader standalone consume test failed." } $REG = if('${{matrix.BIN}}' -eq 'x64') {"reg"} else {"${env:SystemRoot}\Syswow64\reg.exe"} $KEY_NAME = "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors" $VALUE_NAME = "${env:GITHUB_WORKSPACE}/build/Release/OpenCLDriverStub.dll" $VALUE_NAME_2 = "${env:GITHUB_WORKSPACE}/build/Release/OpenCLDriverStubICD2.dll" & $REG ADD $KEY_NAME /v $VALUE_NAME /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG ADD $KEY_NAME /v $VALUE_NAME_2 /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } foreach ($Config in 'Release','Debug') { & cmake ` --build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare" ` --config $Config if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-ICD-Loader standalone consume test in $Config failed." } & cd ${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare & ctest --output-on-failure --no-tests=error -C $Config if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-ICD-Loader standalone consume test in $Config failed." } } & $REG DELETE $KEY_NAME /v $VALUE_NAME /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG DELETE $KEY_NAME /v $VALUE_NAME_2 /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } - name: "Consume (Ninja-Multi-Config standalone): Configure/Build/Test" if: matrix.GEN == 'Ninja Multi-Config' run: | $VER = switch ('${{matrix.VER}}') { ` 'v142' {'14.2'} ` 'v143' {'14.4'} } Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER" & cmake ` -G '${{matrix.GEN}}' ` -D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" ` -D CMAKE_C_EXTENSIONS=OFF ` -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL ` -D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\install" ` -D DRIVER_STUB_PATH="${env:GITHUB_WORKSPACE}\build\Release\OpenCLDriverStub.dll" ` -S "${env:GITHUB_WORKSPACE}\test\pkgconfig\bare" ` -B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare" if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-ICD-Loader standalone consume test failed." } $REG = if('${{matrix.BIN}}' -eq 'x64') {"reg"} else {"${env:SystemRoot}\Syswow64\reg.exe"} $KEY_NAME = "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors" $VALUE_NAME = "${env:GITHUB_WORKSPACE}/build/Release/OpenCLDriverStub.dll" $VALUE_NAME_2 = "${env:GITHUB_WORKSPACE}/build/Release/OpenCLDriverStubICD2.dll" & $REG ADD $KEY_NAME /v $VALUE_NAME /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG ADD $KEY_NAME /v $VALUE_NAME_2 /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } foreach ($Config in 'Release','Debug') { & cmake ` --build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare" ` --config $Config if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-ICD-Loader standalone consume test in $Config failed." } & cd ${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare & ctest --output-on-failure --no-tests=error -C $Config if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-ICD-Loader standalone consume test in $Config failed." } } & $REG DELETE $KEY_NAME /v $VALUE_NAME /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG DELETE $KEY_NAME /v $VALUE_NAME_2 /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } - name: Consume (Emulate SDK presence) run: | New-Item -Type Directory -Path ${env:GITHUB_WORKSPACE}\install\share\cmake\OpenCL $workspace = ${env:GITHUB_WORKSPACE}.replace("\", "/") New-Item -Type File -Path ${env:GITHUB_WORKSPACE}\install\share\cmake\OpenCL\OpenCLConfig.cmake -Value "include(`"$workspace/external/OpenCL-Headers/install/share/cmake/OpenCLHeaders/OpenCLHeadersTargets.cmake`")`r`ninclude(`"`${CMAKE_CURRENT_LIST_DIR}/../OpenCLICDLoader/OpenCLICDLoaderTargets.cmake`")" - name: "Consume (MSBuild SDK): Configure/Build/Test" if: matrix.GEN == 'Visual Studio 17 2022' run: | $BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'} & cmake ` -G '${{matrix.GEN}}' ` -A $BIN ` -T ${{matrix.VER}} ` -D CMAKE_C_EXTENSIONS=OFF ` -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL ` -D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\install" ` -D DRIVER_STUB_PATH="${env:GITHUB_WORKSPACE}\build\Release\OpenCLDriverStub.dll" ` -S "${env:GITHUB_WORKSPACE}\test\pkgconfig\sdk" ` -B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk" if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-ICD-Loader in-SDK consume test failed." } $REG = if('${{matrix.BIN}}' -eq 'x64') {"reg"} else {"${env:SystemRoot}\Syswow64\reg.exe"} $KEY_NAME = "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors" $VALUE_NAME = "${env:GITHUB_WORKSPACE}/build/Release/OpenCLDriverStub.dll" $VALUE_NAME_2 = "${env:GITHUB_WORKSPACE}/build/Release/OpenCLDriverStubICD2.dll" & $REG ADD $KEY_NAME /v $VALUE_NAME /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG ADD $KEY_NAME /v $VALUE_NAME_2 /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } foreach ($Config in 'Release','Debug') { & cmake ` --build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk" ` --config $Config if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-ICD-Loader in-SDK consume test in $Config failed." } & cd ${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk & ctest --output-on-failure --no-tests=error -C $Config if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-ICD-Loader in-SDK consume test in $Config failed." } } & $REG DELETE $KEY_NAME /v $VALUE_NAME /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG DELETE $KEY_NAME /v $VALUE_NAME_2 /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } - name: "Consume (Ninja-Multi-Config SDK): Configure/Build/Test" if: matrix.GEN == 'Ninja Multi-Config' run: | $VER = switch ('${{matrix.VER}}') { ` 'v142' {'14.2'} ` 'v143' {'14.4'} } Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER" & cmake ` -G '${{matrix.GEN}}' ` -D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" ` -D CMAKE_C_EXTENSIONS=OFF ` -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL ` -D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\install" ` -D DRIVER_STUB_PATH="${env:GITHUB_WORKSPACE}\build\Release\OpenCLDriverStub.dll" ` -S "${env:GITHUB_WORKSPACE}\test\pkgconfig\sdk" ` -B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk" if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-ICD-Loader in-SDK consume test failed." } $REG = if('${{matrix.BIN}}' -eq 'x64') {"reg"} else {"${env:SystemRoot}\Syswow64\reg.exe"} $KEY_NAME = "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors" $VALUE_NAME = "${env:GITHUB_WORKSPACE}/build/Release/OpenCLDriverStub.dll" $VALUE_NAME_2 = "${env:GITHUB_WORKSPACE}/build/Release/OpenCLDriverStubICD2.dll" & $REG ADD $KEY_NAME /v $VALUE_NAME /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG ADD $KEY_NAME /v $VALUE_NAME_2 /t REG_DWORD /d 0 if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } foreach ($Config in 'Release','Debug') { & cmake ` --build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk" ` --config $Config if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-ICD-Loader in-SDK consume test in $Config failed." } & cd ${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk & ctest --output-on-failure --no-tests=error -C $Config if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-ICD-Loader in-SDK consume test in $Config failed." } } & $REG DELETE $KEY_NAME /v $VALUE_NAME /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } & $REG DELETE $KEY_NAME /v $VALUE_NAME_2 /f if ($LASTEXITCODE -ne 0) { throw "Editing registry failed." } macos: runs-on: macos-latest defaults: run: shell: bash strategy: matrix: C_COMPILER: - /usr/bin/clang # Disabled due to problems with __has_cpp_attribute # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114007 # - gcc-11 # Disabled due to problems with the __API_AVAILABLE macro # - gcc-13 GEN: - Xcode - Ninja Multi-Config exclude: # These entries are excluded, since XCode selects its own compiler - C_COMPILER: gcc-11 GEN: Xcode - C_COMPILER: gcc-13 GEN: Xcode env: CFLAGS: -Wall -Wextra -pedantic -Werror CC: ${{ matrix.C_COMPILER }} steps: - name: Checkout OpenCL-ICD-Loader uses: actions/checkout@v4 - name: Checkout OpenCL-Headers uses: actions/checkout@v4 with: repository: KhronosGroup/OpenCL-Headers path: external/OpenCL-Headers - name: Create Build Environment run: | # Install Ninja only if it's the selected generator and it's not available. if [[ "${{matrix.GEN}}" == "Ninja Multi-Config" && ! `which ninja` ]]; then brew install ninja; fi && if [[ ! `which pkg-config` ]]; then brew install pkg-config; fi && cmake --version - name: Build & install OpenCL-Headers run: cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=OFF -D CMAKE_C_EXTENSIONS=OFF -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-Headers/install -S $GITHUB_WORKSPACE/external/OpenCL-Headers -B $GITHUB_WORKSPACE/external/OpenCL-Headers/build && cmake --build $GITHUB_WORKSPACE/external/OpenCL-Headers/build --target install --config Release --parallel `sysctl -n hw.logicalcpu` - name: Configure run: cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_EXTENSIONS=OFF -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install -D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/install -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build - name: Build run: | cmake --build $GITHUB_WORKSPACE/build --config Release --parallel `sysctl -n hw.logicalcpu` cmake --build $GITHUB_WORKSPACE/build --config Debug --parallel `sysctl -n hw.logicalcpu` - name: Test working-directory: ${{runner.workspace}}/OpenCL-ICD-Loader/build run: | ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` - name: Test install run: | cmake --build $GITHUB_WORKSPACE/build --config Release --target install - name: Consume (install) run: cmake -G "${{matrix.GEN}}" -D CMAKE_C_EXTENSIONS=OFF -D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/install" -S $GITHUB_WORKSPACE/test/pkgconfig/bare -B $GITHUB_WORKSPACE/build_install && cmake --build $GITHUB_WORKSPACE/build_install --config Release --parallel `sysctl -n hw.logicalcpu` && cmake --build $GITHUB_WORKSPACE/build_install --config Debug --parallel `sysctl -n hw.logicalcpu` - name: Test pkg-config run: | export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/install/lib/pkgconfig:$GITHUB_WORKSPACE/external/OpenCL-Headers/install/share/pkgconfig && pkg-config OpenCL --cflags | grep -q "\-I$GITHUB_WORKSPACE/external/OpenCL-Headers/install/include" && pkg-config OpenCL --libs | grep -q "\-L$GITHUB_WORKSPACE/install/lib -lOpenCL" - name: Consume pkg-config run: export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/install/lib/pkgconfig:$GITHUB_WORKSPACE/external/OpenCL-Headers/install/share/pkgconfig && cmake -G "${{matrix.GEN}}" -D CMAKE_C_EXTENSIONS=OFF -D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install" -D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/Release/libOpenCLDriverStub.dylib -B $GITHUB_WORKSPACE/build/downstream/pkgconfig -S $GITHUB_WORKSPACE/test/pkgconfig/pkgconfig && cmake --build $GITHUB_WORKSPACE/build/downstream/pkgconfig --config Release --parallel `sysctl -n hw.logicalcpu` && cmake --build $GITHUB_WORKSPACE/build/downstream/pkgconfig --config Debug --parallel `sysctl -n hw.logicalcpu` && cd $GITHUB_WORKSPACE/build/downstream/pkgconfig && ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` && ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` android: runs-on: ubuntu-latest defaults: run: shell: bash strategy: matrix: ABI: - arm64-v8a - x86_64 API_LEVEL: - android-19 - android-33 CONFIG: - Debug - Release env: CFLAGS: -Wall -Wextra -pedantic -Werror steps: - name: Checkout OpenCL-ICD-Loader uses: actions/checkout@v4 - name: Checkout OpenCL-Headers uses: actions/checkout@v4 with: repository: KhronosGroup/OpenCL-Headers path: external/OpenCL-Headers - name: Configure & install OpenCL-Headers run: cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=${{matrix.CONFIG}} -D CMAKE_C_EXTENSIONS=OFF -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-Headers/install -D BUILD_TESTING=OFF -S $GITHUB_WORKSPACE/external/OpenCL-Headers -B $GITHUB_WORKSPACE/external/OpenCL-Headers/build && cmake --build $GITHUB_WORKSPACE/external/OpenCL-Headers/build --target install -- -j`nproc` - name: Configure run: cmake -G "Unix Makefiles" -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=${{matrix.CONFIG}} -D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -D ANDROID_ABI=${{matrix.ABI}} -D ANDROID_PLATFORM=${{matrix.API_LEVEL}} -D CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY -D CMAKE_FIND_ROOT_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/install -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build - name: Build run: cmake --build $GITHUB_WORKSPACE/build --parallel `nproc` OpenCL-ICD-Loader-2025.07.22/.github/workflows/release.yml000066400000000000000000000046361503776305700226220ustar00rootroot00000000000000name: Release on: push: tags: - "v*" env: distroseries: jammy jobs: release: if: false runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Add PPA run: sudo add-apt-repository -y ppa:${{ vars.PPA }} - name: Install prerequisites run: sudo apt-get update -qq && sudo apt-get install -y cmake devscripts debhelper-compat=13 opencl-c-headers - name: Import GPG signing key run: echo "${{ secrets.DEB_SIGNING_KEY }}" | gpg --import - name: Download and extract source code run: | wget -O $GITHUB_WORKSPACE/source.orig.tar.gz https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz tar -xvf $GITHUB_WORKSPACE/source.orig.tar.gz - name: Configure project out-of-tree run: cmake -S $GITHUB_WORKSPACE/OpenCL-ICD-Loader* -B $GITHUB_WORKSPACE/../build -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr -D BUILD_TESTING=OFF -D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME -D CPACK_DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}" -D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }} - name: Generate packaging scripts run: cmake -D CMAKE_CACHE_PATH=$GITHUB_WORKSPACE/../build/CMakeCache.txt -D ORIG_ARCHIVE=$GITHUB_WORKSPACE/source.orig.tar.gz -D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME -D DEBIAN_DISTROSERIES=${{ env.distroseries }} -D DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}" -D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }} -P $GITHUB_WORKSPACE/OpenCL-ICD-Loader*/cmake/DebSourcePkg.cmake - name: Build source package run: | cd $GITHUB_WORKSPACE/OpenCL-ICD-Loader*/ debuild -S -sa - name: Build binary package run: cpack -G DEB -C Release -B $GITHUB_WORKSPACE/../build --config $GITHUB_WORKSPACE/../build/CPackConfig.cmake # The following step does not depend on the previous step "Build binary package", # but if the binary package build is unsuccessful, it is better not to push the # source packages to the PPA - name: Push source package to the PPA run: dput ppa:${{ vars.PPA }} $GITHUB_WORKSPACE/*source.changes - name: Create GitHub release uses: softprops/action-gh-release@v1 with: files: ${{ github.workspace }}/../build/*.deb OpenCL-ICD-Loader-2025.07.22/.gitignore000066400000000000000000000003231503776305700170370ustar00rootroot00000000000000# Build dir [Bb]uild/ # Install dir [Ii]nstall/ # External dir [Ee]xternal/ # Package dir [Pp]ackage[-_\s\d]*/ # Tackage dir [T]esting/ # inc subdirs inc/CL/ inc/EGL/ inc/KHR/ # Visual Studio Code .vscode OpenCL-ICD-Loader-2025.07.22/CMakeLists.txt000066400000000000000000000243461503776305700176220ustar00rootroot00000000000000cmake_minimum_required (VERSION 3.16) # Include guard for including this project multiple times if(TARGET OpenCL) return() endif() project (OpenCL-ICD-Loader VERSION 3.0 LANGUAGES C) find_package (Threads REQUIRED) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) # The option below allows building the ICD Loader library as a shared library # (ON, default) or a static library (OFF). # # Khronos OpenCL Working Group strongly recommends building and using the ICD # loader as a shared library due to the following benefits: # # 1. The shared library can be updated independent of the application. This # allows releasing new fixes and features in the ICD loader without updating # the application. # # In rare cases when there are backward-incompatible changes to the ICD # loader (due to platform requirements, for instance), using a shared # library allows updating the library to make the transition seamless to # installed applications. # # 2. On platforms that require the ICD mechanism there are multiple vendors # shipping their OpenCL implementations. The vendor installers collaborate # to make sure that the installed ICD shared library version is suitable for # working with all vendor implementations installed on the system. # # If applications statically link to ICD Loader then that version of the ICD # loader may not work with one or more installed vendor implementations. # # Using the OpenCL ICD loader as a static library is NOT recommended for # end-user installations in general. However in some controlled environments it # may be useful to simplify the build and distribution of the application. E.g. # in test farms, or in cases where the end-user system configs are known in # advance. Use it with discretion. if(DEFINED BUILD_SHARED_LIBS) set(OPENCL_ICD_LOADER_BUILD_SHARED_LIBS_DEFAULT ${BUILD_SHARED_LIBS}) else() set(OPENCL_ICD_LOADER_BUILD_SHARED_LIBS_DEFAULT ON) endif() option(OPENCL_ICD_LOADER_BUILD_SHARED_LIBS "Build OpenCL ICD Loader as shared library" ${OPENCL_ICD_LOADER_BUILD_SHARED_LIBS_DEFAULT}) # This option enables/disables support for OpenCL layers in the ICD loader. # It is currently needed default while the specification is being formalized, # and to study the performance impact. option (ENABLE_OPENCL_LAYERS "Enable OpenCL Layers" ON) option (ENABLE_OPENCL_LOADER_MANAGED_DISPATCH "Enable OpenCL Loader managed dispatch" ON) include(CMakeDependentOption) cmake_dependent_option(ENABLE_OPENCL_LAYERINFO "Enable building cllayerinfo tool" ON ENABLE_OPENCL_LAYERS OFF) include(GNUInstallDirs) set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(CheckFunctionExists) include(JoinPaths) include(Package) check_function_exists(secure_getenv HAVE_SECURE_GETENV) check_function_exists(__secure_getenv HAVE___SECURE_GETENV) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/loader/icd_cmake_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/icd_cmake_config.h) set (OPENCL_ICD_LOADER_SOURCES loader/icd.c loader/icd.h loader/icd_version.h loader/icd_dispatch.c loader/icd_dispatch.h loader/icd_dispatch_generated.c loader/icd_envvars.h loader/icd_platform.h) include_directories (include) if (WIN32) list (APPEND OPENCL_ICD_LOADER_SOURCES loader/windows/adapter.h loader/windows/icd_windows.c loader/windows/icd_windows.h loader/windows/icd_windows_dxgk.c loader/windows/icd_windows_dxgk.h loader/windows/icd_windows_envvars.c loader/windows/icd_windows_hkr.c loader/windows/icd_windows_hkr.h loader/windows/icd_windows_apppackage.c loader/windows/icd_windows_apppackage.h loader/windows/OpenCL.rc) # Only add the DXSDK include directory if the environment variable is # defined. Since the DXSDK has merged into the Windows SDK, this is # only required in rare cases. if (DEFINED ENV{DXSDK_DIR} AND NOT (MINGW OR MSYS OR CYGWIN)) include_directories ($ENV{DXSDK_DIR}/Include) endif () # For mingw-i686 builds only we need a special .def file with stdcall # exports. In all other cases we can use a standard .def file. if ((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (MINGW OR MSYS OR CYGWIN)) list (APPEND OPENCL_ICD_LOADER_SOURCES loader/windows/OpenCL-mingw-i686.def) else () list (APPEND OPENCL_ICD_LOADER_SOURCES loader/windows/OpenCL.def) endif () else () list (APPEND OPENCL_ICD_LOADER_SOURCES loader/linux/icd_linux.c loader/linux/icd_linux_envvars.c loader/linux/icd_exports.map) endif () set (OPENCL_ICD_LOADER_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/inc" CACHE PATH "Path to OpenCL Headers") if (${OPENCL_ICD_LOADER_BUILD_SHARED_LIBS}) add_library (OpenCL SHARED ${OPENCL_ICD_LOADER_SOURCES}) else() add_library (OpenCL STATIC ${OPENCL_ICD_LOADER_SOURCES}) endif() add_library (OpenCL::OpenCL ALIAS OpenCL) set_target_properties (OpenCL PROPERTIES VERSION 1\.0\.0 SOVERSION "1") if (WIN32) target_link_libraries (OpenCL PRIVATE cfgmgr32.lib runtimeobject.lib) # Generate a DLL without a "lib" prefix for mingw. if (MINGW OR MSYS OR CYGWIN) set_target_properties(OpenCL PROPERTIES PREFIX "") set_target_properties(OpenCL PROPERTIES LINK_FLAGS "-Wl,-disable-stdcall-fixup") endif() else() target_link_libraries (OpenCL PRIVATE ${CMAKE_THREAD_LIBS_INIT}) if (NOT APPLE) set_target_properties (OpenCL PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/loader/linux/icd_exports.map") if (OPENCL_ICD_LOADER_PIC) set_target_properties(OpenCL PROPERTIES POSITION_INDEPENDENT_CODE ON) endif () endif () endif () if (EXISTS ${OPENCL_ICD_LOADER_HEADERS_DIR}/CL/cl.h) message (STATUS "Defining OpenCL::Headers through OPENCL_ICD_LOADER_HEADERS_DIR") add_library (OpenCLHeaders INTERFACE) add_library (OpenCL::Headers ALIAS OpenCLHeaders) target_include_directories (OpenCLHeaders INTERFACE ${OPENCL_ICD_LOADER_HEADERS_DIR}) target_include_directories (OpenCL PUBLIC $) else () if (NOT TARGET OpenCL::Headers) find_package (OpenCLHeaders REQUIRED) endif () target_link_libraries (OpenCL PUBLIC OpenCL::Headers) endif () set (OPENCL_COMPILE_DEFINITIONS CL_TARGET_OPENCL_VERSION=300 CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES OPENCL_ICD_LOADER_VERSION_MAJOR=3 OPENCL_ICD_LOADER_VERSION_MINOR=0 OPENCL_ICD_LOADER_VERSION_REV=7 $<$:CL_ENABLE_LAYERS> $<$:CL_ENABLE_LOADER_MANAGED_DISPATCH> ) target_compile_definitions (OpenCL PRIVATE ${OPENCL_COMPILE_DEFINITIONS} ) target_include_directories (OpenCL PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader ) target_link_libraries (OpenCL PUBLIC ${CMAKE_DL_LIBS}) if (ENABLE_OPENCL_LAYERINFO) set (OPENCL_LAYER_INFO_SOURCES loader/cllayerinfo.c ${OPENCL_ICD_LOADER_SOURCES} ) add_executable(cllayerinfo ${OPENCL_LAYER_INFO_SOURCES}) add_executable(OpenCL::cllayerinfo ALIAS cllayerinfo) target_compile_definitions (cllayerinfo PRIVATE CL_LAYER_INFO ${OPENCL_COMPILE_DEFINITIONS} ) if (EXISTS ${OPENCL_ICD_LOADER_HEADERS_DIR}/CL/cl.h) target_include_directories (cllayerinfo PUBLIC $) else () target_link_libraries (cllayerinfo PUBLIC OpenCL::Headers) endif () if (WIN32) target_link_libraries (cllayerinfo PRIVATE cfgmgr32.lib runtimeobject.lib) else () target_link_libraries (cllayerinfo PRIVATE ${CMAKE_THREAD_LIBS_INIT}) endif () target_link_libraries (cllayerinfo PUBLIC ${CMAKE_DL_LIBS}) target_include_directories (cllayerinfo PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader ) endif () option (OPENCL_ICD_LOADER_BUILD_TESTING "Enable support for OpenCL ICD Loader testing." OFF) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR OPENCL_ICD_LOADER_BUILD_TESTING) include(CTest) endif() if((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR OPENCL_ICD_LOADER_BUILD_TESTING) AND BUILD_TESTING) add_subdirectory (test) endif() install( TARGETS OpenCL EXPORT OpenCLICDLoaderTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # obtained from GNUInstallDirs ) install( # FILES $ is cleanest, but is MSVC link.exe specific. LLVM's lld.exe and lld-link.exe don't support it (configure-time error) # FILES $/OpenCL.pdb looks OK, but even though there's a PDB, this prop is empty on non-MSVC toolchains FILES $/OpenCL.pdb # is the most implicit (expect PDB be next to the library), yet the only one that universally works DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL ) if (ENABLE_OPENCL_LAYERINFO) install( TARGETS cllayerinfo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT cllayerinfo ) endif() export( EXPORT OpenCLICDLoaderTargets FILE ${PROJECT_BINARY_DIR}/OpenCLICDLoader/OpenCLICDLoaderTargets.cmake NAMESPACE OpenCL:: ) file( WRITE ${PROJECT_BINARY_DIR}/OpenCLICDLoader/OpenCLICDLoaderConfig.cmake "include(\"\${CMAKE_CURRENT_LIST_DIR}/OpenCLICDLoaderTargets.cmake\")" ) set(config_package_location ${CMAKE_INSTALL_DATADIR}/cmake/OpenCLICDLoader) install( EXPORT OpenCLICDLoaderTargets FILE OpenCLICDLoaderTargets.cmake NAMESPACE OpenCL:: DESTINATION ${config_package_location} COMPONENT dev ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenCLICDLoader/OpenCLICDLoaderConfig.cmake DESTINATION ${config_package_location} COMPONENT dev ) unset(CMAKE_SIZEOF_VOID_P) include(CMakePackageConfigHelpers) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/OpenCLICDLoader/OpenCLICDLoaderConfigVersion.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenCLICDLoader/OpenCLICDLoaderConfigVersion.cmake DESTINATION ${config_package_location} COMPONENT dev ) # Separate namelink from shared library and symlink for DEB packaging install (TARGETS OpenCL LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime NAMELINK_SKIP) install (TARGETS OpenCL LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT dev NAMELINK_ONLY) OpenCL-ICD-Loader-2025.07.22/CODE_OF_CONDUCT.md000066400000000000000000000004301503776305700176450ustar00rootroot00000000000000A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil. OpenCL-ICD-Loader-2025.07.22/LICENSE000066400000000000000000000261351503776305700160650ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. OpenCL-ICD-Loader-2025.07.22/OpenCL.pc.in000066400000000000000000000003001503776305700171130ustar00rootroot00000000000000prefix=@PKGCONFIG_PREFIX@ exec_prefix=${prefix} libdir=@OPENCL_LIBDIR_PC@ Name: OpenCL Description: Khronos OpenCL ICD Loader Requires: OpenCL-Headers Version: 3.0 Libs: -L${libdir} -lOpenCL OpenCL-ICD-Loader-2025.07.22/README.md000066400000000000000000000173531503776305700163410ustar00rootroot00000000000000# OpenCLTM ICD Loader This repo contains the source code and tests for the Khronos official OpenCL ICD Loader. ## CI Build Status [![Windows Build Status](https://github.com/KhronosGroup/OpenCL-ICD-Loader/workflows/Windows/badge.svg)](https://github.com/KhronosGroup/OpenCL-ICD-Loader/actions?query=workflow%3AWindows) [![Linux Build Status](https://github.com/KhronosGroup/OpenCL-ICD-Loader/workflows/Linux/badge.svg)](https://github.com/KhronosGroup/OpenCL-ICD-Loader/actions?query=workflow%3ALinux) [![MacOS Build Status](https://github.com/KhronosGroup/OpenCL-ICD-Loader/workflows/MacOS/badge.svg)](https://github.com/KhronosGroup/OpenCL-ICD-Loader/actions?query=workflow%3AMacOS) ## Introduction OpenCL defines an *Installable Client Driver* (ICD) mechanism to allow developers to build applications against an *Installable Client Driver* loader (ICD loader) rather than linking their applications against a specific OpenCL implementation. The ICD Loader is responsible for: * Exporting OpenCL API entry points * Enumerating OpenCL implementations * Forwarding OpenCL API calls to the correct implementation This repo contains the source code and tests for the Khronos official OpenCL ICD Loader. Note that this repo does not contain an OpenCL implementation (ICD). You will need to obtain and install an OpenCL implementation for your OpenCL device that supports the OpenCL ICD extension `cl_khr_icd` to run an application using the OpenCL ICD Loader. The OpenCL *Installable Client Driver* extension (`cl_khr_icd`) is described in the OpenCL extensions specification, which may be found on the [Khronos OpenCL Registry](https://www.khronos.org/registry/OpenCL/). ## Build Instructions > While the ICD Loader can be built and installed in isolation, it is part of the [OpenCL SDK](https://github.com/KhronosGroup/OpenCL-SDK). If looking for streamlined build experience and a complete development package, refer to the SDK build instructions instead of the following guide. ### Dependencies The OpenCL ICD Loader requires: - the [OpenCL Headers](https://github.com/KhronosGroup/OpenCL-Headers/). - It is recommended to install the headers via CMake, however a convenience shorthand is provided. Providing `OPENCL_ICD_LOADER_HEADERS_DIR` to CMake, one may specify the location of OpenCL Headers. By default, the OpenCL ICD Loader will look for OpenCL Headers in the inc directory. - The OpenCL ICD Loader uses CMake for its build system. If CMake is not provided by your build system or OS package manager, please consult the [CMake website](https://cmake.org). ### Example Build For most Windows and Linux usages, the following steps are sufficient to build the OpenCL ICD Loader: 1. Clone this repo and the OpenCL Headers: git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader git clone https://github.com/KhronosGroup/OpenCL-Headers 1. Install OpenCL Headers CMake package cmake -D CMAKE_INSTALL_PREFIX=./OpenCL-Headers/install -S ./OpenCL-Headers -B ./OpenCL-Headers/build cmake --build ./OpenCL-Headers/build --target install 1. Build and install OpenCL ICD Loader CMake package. _(Note that `CMAKE_PREFIX_PATH` need to be an absolute path. Update as needed.)_ cmake -D CMAKE_PREFIX_PATH=/absolute/path/to/OpenCL-Headers/install -D CMAKE_INSTALL_PREFIX=./OpenCL-ICD-Loader/install -S ./OpenCL-ICD-Loader -B ./OpenCL-ICD-Loader/build cmake --build ./OpenCL-ICD-Loader/build --target install Notes: * For x64 Windows builds, you need to instruct the default Visual Studio generator by adding `-A x64` to all your command-lines. * Some users may prefer to use a CMake GUI frontend, such as `cmake-gui` or `ccmake`, vs. the command-line CMake. ### Example Use Example CMake invocation ```bash cmake -D CMAKE_PREFIX_PATH="/chosen/install/prefix/of/headers;/chosen/install/prefix/of/loader" /path/to/opencl/app ``` and sample `CMakeLists.txt` ```cmake cmake_minimum_required(VERSION 3.0) cmake_policy(VERSION 3.0...3.18.4) project(proj) add_executable(app main.cpp) find_package(OpenCLHeaders REQUIRED) find_package(OpenCLICDLoader REQUIRED) target_link_libraries(app PRIVATE OpenCL::Headers OpenCL::OpenCL) ``` ## OpenCL ICD Loader Tests OpenCL ICD Loader Tests can be run using `ctest` from the `build` directory. CTest which is a companion to CMake. The OpenCL ICD Loader Tests can also be run directly by executing `icd_loader_test[.exe]` executable from the bin folder. _(Note that running the tests manually requires setting up it's env manually, by setting `OCL_ICD_FILENAMES` to the full path of `libOpenCLDriverStub.so`/`OpenCLDriverStub.dll`, something otherwise done by CTest.)_ ## Registering ICDs The method to installing an ICD is operating system dependent. ### Registering an ICD on Linux Install your ICD by creating a file with the full path to the library of your implementation in `/etc/OpenCL/vendors` for eg.: echo full/path/to/libOpenCLDriverStub.so > /etc/OpenCL/vendors/test.icd ### Registering an ICD on Windows Install your ICD by adding a `REG_DWORD` value to the registry keys: // For 32-bit operating systems, or 64-bit tests on a 64-bit operating system: HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors // For 32-bit tests on a 64-bit operating system: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Khronos\OpenCL\Vendors // The name of the REG_DWORD value should be the full path to the library of your implementation, for eg. // OpenCLDriverStub.dll, and the data for this value should be 0. ## About Layers Layers have been added as an experimental feature in the OpenCL ICD Loader. We do not expect the API or ABI to change significantly, but the OpenCL Working Group reserves the right to do so. The layer support can also be completely deactivated during configuration by using the `ENABLE_OPENCL_LAYERS` (`ON` by default) cmake variable: ```bash cmake -DENABLE_OPENCL_LAYERS=OFF ``` For now, runtime configuration of layers is done using the `OPENCL_LAYERS` environment variable. A colon (Linux) or semicolon (Windows) list of layers to use can be provided through this environment variable. We are looking for feedback. ## Support Please create a GitHub issue to report an issue or ask questions. ## Contributing Contributions to the OpenCL ICD Loader are welcomed and encouraged. You will be prompted with a one-time "click-through" CLA dialog as part of submitting your pull request or other contribution to GitHub. ## Table of Debug Environment Variables The following debug environment variables are available for use with the OpenCL ICD loader: | Environment Variable | Behavior | Example Format | |:---------------------------------:|---------------------|----------------------| | OCL_ICD_FILENAMES | Specifies a list of additional ICDs to load. The ICDs will be enumerated first, before any ICDs discovered via default mechanisms. | `export OCL_ICD_FILENAMES=libVendorA.so:libVendorB.so`

`set OCL_ICD_FILENAMES=vendor_a.dll;vendor_b.dll` | | OCL_ICD_VENDORS | On Linux and Android, specifies a directory to scan for ICDs to enumerate in place of the default `/etc/OpenCL/vendors'. | `export OCL_ICD_VENDORS=/my/local/icd/search/path` | | OPENCL_LAYERS | Specifies a list of layers to load. | `export OPENCL_LAYERS=libLayerA.so:libLayerB.so`

`set OPENCL_LAYERS=libLayerA.dll;libLayerB.dll` | | OPENCL_LAYER_PATH | On Linux and Android, specifies a directory to scan for layers to enumerate in place of the default `/etc/OpenCL/layers'. | `export OPENCL_LAYER_PATH=/my/local/layers/search/path` | | OCL_ICD_ENABLE_TRACE | Enable the trace mechanism | `export OCL_ICD_ENABLE_TRACE=True`

`set OCL_ICD_ENABLE_TRACE=True`
`true, T, 1 can also be used here.` | OpenCL-ICD-Loader-2025.07.22/cmake/000077500000000000000000000000001503776305700161315ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/cmake/DebSourcePkg.cmake000066400000000000000000000151351503776305700214550ustar00rootroot00000000000000# This script produces the changelog, control and rules file in the debian # directory. These files are needed to build a Debian source package from the repository. # Run this in CMake script mode, e.g. # $ cd OpenCL-ICD-Loader # $ cmake -S . -B ../build -D BUILD_TESTING=OFF # $ cmake # -DCMAKE_CACHE_PATH=../build/CMakeCache.txt # -DCPACK_DEBIAN_PACKAGE_MAINTAINER="Example Name " # -DDEBIAN_DISTROSERIES=jammy # -DORIG_ARCHIVE=../OpenCL-ICD-Loader.tar.gz # -DLATEST_RELEASE_VERSION=v2023.08.29 # -P cmake/DebSourcePkg.cmake # $ debuild -S -sa cmake_minimum_required(VERSION 3.21) # file(COPY_FILE) is added in CMake 3.21 if(NOT EXISTS "${CMAKE_CACHE_PATH}") message(FATAL_ERROR "CMAKE_CACHE_PATH is not set or does not exist") endif() if(NOT DEFINED DEBIAN_PACKAGE_MAINTAINER) message(FATAL_ERROR "DEBIAN_PACKAGE_MAINTAINER is not set") endif() if(NOT DEFINED DEBIAN_DISTROSERIES) message(FATAL_ERROR "DEBIAN_DISTROSERIES is not set") endif() if(NOT DEFINED ORIG_ARCHIVE) message(WARNING "ORIG_ARCHIVE is not set") elseif(NOT EXISTS "${ORIG_ARCHIVE}") message(FATAL_ERROR "ORIG_ARCHIVE is defined, but the file does not exist at \"${ORIG_ARCHIVE}\"") endif() if(NOT DEFINED LATEST_RELEASE_VERSION) message(WARNING "LATEST_RELEASE_VERSION is not set") endif() if(NOT DEFINED DEBIAN_VERSION_SUFFIX) message(WARNING "DEBIAN_VERSION_SUFFIX is not set") endif() # Extracting the project version from the main CMakeLists.txt via regex file(READ "${CMAKE_CACHE_PATH}" CMAKE_CACHE) string(REGEX MATCH "CMAKE_PROJECT_VERSION[^=]*=([^\n]*)" REGEX_MATCH "${CMAKE_CACHE}") if(NOT REGEX_MATCH) message(FATAL_ERROR "Could not extract project version from CMakeLists.txt") endif() set(PROJECT_VERSION "${CMAKE_MATCH_1}") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") # Package.cmake contains all details for packaging include(PackageSetup) # Append a space after every newline in the description. This format is required # in the control file. string(REPLACE "\n" "\n " CPACK_DEBIAN_DEV_DESCRIPTION "${CPACK_DEBIAN_DEV_DESCRIPTION}") string(REPLACE "\n" "\n " CPACK_DEBIAN_RUNTIME_DESCRIPTION "${CPACK_DEBIAN_RUNTIME_DESCRIPTION}") string(REPLACE "\n" "\n " CPACK_DEBIAN_CLLAYERINFO_DESCRIPTION "${CPACK_DEBIAN_CLLAYERINFO_DESCRIPTION}") set(DEB_SOURCE_PKG_DIR "${CMAKE_CURRENT_LIST_DIR}/../debian") # Write debian/control file(WRITE "${DEB_SOURCE_PKG_DIR}/control" "Source: ${PACKAGE_NAME_PREFIX} Section: ${CPACK_DEBIAN_DEV_PACKAGE_SECTION} Priority: optional Maintainer: ${DEBIAN_PACKAGE_MAINTAINER} Build-Depends: cmake, debhelper-compat (=13), opencl-c-headers Rules-Requires-Root: no Homepage: ${CPACK_DEBIAN_PACKAGE_HOMEPAGE} Standards-Version: 4.6.2 Package: ${CPACK_DEBIAN_DEV_PACKAGE_NAME} Architecture: any Multi-Arch: same Depends: ${CPACK_DEBIAN_DEV_PACKAGE_DEPENDS}, ${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME} (=${PACKAGE_VERSION_REVISION}) Recommends: ${CPACK_DEBIAN_DEV_PACKAGE_RECOMMENDS} Conflicts: ${CPACK_DEBIAN_DEV_PACKAGE_CONFLICTS} Breaks: ${CPACK_DEBIAN_DEV_PACKAGE_BREAKS} Replaces: ${CPACK_DEBIAN_DEV_PACKAGE_REPLACES} Provides: ${CPACK_DEBIAN_DEV_PACKAGE_PROVIDES} Description: ${CPACK_DEBIAN_DEV_DESCRIPTION} Package: ${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME} Section: ${CPACK_DEBIAN_RUNTIME_PACKAGE_SECTION} Architecture: any Multi-Arch: same Depends: ${CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS} # Conflicts and replaces deliberately not added # The runtime package provides libOpenCL.so.1.0.0 and libOpenCL.so.1 via update-alternatives # Conflicts: ${CPACK_DEBIAN_RUNTIME_PACKAGE_CONFLICTS} # Replaces: ${CPACK_DEBIAN_RUNTIME_PACKAGE_REPLACES} Provides: ${CPACK_DEBIAN_RUNTIME_PACKAGE_PROVIDES} Description: ${CPACK_DEBIAN_RUNTIME_DESCRIPTION} Package: ${CPACK_DEBIAN_CLLAYERINFO_PACKAGE_NAME} Section: ${CPACK_DEBIAN_CLLAYERINFO_PACKAGE_SECTION} Architecture: any Depends: ${CPACK_DEBIAN_CLLAYERINFO_PACKAGE_DEPENDS}, ${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME} (=${PACKAGE_VERSION_REVISION}) Conflicts: ${CPACK_DEBIAN_CLLAYERINFO_PACKAGE_CONFLICTS} Replaces: ${CPACK_DEBIAN_CLLAYERINFO_PACKAGE_REPLACES} Provides: ${CPACK_DEBIAN_CLLAYERINFO_PACKAGE_PROVIDES} Description: ${CPACK_DEBIAN_CLLAYERINFO_DESCRIPTION} " ) # Write debian/changelog string(TIMESTAMP CURRENT_TIMESTAMP "%a, %d %b %Y %H:%M:%S +0000" UTC) file(WRITE "${DEB_SOURCE_PKG_DIR}/changelog" "${PACKAGE_NAME_PREFIX} (${PACKAGE_VERSION_REVISION}) ${DEBIAN_DISTROSERIES}; urgency=medium * Released version ${PACKAGE_VERSION_REVISION} -- ${DEBIAN_PACKAGE_MAINTAINER} ${CURRENT_TIMESTAMP} ") # Write debian/rules file(WRITE "${DEB_SOURCE_PKG_DIR}/rules" "#!/usr/bin/make -f %: \tdh $@ override_dh_auto_configure: \tdh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF GENERATED_MAINTAINER_SCRIPTS := $(patsubst %.in,%,$(wildcard debian/*.alternatives.in)) $(GENERATED_MAINTAINER_SCRIPTS): %: %.in \tsed \"s%@DEB_HOST_MULTIARCH@%$(DEB_HOST_MULTIARCH)%g\" < $< > $@ execute_before_dh_install: $(GENERATED_MAINTAINER_SCRIPTS) \ttrue # An empty rule would confuse dh ") file(WRITE "${DEB_SOURCE_PKG_DIR}/${CPACK_DEBIAN_DEV_PACKAGE_NAME}.install" "usr/lib/*/pkgconfig usr/lib/*/lib*.so usr/share ") # The .so files are installed to a different directory, and then linked back # the the original location via update-alternatives. file(WRITE "${DEB_SOURCE_PKG_DIR}/${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME}.install" "usr/lib/*/lib*.so.* usr/lib/\${DEB_HOST_MULTIARCH}/KhronosOpenCLICDLoader ") file(WRITE "${DEB_SOURCE_PKG_DIR}/${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME}.alternatives.in" "Name: libOpenCL.so.1.0.0-@DEB_HOST_MULTIARCH@ Link: /usr/lib/@DEB_HOST_MULTIARCH@/libOpenCL.so.1.0.0 Alternative: /usr/lib/@DEB_HOST_MULTIARCH@/KhronosOpenCLICDLoader/libOpenCL.so.1.0.0 Dependents: /usr/lib/@DEB_HOST_MULTIARCH@/libOpenCL.so.1 libOpenCL.so.1-@DEB_HOST_MULTIARCH@ /usr/lib/@DEB_HOST_MULTIARCH@/KhronosOpenCLICDLoader/libOpenCL.so.1 Priority: 100 ") file(WRITE "${DEB_SOURCE_PKG_DIR}/${CPACK_DEBIAN_CLLAYERINFO_PACKAGE_NAME}.install" "usr/bin ") if(DEFINED ORIG_ARCHIVE) # Copy the passed orig.tar.gz file. The target filename is deduced from the version number, as expected by debuild cmake_path(IS_ABSOLUTE ORIG_ARCHIVE IS_ORIG_ARCHIVE_ABSOLUTE) if (NOT IS_ORIG_ARCHIVE_ABSOLUTE) message(FATAL_ERROR "ORIG_ARCHIVE must be an absolute path (passed: \"${ORIG_ARCHIVE}\")") endif() cmake_path(GET ORIG_ARCHIVE EXTENSION ORIG_ARCHIVE_EXT) cmake_path(GET ORIG_ARCHIVE PARENT_PATH ORIG_ARCHIVE_PARENT) set(TARGET_PATH "${ORIG_ARCHIVE_PARENT}/${PACKAGE_NAME_PREFIX}_${CPACK_DEBIAN_PACKAGE_VERSION}${ORIG_ARCHIVE_EXT}") message(STATUS "Copying \"${ORIG_ARCHIVE}\" to \"${TARGET_PATH}\"") file(COPY_FILE "${ORIG_ARCHIVE}" "${TARGET_PATH}") endif() OpenCL-ICD-Loader-2025.07.22/cmake/JoinPaths.cmake000066400000000000000000000016771503776305700210450ustar00rootroot00000000000000# This module provides function for joining paths # known from from most languages # # Original license: # SPDX-License-Identifier: (MIT OR CC0-1.0) # Explicit permission given to distribute this module under # the terms of the project as described in /LICENSE.rst. # Copyright 2020 Jan Tojnar # https://github.com/jtojnar/cmake-snips # # Modelled after Python’s os.path.join # https://docs.python.org/3.7/library/os.path.html#os.path.join # Windows not supported function(join_paths joined_path first_path_segment) set(temp_path "${first_path_segment}") foreach(current_segment IN LISTS ARGN) if(NOT ("${current_segment}" STREQUAL "")) if(IS_ABSOLUTE "${current_segment}") set(temp_path "${current_segment}") else() set(temp_path "${temp_path}/${current_segment}") endif() endif() endforeach() set(${joined_path} "${temp_path}" PARENT_SCOPE) endfunction() OpenCL-ICD-Loader-2025.07.22/cmake/Package.cmake000066400000000000000000000024151503776305700204700ustar00rootroot00000000000000include("${CMAKE_CURRENT_LIST_DIR}/PackageSetup.cmake") # Configuring pkgconfig # We need two different instances of OpenCL.pc # One for installing (cmake --install), which contains CMAKE_INSTALL_PREFIX as prefix # And another for the Debian development package, which contains CPACK_PACKAGING_INSTALL_PREFIX as prefix join_paths(OPENCL_INCLUDEDIR_PC "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") join_paths(OPENCL_LIBDIR_PC "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}") set(pkg_config_location ${CMAKE_INSTALL_LIBDIR}/pkgconfig) set(PKGCONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}") # Configure and install OpenCL.pc for installing the project configure_file( OpenCL.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig_install/OpenCL.pc @ONLY) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig_install/OpenCL.pc DESTINATION ${pkg_config_location} COMPONENT pkgconfig_install) # Configure and install OpenCL.pc for the Debian package set(PKGCONFIG_PREFIX "${CPACK_PACKAGING_INSTALL_PREFIX}") configure_file( OpenCL.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig_package/OpenCL.pc @ONLY) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig_package/OpenCL.pc DESTINATION ${pkg_config_location} COMPONENT dev EXCLUDE_FROM_ALL) set(CPACK_DEBIAN_PACKAGE_DEBUG ON) include(CPack) OpenCL-ICD-Loader-2025.07.22/cmake/PackageSetup.cmake000066400000000000000000000130241503776305700215070ustar00rootroot00000000000000set(CPACK_PACKAGE_VENDOR "khronos") set(CPACK_DEBIAN_RUNTIME_DESCRIPTION "Generic OpenCL ICD Loader OpenCL (Open Computing Language) is a multivendor open standard for general-purpose parallel programming of heterogeneous systems that include CPUs, GPUs and other processors. . This package contains an installable client driver loader (ICD Loader) library that can be used to load any (free or non-free) installable client driver (ICD) for OpenCL. It acts as a demultiplexer so several ICD can be installed and used together.") set(CPACK_DEBIAN_DEV_DESCRIPTION "OpenCL development files OpenCL (Open Computing Language) is a multivendor open standard for general-purpose parallel programming of heterogeneous systems that include CPUs, GPUs and other processors. . This package provides the development files: headers and libraries. . It also ensures that the ocl-icd ICD loader is installed so its additional features (compared to the OpenCL norm) can be used: .pc file, ability to select an ICD without root privilege, etc.") set(CPACK_DEBIAN_CLLAYERINFO_DESCRIPTION "Query OpenCL Layer system information OpenCL (Open Computing Language) is a multivendor open standard for general-purpose parallel programming of heterogeneous systems that include CPUs, GPUs and other processors. It supports system and user configured layers to intercept OpenCL API calls. . This package contains a tool that lists the layers loaded by the the ocl-icd OpenCL ICD Loader.") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") if(NOT CPACK_PACKAGING_INSTALL_PREFIX) set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") endif() # DEB packaging configuration set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_VENDOR}) set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/KhronosGroup/OpenCL-ICD-Loader") # Version number [epoch:]upstream_version[-debian_revision] set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}") # upstream_version if(DEFINED LATEST_RELEASE_VERSION) # Remove leading "v", if exists string(LENGTH "${LATEST_RELEASE_VERSION}" LATEST_RELEASE_VERSION_LENGTH) string(SUBSTRING "${LATEST_RELEASE_VERSION}" 0 1 LATEST_RELEASE_VERSION_FRONT) if(LATEST_RELEASE_VERSION_FRONT STREQUAL "v") string(SUBSTRING "${LATEST_RELEASE_VERSION}" 1 ${LATEST_RELEASE_VERSION_LENGTH} LATEST_RELEASE_VERSION) endif() string(APPEND CPACK_DEBIAN_PACKAGE_VERSION "~${LATEST_RELEASE_VERSION}") endif() set(CPACK_DEBIAN_PACKAGE_RELEASE "1") # debian_revision (because this is a # non-native pkg) set(PACKAGE_VERSION_REVISION "${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}${DEBIAN_VERSION_SUFFIX}") # Get architecture execute_process(COMMAND dpkg "--print-architecture" OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE) string(STRIP "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" CPACK_DEBIAN_PACKAGE_ARCHITECTURE) ########################################################## # Components # ########################################################## set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS OFF) # Component dependencies are NOT reflected in package relationships set(CPACK_COMPONENTS_ALL runtime dev cllayerinfo) set(PACKAGE_NAME_PREFIX "khronos-opencl-loader") ## Package runtime component set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "${PACKAGE_NAME_PREFIX}-libopencl1") # Package file name in deb format: # _-_.deb set(CPACK_DEBIAN_RUNTIME_FILE_NAME "${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME}_${PACKAGE_VERSION_REVISION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") set(CPACK_DEBIAN_RUNTIME_PACKAGE_SECTION "libs") # Dependencies set(CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS "libc6") set(CPACK_DEBIAN_RUNTIME_PACKAGE_SUGGESTS "opencl-icd") set(CPACK_DEBIAN_RUNTIME_PACKAGE_CONFLICTS "amd-app, libopencl1, nvidia-libopencl1-dev") set(CPACK_DEBIAN_RUNTIME_PACKAGE_REPLACES "amd-app, libopencl1, nvidia-libopencl1-dev") set(CPACK_DEBIAN_RUNTIME_PACKAGE_PROVIDES "libopencl-1.1-1, libopencl-1.2-1, libopencl-2.0-1, libopencl-2.1-1, libopencl-2.2-1, libopencl-3.0-1, libopencl1") ## Package dev component set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${PACKAGE_NAME_PREFIX}-opencl-dev") # Package file name in deb format: # _-_.deb set(CPACK_DEBIAN_DEV_FILE_NAME "${CPACK_DEBIAN_DEV_PACKAGE_NAME}_${PACKAGE_VERSION_REVISION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") set(CPACK_DEBIAN_DEV_PACKAGE_SECTION "libdevel") # Dependencies set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "opencl-c-headers (>= ${CPACK_DEBIAN_PACKAGE_VERSION}) | opencl-headers (>= ${CPACK_DEBIAN_PACKAGE_VERSION}), ${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME} (>= ${CPACK_DEBIAN_PACKAGE_VERSION}) | libopencl1") set(CPACK_DEBIAN_DEV_PACKAGE_RECOMMENDS "libgl1-mesa-dev | libgl-dev") set(CPACK_DEBIAN_DEV_PACKAGE_CONFLICTS "opencl-dev") set(CPACK_DEBIAN_DEV_PACKAGE_BREAKS "amd-libopencl1, nvidia-libopencl1") set(CPACK_DEBIAN_DEV_PACKAGE_REPLACES "amd-libopencl1, nvidia-libopencl1, opencl-dev") set(CPACK_DEBIAN_DEV_PACKAGE_PROVIDES "opencl-dev") ## Package cllayerinfo component set(CPACK_DEBIAN_CLLAYERINFO_PACKAGE_NAME "${PACKAGE_NAME_PREFIX}-cllayerinfo") set(CPACK_DEBIAN_CLLAYERINFO_FILE_NAME "${CPACK_DEBIAN_CLLAYERINFO_PACKAGE_NAME}_${PACKAGE_VERSION_REVISION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") # Dependencies set(CPACK_DEBIAN_CLLAYERINFO_PACKAGE_DEPENDS "libc6") set(CPACK_DEBIAN_CLLAYERINFO_PACKAGE_SECTION "admin") OpenCL-ICD-Loader-2025.07.22/inc/000077500000000000000000000000001503776305700156225ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/inc/README.txt000066400000000000000000000004631503776305700173230ustar00rootroot00000000000000Copy or symlink OpenCL headers here, inside a CL directory, so that the structure of the inc directory looks something like this: inc/CL/cl_d3d10.h inc/CL/cl_d3d11.h inc/CL/cl_dx9_media_sharing.h inc/CL/cl_egl.h inc/CL/cl_ext.h inc/CL/cl_gl.h inc/CL/cl.h inc/CL/cl.hpp inc/CL/cl_platform.h inc/CL/opencl.h OpenCL-ICD-Loader-2025.07.22/include/000077500000000000000000000000001503776305700164745ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/include/cl_khr_icd2.h000066400000000000000000000024641503776305700210160ustar00rootroot00000000000000/* * Copyright (c) 2016-2025 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #if !defined(CL_ICD2_TAG_KHR) #if INTPTR_MAX == INT32_MAX #define CL_ICD2_TAG_KHR ((intptr_t)0x434C3331) #else #define CL_ICD2_TAG_KHR ((intptr_t)0x4F50454E434C3331) #endif typedef void * CL_API_CALL clIcdGetFunctionAddressForPlatformKHR_t( cl_platform_id platform, const char* func_name); typedef clIcdGetFunctionAddressForPlatformKHR_t * clIcdGetFunctionAddressForPlatformKHR_fn; typedef cl_int CL_API_CALL clIcdSetPlatformDispatchDataKHR_t( cl_platform_id platform, void *disp_data); typedef clIcdSetPlatformDispatchDataKHR_t * clIcdSetPlatformDispatchDataKHR_fn; #endif // !defined(CL_ICD2_TAG_KHR) OpenCL-ICD-Loader-2025.07.22/loader/000077500000000000000000000000001503776305700163175ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/loader/cllayerinfo.c000066400000000000000000000062301503776305700207730ustar00rootroot00000000000000/* * Copyright (c) 2022 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd.h" #include #include #include #if defined(_WIN32) #include #include #include #else #include #endif #include int stdout_bak, stderr_bak; // Temporarily deactivate stdout: // https://stackoverflow.com/a/4832902 #if defined(_WIN32) #define SECURE 1 #define OPEN _open #define OPEN_FLAGS _O_WRONLY #define CLOSE _close #define DUP _dup #define DUP2 _dup2 #define NULL_STREAM "nul" #else #define OPEN open #define OPEN_FLAGS O_WRONLY #define CLOSE close #define DUP dup #define DUP2 dup2 #define NULL_STREAM "/dev/null" #endif static inline int silence_stream(FILE *file, int fd) { int new_fd, fd_bak; fflush(file); fd_bak = DUP(fd); #if defined(_WIN32) && SECURE _sopen_s(&new_fd, NULL_STREAM, OPEN_FLAGS, _SH_DENYNO, _S_IWRITE); #else new_fd = OPEN(NULL_STREAM, OPEN_FLAGS); #endif DUP2(new_fd, fd); CLOSE(new_fd); return fd_bak; } static void silence_layers(void) { stdout_bak = silence_stream(stdout, 1); stderr_bak = silence_stream(stderr, 2); } static inline void restore_stream(FILE *file, int fd, int fd_bak) { fflush(file); DUP2(fd_bak, fd); CLOSE(fd_bak); } static void restore_outputs(void) { restore_stream(stdout, 1, stdout_bak); restore_stream(stderr, 2, stderr_bak); } void printLayerInfo(const struct KHRLayer *layer) { cl_layer_api_version api_version = 0; pfn_clGetLayerInfo p_clGetLayerInfo = (pfn_clGetLayerInfo)(size_t)layer->p_clGetLayerInfo; cl_int result = CL_SUCCESS; size_t sz; printf("%s:\n", layer->libraryName); result = p_clGetLayerInfo(CL_LAYER_API_VERSION, sizeof(api_version), &api_version, NULL); if (CL_SUCCESS == result) printf("\tCL_LAYER_API_VERSION: %d\n", (int)api_version); result = p_clGetLayerInfo(CL_LAYER_NAME, 0, NULL, &sz); if (CL_SUCCESS == result) { char *name = (char *)malloc(sz); if (name) { result = p_clGetLayerInfo(CL_LAYER_NAME, sz, name, NULL); if (CL_SUCCESS == result) printf("\tCL_LAYER_NAME: %s\n", name); free(name); } } } int main (int argc, char *argv[]) { (void)argc; (void)argv; silence_layers(); atexit(restore_outputs); khrIcdInitialize(); restore_outputs(); atexit(silence_layers); const struct KHRLayer *layer = khrFirstLayer; while (layer) { printLayerInfo(layer); layer = layer->next; } return 0; } OpenCL-ICD-Loader-2025.07.22/loader/icd.c000066400000000000000000000350411503776305700172250ustar00rootroot00000000000000/* * Copyright (c) 2016-2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd.h" #include "icd_dispatch.h" #include "icd_envvars.h" #if defined(CL_ENABLE_LAYERS) #include #endif // defined(CL_ENABLE_LAYERS) #include #include KHRicdVendor *khrIcdVendors = NULL; int khrEnableTrace = 0; #if defined(CL_ENABLE_LAYERS) struct KHRLayer *khrFirstLayer = NULL; #endif // defined(CL_ENABLE_LAYERS) // entrypoint to check and initialize trace. void khrIcdInitializeTrace(void) { char *enableTrace = khrIcd_getenv("OCL_ICD_ENABLE_TRACE"); if (enableTrace && (strcmp(enableTrace, "True") == 0 || strcmp(enableTrace, "true") == 0 || strcmp(enableTrace, "T") == 0 || strcmp(enableTrace, "1") == 0)) { khrEnableTrace = 1; } } // entrypoint to initialize the ICD and add all vendors void khrIcdInitialize(void) { // enumerate vendors present on the system khrIcdOsVendorsEnumerateOnce(); } void khrIcdVendorAdd(const char *libraryName) { void *library = NULL; cl_int result = CL_SUCCESS; pfn_clGetExtensionFunctionAddress p_clGetExtensionFunctionAddress = NULL; pfn_clIcdGetPlatformIDs p_clIcdGetPlatformIDs = NULL; #if defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) clIcdGetFunctionAddressForPlatformKHR_fn p_clIcdGetFunctionAddressForPlatform = NULL; clIcdSetPlatformDispatchDataKHR_fn p_clIcdSetPlatformDispatchData = NULL; #endif cl_uint i = 0; cl_uint platformCount = 0; cl_platform_id *platforms = NULL; KHRicdVendor *vendorIterator = NULL; // require that the library name be valid if (!libraryName) { goto Done; } KHR_ICD_TRACE("attempting to add vendor %s...\n", libraryName); // load its library and query its function pointers library = khrIcdOsLibraryLoad(libraryName); if (!library) { KHR_ICD_TRACE("failed to load library %s\n", libraryName); goto Done; } // ensure that we haven't already loaded this vendor for (vendorIterator = khrIcdVendors; vendorIterator; vendorIterator = vendorIterator->next) { if (vendorIterator->library == library) { KHR_ICD_TRACE("already loaded vendor %s, nothing to do here\n", libraryName); goto Done; } } // get the library's clGetExtensionFunctionAddress pointer p_clGetExtensionFunctionAddress = (pfn_clGetExtensionFunctionAddress)(size_t)khrIcdOsLibraryGetFunctionAddress(library, "clGetExtensionFunctionAddress"); if (!p_clGetExtensionFunctionAddress) { KHR_ICD_TRACE("failed to get function address clGetExtensionFunctionAddress\n"); goto Done; } // use that function to get the clIcdGetPlatformIDsKHR function pointer p_clIcdGetPlatformIDs = (pfn_clIcdGetPlatformIDs)(size_t)p_clGetExtensionFunctionAddress("clIcdGetPlatformIDsKHR"); if (!p_clIcdGetPlatformIDs) { KHR_ICD_TRACE("failed to get extension function address clIcdGetPlatformIDsKHR\n"); goto Done; } #if defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) // try to get clIcdGetFunctionAddressForPlatformKHR and clIcdSetPlatformDispatchDataKHR to detect cl_khr_icd2 support p_clIcdGetFunctionAddressForPlatform = (clIcdGetFunctionAddressForPlatformKHR_fn)(size_t)p_clGetExtensionFunctionAddress("clIcdGetFunctionAddressForPlatformKHR"); p_clIcdSetPlatformDispatchData = (clIcdSetPlatformDispatchDataKHR_fn)(size_t)p_clGetExtensionFunctionAddress("clIcdSetPlatformDispatchDataKHR"); #endif // query the number of platforms available and allocate space to store them result = p_clIcdGetPlatformIDs(0, NULL, &platformCount); if (CL_SUCCESS != result) { KHR_ICD_TRACE("failed clIcdGetPlatformIDs\n"); goto Done; } platforms = (cl_platform_id *)malloc(platformCount * sizeof(cl_platform_id) ); if (!platforms) { KHR_ICD_TRACE("failed to allocate memory\n"); goto Done; } memset(platforms, 0, platformCount * sizeof(cl_platform_id) ); result = p_clIcdGetPlatformIDs(platformCount, platforms, NULL); if (CL_SUCCESS != result) { KHR_ICD_TRACE("failed clIcdGetPlatformIDs\n"); goto Done; } // for each platform, add it for (i = 0; i < platformCount; ++i) { KHRicdVendor* vendor = NULL; char *suffix; size_t suffixSize; // skip NULL platforms and non dispatchable platforms if (!platforms[i] || !platforms[i]->dispatch) { continue; } #if defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) if (KHR_ICD2_HAS_TAG(platforms[i]) && !p_clIcdGetFunctionAddressForPlatform) { KHR_ICD_TRACE("found icd 2 object, but platform is missing clIcdGetFunctionAddressForPlatformKHR\n"); continue; } if (KHR_ICD2_HAS_TAG(platforms[i]) && !p_clIcdSetPlatformDispatchData) { KHR_ICD_TRACE("found icd 2 object, but platform is missing clIcdSetPlatformDispatchDataKHR\n"); continue; } if (KHR_ICD2_HAS_TAG(platforms[i]) && !((intptr_t)((platforms[i])->dispatch->clUnloadCompiler) == CL_ICD2_TAG_KHR)) { KHR_ICD_TRACE("found icd 2 object, but platform is missing tag in clUnloadCompiler\n"); continue; } #endif // allocate a structure for the vendor vendor = (KHRicdVendor*)malloc(sizeof(*vendor) ); if (!vendor) { KHR_ICD_TRACE("failed to allocate memory\n"); continue; } memset(vendor, 0, sizeof(*vendor)); #if defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) // populate cl_khr_icd2 platform's loader managed dispatch tables if (KHR_ICD2_HAS_TAG(platforms[i])) { khrIcd2PopulateDispatchTable(platforms[i], p_clIcdGetFunctionAddressForPlatform, &vendor->dispData.dispatch); p_clIcdSetPlatformDispatchData(platforms[i], &vendor->dispData); KHR_ICD_TRACE("found icd 2 platform, using loader managed dispatch\n"); } #endif // call clGetPlatformInfo on the returned platform to get the suffix result = KHR_ICD2_DISPATCH(platforms[i])->clGetPlatformInfo( platforms[i], CL_PLATFORM_ICD_SUFFIX_KHR, 0, NULL, &suffixSize); if (CL_SUCCESS != result) { free(vendor); continue; } suffix = (char *)malloc(suffixSize); if (!suffix) { free(vendor); continue; } result = KHR_ICD2_DISPATCH(platforms[i])->clGetPlatformInfo( platforms[i], CL_PLATFORM_ICD_SUFFIX_KHR, suffixSize, suffix, NULL); if (CL_SUCCESS != result) { free(suffix); free(vendor); continue; } // populate vendor data vendor->library = khrIcdOsLibraryLoad(libraryName); if (!vendor->library) { free(suffix); free(vendor); KHR_ICD_TRACE("failed get platform handle to library\n"); continue; } vendor->clGetExtensionFunctionAddress = p_clGetExtensionFunctionAddress; vendor->platform = platforms[i]; vendor->suffix = suffix; // add this vendor to the list of vendors at the tail { KHRicdVendor **prevNextPointer = NULL; for (prevNextPointer = &khrIcdVendors; *prevNextPointer; prevNextPointer = &( (*prevNextPointer)->next) ); *prevNextPointer = vendor; } KHR_ICD_TRACE("successfully added vendor %s with suffix %s\n", libraryName, suffix); } Done: if (library) { khrIcdOsLibraryUnload(library); } if (platforms) { free(platforms); } } #if defined(CL_ENABLE_LAYERS) void khrIcdLayerAdd(const char *libraryName) { void *library = NULL; cl_int result = CL_SUCCESS; pfn_clGetLayerInfo p_clGetLayerInfo = NULL; pfn_clInitLayer p_clInitLayer = NULL; struct KHRLayer *layerIterator = NULL; struct KHRLayer *layer = NULL; cl_layer_api_version api_version = 0; const struct _cl_icd_dispatch *targetDispatch = NULL; const struct _cl_icd_dispatch *layerDispatch = NULL; cl_uint layerDispatchNumEntries = 0; cl_uint loaderDispatchNumEntries = 0; // require that the library name be valid if (!libraryName) { goto Done; } KHR_ICD_TRACE("attempting to add layer %s...\n", libraryName); // load its library and query its function pointers library = khrIcdOsLibraryLoad(libraryName); if (!library) { KHR_ICD_TRACE("failed to load library %s\n", libraryName); goto Done; } // ensure that we haven't already loaded this layer for (layerIterator = khrFirstLayer; layerIterator; layerIterator = layerIterator->next) { if (layerIterator->library == library) { KHR_ICD_TRACE("already loaded layer %s, nothing to do here\n", libraryName); goto Done; } } // get the library's clGetLayerInfo pointer p_clGetLayerInfo = (pfn_clGetLayerInfo)(size_t)khrIcdOsLibraryGetFunctionAddress(library, "clGetLayerInfo"); if (!p_clGetLayerInfo) { KHR_ICD_TRACE("failed to get function address clGetLayerInfo\n"); goto Done; } // use that function to get the clInitLayer function pointer p_clInitLayer = (pfn_clInitLayer)(size_t)khrIcdOsLibraryGetFunctionAddress(library, "clInitLayer"); if (!p_clInitLayer) { KHR_ICD_TRACE("failed to get function address clInitLayer\n"); goto Done; } result = p_clGetLayerInfo(CL_LAYER_API_VERSION, sizeof(api_version), &api_version, NULL); if (CL_SUCCESS != result) { KHR_ICD_TRACE("failed to query layer version\n"); goto Done; } if (CL_LAYER_API_VERSION_100 != api_version) { KHR_ICD_TRACE("unsupported api version\n"); goto Done; } layer = (struct KHRLayer*)calloc(sizeof(struct KHRLayer), 1); if (!layer) { KHR_ICD_TRACE("failed to allocate memory\n"); goto Done; } #ifdef CL_LAYER_INFO { // Not using strdup as it is not standard c size_t sz_name = strlen(libraryName) + 1; layer->libraryName = malloc(sz_name); if (!layer->libraryName) { KHR_ICD_TRACE("failed to allocate memory\n"); goto Done; } memcpy(layer->libraryName, libraryName, sz_name); layer->p_clGetLayerInfo = (void *)(size_t)p_clGetLayerInfo; } #endif if (khrFirstLayer) { targetDispatch = &(khrFirstLayer->dispatch); } else { targetDispatch = &khrMasterDispatch; } loaderDispatchNumEntries = sizeof(khrMasterDispatch)/sizeof(void*); result = p_clInitLayer( loaderDispatchNumEntries, targetDispatch, &layerDispatchNumEntries, &layerDispatch); if (CL_SUCCESS != result) { KHR_ICD_TRACE("failed to initialize layer\n"); goto Done; } layer->next = khrFirstLayer; khrFirstLayer = layer; layer->library = library; cl_uint limit = layerDispatchNumEntries < loaderDispatchNumEntries ? layerDispatchNumEntries : loaderDispatchNumEntries; for (cl_uint i = 0; i < limit; i++) { ((void **)&(layer->dispatch))[i] = ((void *const*)layerDispatch)[i] ? ((void *const*)layerDispatch)[i] : ((void *const*)targetDispatch)[i]; } for (cl_uint i = limit; i < loaderDispatchNumEntries; i++) { ((void **)&(layer->dispatch))[i] = ((void *const*)targetDispatch)[i]; } KHR_ICD_TRACE("successfully added layer %s\n", libraryName); return; Done: if (library) { khrIcdOsLibraryUnload(library); } if (layer) { free(layer); } } #endif // defined(CL_ENABLE_LAYERS) // Get next file or dirname given a string list or registry key path. // Note: the input string may be modified! static char *loader_get_next_path(char *path) { size_t len; char *next; if (path == NULL) return NULL; next = strchr(path, PATH_SEPARATOR); if (next == NULL) { len = strlen(path); next = path + len; } else { *next = '\0'; next++; } return next; } void khrIcdVendorsEnumerateEnv(void) { char* icdFilenames = khrIcd_secure_getenv("OCL_ICD_FILENAMES"); char* cur_file = NULL; char* next_file = NULL; if (icdFilenames) { KHR_ICD_TRACE("Found OCL_ICD_FILENAMES environment variable.\n"); next_file = icdFilenames; while (NULL != next_file && *next_file != '\0') { cur_file = next_file; next_file = loader_get_next_path(cur_file); khrIcdVendorAdd(cur_file); } khrIcd_free_getenv(icdFilenames); } } #if defined(CL_ENABLE_LAYERS) void khrIcdLayersEnumerateEnv(void) { char* layerFilenames = khrIcd_secure_getenv("OPENCL_LAYERS"); char* cur_file = NULL; char* next_file = NULL; if (layerFilenames) { KHR_ICD_TRACE("Found OPENCL_LAYERS environment variable.\n"); next_file = layerFilenames; while (NULL != next_file && *next_file != '\0') { cur_file = next_file; next_file = loader_get_next_path(cur_file); khrIcdLayerAdd(cur_file); } khrIcd_free_getenv(layerFilenames); } } #endif // defined(CL_ENABLE_LAYERS) void khrIcdContextPropertiesGetPlatform(const cl_context_properties *properties, cl_platform_id *outPlatform) { if (properties == NULL && khrIcdVendors != NULL) { *outPlatform = khrIcdVendors[0].platform; } else { const cl_context_properties *property = (cl_context_properties *)NULL; *outPlatform = NULL; for (property = properties; property && property[0]; property += 2) { if ((cl_context_properties)CL_CONTEXT_PLATFORM == property[0]) { *outPlatform = (cl_platform_id)property[1]; } } } } OpenCL-ICD-Loader-2025.07.22/loader/icd.h000066400000000000000000000200561503776305700172320ustar00rootroot00000000000000/* * Copyright (c) 2016-2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #ifndef _ICD_H_ #define _ICD_H_ #include "icd_platform.h" #include "icd_dispatch.h" #ifndef CL_USE_DEPRECATED_OPENCL_1_0_APIS #define CL_USE_DEPRECATED_OPENCL_1_0_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_1_1_APIS #define CL_USE_DEPRECATED_OPENCL_1_1_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_0_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_1_APIS #define CL_USE_DEPRECATED_OPENCL_2_1_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_2_APIS #define CL_USE_DEPRECATED_OPENCL_2_2_APIS #endif #include #include #include #include /* * type definitions */ typedef cl_int (CL_API_CALL *pfn_clIcdGetPlatformIDs)( cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms) CL_API_SUFFIX__VERSION_1_0; typedef cl_int (CL_API_CALL *pfn_clGetPlatformInfo)( cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0; typedef void *(CL_API_CALL *pfn_clGetExtensionFunctionAddress)( const char *function_name) CL_API_SUFFIX__VERSION_1_0; typedef struct KHRicdVendorRec KHRicdVendor; /* * KHRicdVendor * * Data for a single ICD vendor platform. */ struct KHRicdVendorRec { // the loaded library object (true type varies on Linux versus Windows) void *library; // the extension suffix for this platform char *suffix; // function pointer to the ICD platform IDs extracted from the library pfn_clGetExtensionFunctionAddress clGetExtensionFunctionAddress; // the platform retrieved from clGetIcdPlatformIDsKHR cl_platform_id platform; #if defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) // the loader populated dispatch table for cl_khr_icd2 compliant platforms struct KHRDisp dispData; #endif // next vendor in the list vendors KHRicdVendor *next; }; // the global state extern KHRicdVendor * khrIcdVendors; extern int khrEnableTrace; #if defined(CL_ENABLE_LAYERS) /* * KHRLayer * * Data for a single Layer */ struct KHRLayer; struct KHRLayer { // the loaded library object (true type varies on Linux versus Windows) void *library; // the dispatch table of the layer struct _cl_icd_dispatch dispatch; // The next layer in the chain struct KHRLayer *next; #ifdef CL_LAYER_INFO // The layer library name char *libraryName; // the pointer to the clGetLayerInfo funciton void *p_clGetLayerInfo; #endif }; // the global layer state extern struct KHRLayer * khrFirstLayer; extern struct _cl_icd_dispatch khrMasterDispatch; #endif // defined(CL_ENABLE_LAYERS) /* * khrIcd interface */ // read vendors from system configuration and store the data // loaded into khrIcdState. this will call the OS-specific // function khrIcdEnumerateVendors. this is called at every // dispatch function which may be a valid first call into the // API (e.g, getPlatformIDs, etc). void khrIcdInitialize(void); // entrypoint to check and initialize trace. void khrIcdInitializeTrace(void); // go through the list of vendors (in /etc/OpenCL.conf or through // the registry) and call khrIcdVendorAdd for each vendor encountered // n.b, this call is OS-specific void khrIcdOsVendorsEnumerateOnce(void); // read vendors from environment variables void khrIcdVendorsEnumerateEnv(void); // add a vendor's implementation to the list of libraries void khrIcdVendorAdd(const char *libraryName); // read layers from environment variables void khrIcdLayersEnumerateEnv(void); // add a layer to the layer chain void khrIcdLayerAdd(const char *libraryName); // dynamically load a library. returns NULL on failure // n.b, this call is OS-specific void *khrIcdOsLibraryLoad(const char *libraryName); // get a function pointer from a loaded library. returns NULL on failure. // n.b, this call is OS-specific void *khrIcdOsLibraryGetFunctionAddress(void *library, const char *functionName); // unload a library. // n.b, this call is OS-specific void khrIcdOsLibraryUnload(void *library); // parse properties and determine the platform to use from them void khrIcdContextPropertiesGetPlatform( const cl_context_properties *properties, cl_platform_id *outPlatform); // internal tracing macros #define KHR_ICD_TRACE(...) \ do \ { \ if (khrEnableTrace) \ { \ fprintf(stderr, "KHR ICD trace at %s:%d: ", __FILE__, __LINE__); \ fprintf(stderr, __VA_ARGS__); \ } \ } while (0) #ifdef _WIN32 #define KHR_ICD_WIDE_TRACE(...) \ do \ { \ if (khrEnableTrace) \ { \ fwprintf(stderr, L"KHR ICD trace at %hs:%d: ", __FILE__, __LINE__); \ fwprintf(stderr, __VA_ARGS__); \ } \ } while (0) #else #define KHR_ICD_WIDE_TRACE(...) #endif #define KHR_ICD_ERROR_RETURN_ERROR(_error) \ do { \ return _error; \ } while(0) #define KHR_ICD_ERROR_RETURN_HANDLE(_error) \ do { \ if (errcode_ret) { \ *errcode_ret = _error; \ } \ return NULL; \ } while(0) // Check if the passed-in handle is NULL, and if it is, return the error. #define KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(_handle, _error) \ do { \ if (!_handle) { \ KHR_ICD_ERROR_RETURN_ERROR(_error); \ } \ } while (0) // Check if the passed-in handle is NULL, and if it is, first check and set // errcode_ret to the error, then return NULL (NULL being an invalid handle). #define KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(_handle, _error) \ do { \ if (!_handle) { \ KHR_ICD_ERROR_RETURN_HANDLE(_error); \ } \ } while (0) // Check if the passed-in function pointer is NULL, and if it is, return // CL_INVALID_OPERATION. #define KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(_pointer) \ do { \ if (!_pointer) { \ KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); \ } \ } while (0) // Check if the passed-in function pointer is NULL, and if it is, first // check and set errcode_ret to CL_INVALID_OPERATION, then return NULL // (NULL being an invalid handle). #define KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(_pointer) \ do { \ if (!_pointer) { \ KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); \ } \ } while (0) #endif OpenCL-ICD-Loader-2025.07.22/loader/icd_cmake_config.h.in000066400000000000000000000001021503776305700223120ustar00rootroot00000000000000#cmakedefine HAVE_SECURE_GETENV #cmakedefine HAVE___SECURE_GETENV OpenCL-ICD-Loader-2025.07.22/loader/icd_dispatch.c000066400000000000000000000255421503776305700211110ustar00rootroot00000000000000/* * Copyright (c) 2012-2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd.h" #include "icd_dispatch.h" #include "icd_version.h" #include #include static clGetICDLoaderInfoOCLICD_t clGetICDLoaderInfoOCLICD; cl_int CL_API_CALL clGetICDLoaderInfoOCLICD( cl_icdl_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret) { static const char cl_icdl_OCL_VERSION[] = OPENCL_ICD_LOADER_OCL_VERSION_STRING; static const char cl_icdl_VERSION[] = OPENCL_ICD_LOADER_VERSION_STRING; static const char cl_icdl_NAME[] = OPENCL_ICD_LOADER_NAME_STRING; static const char cl_icdl_VENDOR[] = OPENCL_ICD_LOADER_VENDOR_STRING; size_t pvs; const void * pv = NULL; #define KHR_ICD_CASE_STRING_PARAM_NAME(name) \ case CL_ICDL_ ## name: \ pvs = strlen(cl_icdl_ ## name) + 1; \ pv = (const void *)cl_icdl_ ## name; \ break switch (param_name) { KHR_ICD_CASE_STRING_PARAM_NAME(OCL_VERSION); KHR_ICD_CASE_STRING_PARAM_NAME(VERSION); KHR_ICD_CASE_STRING_PARAM_NAME(NAME); KHR_ICD_CASE_STRING_PARAM_NAME(VENDOR); default: return CL_INVALID_VALUE; } #undef KHR_ICD_CASE_PARAM_NAME if (param_value) { if (param_value_size < pvs) return CL_INVALID_VALUE; memcpy(param_value, pv, pvs); } if (param_value_size_ret != NULL) *param_value_size_ret = pvs; return CL_SUCCESS; } static void* khrIcdGetExtensionFunctionAddress(const char* function_name) { // Most extensions, including multi-vendor KHR and EXT extensions, // do not need to be ICD-aware and do not require any ICD loader // modifications. The KHR and EXT extensions below were added for // backwards compatibility only. #define KHR_ICD_CHECK_EXTENSION_FUNCTION(name) \ do \ { \ if (!strcmp(function_name, #name)) \ { \ return (void*)(size_t)&name; \ } \ } while (0) // Functions supporting the creation of OpenCL Memory Objects // from OpenGL Objects (cl_apple_gl_sharing, cl_khr_gl_sharing) KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromGLBuffer); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromGLTexture); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromGLTexture2D); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromGLTexture3D); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromGLRenderbuffer); KHR_ICD_CHECK_EXTENSION_FUNCTION(clGetGLObjectInfo); KHR_ICD_CHECK_EXTENSION_FUNCTION(clGetGLTextureInfo); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueAcquireGLObjects); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueReleaseGLObjects); // cl_khr_gl_sharing KHR_ICD_CHECK_EXTENSION_FUNCTION(clGetGLContextInfoKHR); // cl_khr_gl_event KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateEventFromGLsyncKHR); #if defined(_WIN32) // cl_khr_d3d10_sharing KHR_ICD_CHECK_EXTENSION_FUNCTION(clGetDeviceIDsFromD3D10KHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromD3D10BufferKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromD3D10Texture2DKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromD3D10Texture3DKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueAcquireD3D10ObjectsKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueReleaseD3D10ObjectsKHR); // cl_khr_d3d11_sharing KHR_ICD_CHECK_EXTENSION_FUNCTION(clGetDeviceIDsFromD3D11KHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromD3D11BufferKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromD3D11Texture2DKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromD3D11Texture3DKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueAcquireD3D11ObjectsKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueReleaseD3D11ObjectsKHR); // cl_khr_dx9_media_sharing KHR_ICD_CHECK_EXTENSION_FUNCTION(clGetDeviceIDsFromDX9MediaAdapterKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromDX9MediaSurfaceKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueAcquireDX9MediaSurfacesKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueReleaseDX9MediaSurfacesKHR); #endif // cl_ext_device_fission KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateSubDevicesEXT); KHR_ICD_CHECK_EXTENSION_FUNCTION(clRetainDeviceEXT); KHR_ICD_CHECK_EXTENSION_FUNCTION(clReleaseDeviceEXT); // cl_khr_egl_image KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateFromEGLImageKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueAcquireEGLObjectsKHR); KHR_ICD_CHECK_EXTENSION_FUNCTION(clEnqueueReleaseEGLObjectsKHR); // cl_khr_egl_event KHR_ICD_CHECK_EXTENSION_FUNCTION(clCreateEventFromEGLSyncKHR); // cl_khr_sub_groups KHR_ICD_CHECK_EXTENSION_FUNCTION(clGetKernelSubGroupInfoKHR); // cl_icdl KHR_ICD_CHECK_EXTENSION_FUNCTION(clGetICDLoaderInfoOCLICD); #undef KHR_ICD_CHECK_EXTENSION_FUNCTION return NULL; } #ifdef __cplusplus extern "C" { #endif static inline cl_int clGetPlatformIDs_body( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms) { KHRicdVendor* vendor = NULL; cl_uint i; if (!num_entries && platforms) { return CL_INVALID_VALUE; } if (!platforms && !num_platforms) { return CL_INVALID_VALUE; } // set num_platforms to 0 and set all platform pointers to NULL if (num_platforms) { *num_platforms = 0; } for (i = 0; i < num_entries && platforms; ++i) { platforms[i] = NULL; } // return error if we have no platforms if (!khrIcdVendors) { return CL_PLATFORM_NOT_FOUND_KHR; } // otherwise enumerate all platforms for (vendor = khrIcdVendors; vendor; vendor = vendor->next) { if (num_entries && platforms) { *(platforms++) = vendor->platform; --num_entries; } if (num_platforms) { ++(*num_platforms); } } return CL_SUCCESS; } cl_int CL_API_CALL clGetPlatformIDs_disp( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms) { return clGetPlatformIDs_body( num_entries, platforms, num_platforms); } CL_API_ENTRY cl_int CL_API_CALL clGetPlatformIDs( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms) { // initialize the platforms (in case they have not been already) khrIcdInitialize(); #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetPlatformIDs( num_entries, platforms, num_platforms); #endif // defined(CL_ENABLE_LAYERS) return clGetPlatformIDs_body( num_entries, platforms, num_platforms); } static inline void* clGetExtensionFunctionAddress_body( const char* function_name) { void* function_address = NULL; size_t function_name_length = 0; KHRicdVendor* vendor = NULL; KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(function_name, NULL); // check if this is an ICD-aware extension function_address = khrIcdGetExtensionFunctionAddress(function_name); if (function_address) { return function_address; } // fall back to vendor extension detection function_name_length = strlen(function_name); for (vendor = khrIcdVendors; vendor; vendor = vendor->next) { size_t vendor_suffix_length = strlen(vendor->suffix); if (vendor_suffix_length <= function_name_length && vendor_suffix_length > 0) { const char* function_suffix = function_name + function_name_length - vendor_suffix_length; if (!strcmp(function_suffix, vendor->suffix)) { return vendor->clGetExtensionFunctionAddress(function_name); } } } return NULL; } void* CL_API_CALL clGetExtensionFunctionAddress_disp( const char* function_name) { return clGetExtensionFunctionAddress_body( function_name); } CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddress( const char* function_name) { // make sure the ICD is initialized khrIcdInitialize(); #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetExtensionFunctionAddress( function_name); #endif // defined(CL_ENABLE_LAYERS) return clGetExtensionFunctionAddress_body( function_name); } static inline void* clGetExtensionFunctionAddressForPlatform_body( cl_platform_id platform, const char* function_name) { void* function_address = NULL; KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(function_name, NULL); // check if this is an ICD-aware extension function_address = khrIcdGetExtensionFunctionAddress(function_name); if (function_address) { return function_address; } // This is not an ICD-aware extension, so call into the implementation // to get the extension function address. KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, NULL); return KHR_ICD2_DISPATCH(platform)->clGetExtensionFunctionAddressForPlatform( platform, function_name); } void* CL_API_CALL clGetExtensionFunctionAddressForPlatform_disp( cl_platform_id platform, const char* function_name) { return clGetExtensionFunctionAddressForPlatform_body( platform, function_name); } CL_API_ENTRY void* CL_API_CALL clGetExtensionFunctionAddressForPlatform( cl_platform_id platform, const char* function_name) { // make sure the ICD is initialized khrIcdInitialize(); #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetExtensionFunctionAddressForPlatform( platform, function_name); #endif // defined(CL_ENABLE_LAYERS) return clGetExtensionFunctionAddressForPlatform_body( platform, function_name); } #ifdef __cplusplus } #endif OpenCL-ICD-Loader-2025.07.22/loader/icd_dispatch.h000066400000000000000000000064721503776305700211170ustar00rootroot00000000000000/* * Copyright (c) 2016-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #ifndef _ICD_DISPATCH_H_ #define _ICD_DISPATCH_H_ #ifndef CL_USE_DEPRECATED_OPENCL_1_0_APIS #define CL_USE_DEPRECATED_OPENCL_1_0_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_1_1_APIS #define CL_USE_DEPRECATED_OPENCL_1_1_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_0_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_1_APIS #define CL_USE_DEPRECATED_OPENCL_2_1_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_2_APIS #define CL_USE_DEPRECATED_OPENCL_2_2_APIS #endif // cl.h #include // cl_gl.h and required files #ifdef _WIN32 #include #include #include #include #include #include #endif #include #include #include #include #include "cl_khr_icd2.h" #if defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) extern void khrIcd2PopulateDispatchTable( cl_platform_id platform, clIcdGetFunctionAddressForPlatformKHR_fn p_clIcdGetFunctionAddressForPlatform, struct _cl_icd_dispatch* dispatch); struct KHRDisp { struct _cl_icd_dispatch dispatch; }; #define KHR_ICD2_HAS_TAG(object) \ (((intptr_t)((object)->dispatch->clGetPlatformIDs)) == CL_ICD2_TAG_KHR) #define KHR_ICD2_DISPATCH(object) \ (KHR_ICD2_HAS_TAG(object) ? \ &(object)->dispData->dispatch : \ (object)->dispatch) #define KHR_ICD_OBJECT_BODY { \ cl_icd_dispatch *dispatch; \ struct KHRDisp *dispData; \ } #else // ! defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) #define KHR_ICD2_DISPATCH(object) ((object)->dispatch) #define KHR_ICD_OBJECT_BODY { \ cl_icd_dispatch *dispatch; \ } #endif // defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) /* * * vendor dispatch table structure * */ struct _cl_platform_id KHR_ICD_OBJECT_BODY; struct _cl_device_id KHR_ICD_OBJECT_BODY; struct _cl_context KHR_ICD_OBJECT_BODY; struct _cl_command_queue KHR_ICD_OBJECT_BODY; struct _cl_mem KHR_ICD_OBJECT_BODY; struct _cl_program KHR_ICD_OBJECT_BODY; struct _cl_kernel KHR_ICD_OBJECT_BODY; struct _cl_event KHR_ICD_OBJECT_BODY; struct _cl_sampler KHR_ICD_OBJECT_BODY; #endif // _ICD_DISPATCH_H_ OpenCL-ICD-Loader-2025.07.22/loader/icd_dispatch_generated.c000066400000000000000000011434161503776305700231310ustar00rootroot00000000000000/* * Copyright (c) 2012-2023 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd.h" #include "icd_dispatch.h" #ifdef __cplusplus extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// // Core APIs: #if defined(CL_ENABLE_LAYERS) extern cl_int CL_API_CALL clGetPlatformIDs_disp( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms) CL_API_SUFFIX__VERSION_1_0; #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clGetPlatformInfo( cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetPlatformInfo( platform, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); return KHR_ICD2_DISPATCH(platform)->clGetPlatformInfo( platform, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetPlatformInfo_disp( cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); return KHR_ICD2_DISPATCH(platform)->clGetPlatformInfo( platform, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDs( cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetDeviceIDs( platform, device_type, num_entries, devices, num_devices); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); return KHR_ICD2_DISPATCH(platform)->clGetDeviceIDs( platform, device_type, num_entries, devices, num_devices); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetDeviceIDs_disp( cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); return KHR_ICD2_DISPATCH(platform)->clGetDeviceIDs( platform, device_type, num_entries, devices, num_devices); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfo( cl_device_id device, cl_device_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetDeviceInfo( device, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clGetDeviceInfo( device, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetDeviceInfo_disp( cl_device_id device, cl_device_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clGetDeviceInfo( device, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_context CL_API_CALL clCreateContext( const cl_context_properties* properties, cl_uint num_devices, const cl_device_id* devices, void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data), void* user_data, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateContext( properties, num_devices, devices, pfn_notify, user_data, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) if (num_devices == 0 || devices == NULL) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(NULL, CL_INVALID_VALUE); } KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(devices[0], CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(devices[0])->clCreateContext( properties, num_devices, devices, pfn_notify, user_data, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_context CL_API_CALL clCreateContext_disp( const cl_context_properties* properties, cl_uint num_devices, const cl_device_id* devices, void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data), void* user_data, cl_int* errcode_ret) { if (num_devices == 0 || devices == NULL) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(NULL, CL_INVALID_VALUE); } KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(devices[0], CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(devices[0])->clCreateContext( properties, num_devices, devices, pfn_notify, user_data, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_context CL_API_CALL clCreateContextFromType( const cl_context_properties* properties, cl_device_type device_type, void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data), void* user_data, cl_int* errcode_ret) { khrIcdInitialize(); #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateContextFromType( properties, device_type, pfn_notify, user_data, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) cl_platform_id platform = NULL; khrIcdContextPropertiesGetPlatform(properties, &platform); KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(platform, CL_INVALID_PLATFORM); return KHR_ICD2_DISPATCH(platform)->clCreateContextFromType( properties, device_type, pfn_notify, user_data, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_context CL_API_CALL clCreateContextFromType_disp( const cl_context_properties* properties, cl_device_type device_type, void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data), void* user_data, cl_int* errcode_ret) { khrIcdInitialize(); cl_platform_id platform = NULL; khrIcdContextPropertiesGetPlatform(properties, &platform); KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(platform, CL_INVALID_PLATFORM); return KHR_ICD2_DISPATCH(platform)->clCreateContextFromType( properties, device_type, pfn_notify, user_data, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clRetainContext( cl_context context) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainContext( context); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clRetainContext( context); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainContext_disp( cl_context context) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clRetainContext( context); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clReleaseContext( cl_context context) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseContext( context); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clReleaseContext( context); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseContext_disp( cl_context context) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clReleaseContext( context); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetContextInfo( cl_context context, cl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetContextInfo( context, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clGetContextInfo( context, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetContextInfo_disp( cl_context context, cl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clGetContextInfo( context, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clRetainCommandQueue( cl_command_queue command_queue) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainCommandQueue( command_queue); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clRetainCommandQueue( command_queue); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainCommandQueue_disp( cl_command_queue command_queue) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clRetainCommandQueue( command_queue); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clReleaseCommandQueue( cl_command_queue command_queue) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseCommandQueue( command_queue); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clReleaseCommandQueue( command_queue); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseCommandQueue_disp( cl_command_queue command_queue) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clReleaseCommandQueue( command_queue); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetCommandQueueInfo( cl_command_queue command_queue, cl_command_queue_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetCommandQueueInfo( command_queue, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clGetCommandQueueInfo( command_queue, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetCommandQueueInfo_disp( cl_command_queue command_queue, cl_command_queue_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clGetCommandQueueInfo( command_queue, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_mem CL_API_CALL clCreateBuffer( cl_context context, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateBuffer( context, flags, size, host_ptr, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateBuffer( context, flags, size, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateBuffer_disp( cl_context context, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateBuffer( context, flags, size, host_ptr, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clRetainMemObject( cl_mem memobj) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainMemObject( memobj); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(memobj)->clRetainMemObject( memobj); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainMemObject_disp( cl_mem memobj) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(memobj)->clRetainMemObject( memobj); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clReleaseMemObject( cl_mem memobj) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseMemObject( memobj); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(memobj)->clReleaseMemObject( memobj); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseMemObject_disp( cl_mem memobj) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(memobj)->clReleaseMemObject( memobj); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetSupportedImageFormats( cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries, cl_image_format* image_formats, cl_uint* num_image_formats) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetSupportedImageFormats( context, flags, image_type, num_entries, image_formats, num_image_formats); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clGetSupportedImageFormats( context, flags, image_type, num_entries, image_formats, num_image_formats); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetSupportedImageFormats_disp( cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries, cl_image_format* image_formats, cl_uint* num_image_formats) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clGetSupportedImageFormats( context, flags, image_type, num_entries, image_formats, num_image_formats); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetMemObjectInfo( cl_mem memobj, cl_mem_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetMemObjectInfo( memobj, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(memobj)->clGetMemObjectInfo( memobj, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetMemObjectInfo_disp( cl_mem memobj, cl_mem_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(memobj)->clGetMemObjectInfo( memobj, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetImageInfo( cl_mem image, cl_image_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetImageInfo( image, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(image, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(image)->clGetImageInfo( image, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetImageInfo_disp( cl_mem image, cl_image_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(image, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(image)->clGetImageInfo( image, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clRetainSampler( cl_sampler sampler) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainSampler( sampler); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER); return KHR_ICD2_DISPATCH(sampler)->clRetainSampler( sampler); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainSampler_disp( cl_sampler sampler) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER); return KHR_ICD2_DISPATCH(sampler)->clRetainSampler( sampler); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clReleaseSampler( cl_sampler sampler) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseSampler( sampler); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER); return KHR_ICD2_DISPATCH(sampler)->clReleaseSampler( sampler); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseSampler_disp( cl_sampler sampler) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER); return KHR_ICD2_DISPATCH(sampler)->clReleaseSampler( sampler); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetSamplerInfo( cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetSamplerInfo( sampler, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER); return KHR_ICD2_DISPATCH(sampler)->clGetSamplerInfo( sampler, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetSamplerInfo_disp( cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER); return KHR_ICD2_DISPATCH(sampler)->clGetSamplerInfo( sampler, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithSource( cl_context context, cl_uint count, const char** strings, const size_t* lengths, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateProgramWithSource( context, count, strings, lengths, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateProgramWithSource( context, count, strings, lengths, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_program CL_API_CALL clCreateProgramWithSource_disp( cl_context context, cl_uint count, const char** strings, const size_t* lengths, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateProgramWithSource( context, count, strings, lengths, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const size_t* lengths, const unsigned char** binaries, cl_int* binary_status, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateProgramWithBinary( context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateProgramWithBinary( context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_program CL_API_CALL clCreateProgramWithBinary_disp( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const size_t* lengths, const unsigned char** binaries, cl_int* binary_status, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateProgramWithBinary( context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clRetainProgram( cl_program program) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainProgram( program); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clRetainProgram( program); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainProgram_disp( cl_program program) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clRetainProgram( program); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clReleaseProgram( cl_program program) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseProgram( program); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clReleaseProgram( program); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseProgram_disp( cl_program program) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clReleaseProgram( program); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clBuildProgram( cl_program program, cl_uint num_devices, const cl_device_id* device_list, const char* options, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clBuildProgram( program, num_devices, device_list, options, pfn_notify, user_data); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clBuildProgram( program, num_devices, device_list, options, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clBuildProgram_disp( cl_program program, cl_uint num_devices, const cl_device_id* device_list, const char* options, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clBuildProgram( program, num_devices, device_list, options, pfn_notify, user_data); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetProgramInfo( cl_program program, cl_program_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetProgramInfo( program, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clGetProgramInfo( program, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetProgramInfo_disp( cl_program program, cl_program_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clGetProgramInfo( program, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetProgramBuildInfo( cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetProgramBuildInfo( program, device, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clGetProgramBuildInfo( program, device, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetProgramBuildInfo_disp( cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clGetProgramBuildInfo( program, device, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_kernel CL_API_CALL clCreateKernel( cl_program program, const char* kernel_name, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateKernel( program, kernel_name, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clCreateKernel( program, kernel_name, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_kernel CL_API_CALL clCreateKernel_disp( cl_program program, const char* kernel_name, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clCreateKernel( program, kernel_name, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clCreateKernelsInProgram( cl_program program, cl_uint num_kernels, cl_kernel* kernels, cl_uint* num_kernels_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateKernelsInProgram( program, num_kernels, kernels, num_kernels_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clCreateKernelsInProgram( program, num_kernels, kernels, num_kernels_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clCreateKernelsInProgram_disp( cl_program program, cl_uint num_kernels, cl_kernel* kernels, cl_uint* num_kernels_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clCreateKernelsInProgram( program, num_kernels, kernels, num_kernels_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clRetainKernel( cl_kernel kernel) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainKernel( kernel); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clRetainKernel( kernel); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainKernel_disp( cl_kernel kernel) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clRetainKernel( kernel); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clReleaseKernel( cl_kernel kernel) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseKernel( kernel); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clReleaseKernel( kernel); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseKernel_disp( cl_kernel kernel) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clReleaseKernel( kernel); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetKernelArg( cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void* arg_value) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetKernelArg( kernel, arg_index, arg_size, arg_value); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clSetKernelArg( kernel, arg_index, arg_size, arg_value); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetKernelArg_disp( cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void* arg_value) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clSetKernelArg( kernel, arg_index, arg_size, arg_value); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfo( cl_kernel kernel, cl_kernel_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetKernelInfo( kernel, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clGetKernelInfo( kernel, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetKernelInfo_disp( cl_kernel kernel, cl_kernel_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clGetKernelInfo( kernel, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetKernelWorkGroupInfo( cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetKernelWorkGroupInfo( kernel, device, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clGetKernelWorkGroupInfo( kernel, device, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetKernelWorkGroupInfo_disp( cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clGetKernelWorkGroupInfo( kernel, device, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clWaitForEvents( cl_uint num_events, const cl_event* event_list) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clWaitForEvents( num_events, event_list); #endif // defined(CL_ENABLE_LAYERS) if (num_events == 0 || event_list == NULL) { return CL_INVALID_VALUE; } KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event_list[0], CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event_list[0])->clWaitForEvents( num_events, event_list); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clWaitForEvents_disp( cl_uint num_events, const cl_event* event_list) { if (num_events == 0 || event_list == NULL) { return CL_INVALID_VALUE; } KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event_list[0], CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event_list[0])->clWaitForEvents( num_events, event_list); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetEventInfo( cl_event event, cl_event_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetEventInfo( event, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clGetEventInfo( event, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetEventInfo_disp( cl_event event, cl_event_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clGetEventInfo( event, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clRetainEvent( cl_event event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainEvent( event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clRetainEvent( event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainEvent_disp( cl_event event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clRetainEvent( event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clReleaseEvent( cl_event event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseEvent( event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clReleaseEvent( event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseEvent_disp( cl_event event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clReleaseEvent( event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetEventProfilingInfo( cl_event event, cl_profiling_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetEventProfilingInfo( event, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clGetEventProfilingInfo( event, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetEventProfilingInfo_disp( cl_event event, cl_profiling_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clGetEventProfilingInfo( event, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clFlush( cl_command_queue command_queue) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clFlush( command_queue); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clFlush( command_queue); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clFlush_disp( cl_command_queue command_queue) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clFlush( command_queue); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clFinish( cl_command_queue command_queue) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clFinish( command_queue); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clFinish( command_queue); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clFinish_disp( cl_command_queue command_queue) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clFinish( command_queue); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBuffer( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t size, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueReadBuffer( command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReadBuffer( command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueReadBuffer_disp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t size, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReadBuffer( command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBuffer( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t size, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueWriteBuffer( command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueWriteBuffer( command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueWriteBuffer_disp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t size, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueWriteBuffer( command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBuffer( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueCopyBuffer( command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyBuffer( command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueCopyBuffer_disp( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyBuffer( command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImage( cl_command_queue command_queue, cl_mem image, cl_bool blocking_read, const size_t* origin, const size_t* region, size_t row_pitch, size_t slice_pitch, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueReadImage( command_queue, image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReadImage( command_queue, image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueReadImage_disp( cl_command_queue command_queue, cl_mem image, cl_bool blocking_read, const size_t* origin, const size_t* region, size_t row_pitch, size_t slice_pitch, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReadImage( command_queue, image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteImage( cl_command_queue command_queue, cl_mem image, cl_bool blocking_write, const size_t* origin, const size_t* region, size_t input_row_pitch, size_t input_slice_pitch, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueWriteImage( command_queue, image, blocking_write, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueWriteImage( command_queue, image, blocking_write, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueWriteImage_disp( cl_command_queue command_queue, cl_mem image, cl_bool blocking_write, const size_t* origin, const size_t* region, size_t input_row_pitch, size_t input_slice_pitch, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueWriteImage( command_queue, image, blocking_write, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImage( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image, const size_t* src_origin, const size_t* dst_origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueCopyImage( command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyImage( command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueCopyImage_disp( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image, const size_t* src_origin, const size_t* dst_origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyImage( command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImageToBuffer( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer, const size_t* src_origin, const size_t* region, size_t dst_offset, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueCopyImageToBuffer( command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyImageToBuffer( command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueCopyImageToBuffer_disp( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer, const size_t* src_origin, const size_t* region, size_t dst_offset, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyImageToBuffer( command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferToImage( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image, size_t src_offset, const size_t* dst_origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueCopyBufferToImage( command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyBufferToImage( command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueCopyBufferToImage_disp( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image, size_t src_offset, const size_t* dst_origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyBufferToImage( command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY void* CL_API_CALL clEnqueueMapBuffer( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueMapBuffer( command_queue, buffer, blocking_map, map_flags, offset, size, num_events_in_wait_list, event_wait_list, event, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMapBuffer( command_queue, buffer, blocking_map, map_flags, offset, size, num_events_in_wait_list, event_wait_list, event, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static void* CL_API_CALL clEnqueueMapBuffer_disp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMapBuffer( command_queue, buffer, blocking_map, map_flags, offset, size, num_events_in_wait_list, event_wait_list, event, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY void* CL_API_CALL clEnqueueMapImage( cl_command_queue command_queue, cl_mem image, cl_bool blocking_map, cl_map_flags map_flags, const size_t* origin, const size_t* region, size_t* image_row_pitch, size_t* image_slice_pitch, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueMapImage( command_queue, image, blocking_map, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMapImage( command_queue, image, blocking_map, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static void* CL_API_CALL clEnqueueMapImage_disp( cl_command_queue command_queue, cl_mem image, cl_bool blocking_map, cl_map_flags map_flags, const size_t* origin, const size_t* region, size_t* image_row_pitch, size_t* image_slice_pitch, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMapImage( command_queue, image, blocking_map, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueUnmapMemObject( cl_command_queue command_queue, cl_mem memobj, void* mapped_ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueUnmapMemObject( command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueUnmapMemObject( command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueUnmapMemObject_disp( cl_command_queue command_queue, cl_mem memobj, void* mapped_ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueUnmapMemObject( command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueNDRangeKernel( cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t* global_work_offset, const size_t* global_work_size, const size_t* local_work_size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueNDRangeKernel( command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueNDRangeKernel( command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueNDRangeKernel_disp( cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t* global_work_offset, const size_t* global_work_size, const size_t* local_work_size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueNDRangeKernel( command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueNativeKernel( cl_command_queue command_queue, void (CL_CALLBACK* user_func)(void*), void* args, size_t cb_args, cl_uint num_mem_objects, const cl_mem* mem_list, const void** args_mem_loc, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueNativeKernel( command_queue, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueNativeKernel( command_queue, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueNativeKernel_disp( cl_command_queue command_queue, void (CL_CALLBACK* user_func)(void*), void* args, size_t cb_args, cl_uint num_mem_objects, const cl_mem* mem_list, const void** args_mem_loc, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueNativeKernel( command_queue, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetCommandQueueProperty( cl_command_queue command_queue, cl_command_queue_properties properties, cl_bool enable, cl_command_queue_properties* old_properties) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetCommandQueueProperty( command_queue, properties, enable, old_properties); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clSetCommandQueueProperty( command_queue, properties, enable, old_properties); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetCommandQueueProperty_disp( cl_command_queue command_queue, cl_command_queue_properties properties, cl_bool enable, cl_command_queue_properties* old_properties) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clSetCommandQueueProperty( command_queue, properties, enable, old_properties); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_mem CL_API_CALL clCreateImage2D( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_row_pitch, void* host_ptr, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateImage2D( context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateImage2D( context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateImage2D_disp( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_row_pitch, void* host_ptr, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateImage2D( context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_mem CL_API_CALL clCreateImage3D( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_depth, size_t image_row_pitch, size_t image_slice_pitch, void* host_ptr, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateImage3D( context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateImage3D( context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateImage3D_disp( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_depth, size_t image_row_pitch, size_t image_slice_pitch, void* host_ptr, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateImage3D( context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarker( cl_command_queue command_queue, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueMarker( command_queue, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMarker( command_queue, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueMarker_disp( cl_command_queue command_queue, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMarker( command_queue, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueWaitForEvents( cl_command_queue command_queue, cl_uint num_events, const cl_event* event_list) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueWaitForEvents( command_queue, num_events, event_list); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueWaitForEvents( command_queue, num_events, event_list); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueWaitForEvents_disp( cl_command_queue command_queue, cl_uint num_events, const cl_event* event_list) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueWaitForEvents( command_queue, num_events, event_list); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrier( cl_command_queue command_queue) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueBarrier( command_queue); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueBarrier( command_queue); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueBarrier_disp( cl_command_queue command_queue) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueBarrier( command_queue); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clUnloadCompiler( void ) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clUnloadCompiler( ); #endif // defined(CL_ENABLE_LAYERS) // Nothing! return CL_SUCCESS; } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clUnloadCompiler_disp( void ) { // Nothing! return CL_SUCCESS; } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) extern void* CL_API_CALL clGetExtensionFunctionAddress_disp( const char* func_name) CL_API_SUFFIX__VERSION_1_1_DEPRECATED; #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_command_queue CL_API_CALL clCreateCommandQueue( cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateCommandQueue( context, device, properties, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateCommandQueue( context, device, properties, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_command_queue CL_API_CALL clCreateCommandQueue_disp( cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateCommandQueue( context, device, properties, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_sampler CL_API_CALL clCreateSampler( cl_context context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateSampler( context, normalized_coords, addressing_mode, filter_mode, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateSampler( context, normalized_coords, addressing_mode, filter_mode, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_sampler CL_API_CALL clCreateSampler_disp( cl_context context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateSampler( context, normalized_coords, addressing_mode, filter_mode, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueTask( cl_command_queue command_queue, cl_kernel kernel, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueTask( command_queue, kernel, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueTask( command_queue, kernel, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueTask_disp( cl_command_queue command_queue, cl_kernel kernel, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueTask( command_queue, kernel, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_mem CL_API_CALL clCreateSubBuffer( cl_mem buffer, cl_mem_flags flags, cl_buffer_create_type buffer_create_type, const void* buffer_create_info, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateSubBuffer( buffer, flags, buffer_create_type, buffer_create_info, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(buffer, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(buffer)->clCreateSubBuffer( buffer, flags, buffer_create_type, buffer_create_info, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateSubBuffer_disp( cl_mem buffer, cl_mem_flags flags, cl_buffer_create_type buffer_create_type, const void* buffer_create_info, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(buffer, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(buffer)->clCreateSubBuffer( buffer, flags, buffer_create_type, buffer_create_info, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetMemObjectDestructorCallback( cl_mem memobj, void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data), void* user_data) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetMemObjectDestructorCallback( memobj, pfn_notify, user_data); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(memobj)->clSetMemObjectDestructorCallback( memobj, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetMemObjectDestructorCallback_disp( cl_mem memobj, void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data), void* user_data) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(memobj)->clSetMemObjectDestructorCallback( memobj, pfn_notify, user_data); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_event CL_API_CALL clCreateUserEvent( cl_context context, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateUserEvent( context, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateUserEvent( context, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_event CL_API_CALL clCreateUserEvent_disp( cl_context context, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateUserEvent( context, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetUserEventStatus( cl_event event, cl_int execution_status) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetUserEventStatus( event, execution_status); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clSetUserEventStatus( event, execution_status); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetUserEventStatus_disp( cl_event event, cl_int execution_status) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clSetUserEventStatus( event, execution_status); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetEventCallback( cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK* pfn_notify)(cl_event event, cl_int event_command_status, void *user_data), void* user_data) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetEventCallback( event, command_exec_callback_type, pfn_notify, user_data); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clSetEventCallback( event, command_exec_callback_type, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetEventCallback_disp( cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK* pfn_notify)(cl_event event, cl_int event_command_status, void *user_data), void* user_data) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT); return KHR_ICD2_DISPATCH(event)->clSetEventCallback( event, command_exec_callback_type, pfn_notify, user_data); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBufferRect( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, const size_t* buffer_origin, const size_t* host_origin, const size_t* region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueReadBufferRect( command_queue, buffer, blocking_read, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReadBufferRect( command_queue, buffer, blocking_read, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueReadBufferRect_disp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, const size_t* buffer_origin, const size_t* host_origin, const size_t* region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReadBufferRect( command_queue, buffer, blocking_read, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBufferRect( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, const size_t* buffer_origin, const size_t* host_origin, const size_t* region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueWriteBufferRect( command_queue, buffer, blocking_write, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueWriteBufferRect( command_queue, buffer, blocking_write, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueWriteBufferRect_disp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, const size_t* buffer_origin, const size_t* host_origin, const size_t* region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueWriteBufferRect( command_queue, buffer, blocking_write, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferRect( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, const size_t* src_origin, const size_t* dst_origin, const size_t* region, size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch, size_t dst_slice_pitch, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueCopyBufferRect( command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyBufferRect( command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueCopyBufferRect_disp( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, const size_t* src_origin, const size_t* dst_origin, const size_t* region, size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch, size_t dst_slice_pitch, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueCopyBufferRect( command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clCreateSubDevices( cl_device_id in_device, const cl_device_partition_property* properties, cl_uint num_devices, cl_device_id* out_devices, cl_uint* num_devices_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateSubDevices( in_device, properties, num_devices, out_devices, num_devices_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(in_device)->clCreateSubDevices( in_device, properties, num_devices, out_devices, num_devices_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clCreateSubDevices_disp( cl_device_id in_device, const cl_device_partition_property* properties, cl_uint num_devices, cl_device_id* out_devices, cl_uint* num_devices_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(in_device)->clCreateSubDevices( in_device, properties, num_devices, out_devices, num_devices_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clRetainDevice( cl_device_id device) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainDevice( device); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clRetainDevice( device); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainDevice_disp( cl_device_id device) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clRetainDevice( device); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clReleaseDevice( cl_device_id device) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseDevice( device); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clReleaseDevice( device); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseDevice_disp( cl_device_id device) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clReleaseDevice( device); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_mem CL_API_CALL clCreateImage( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, const cl_image_desc* image_desc, void* host_ptr, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateImage( context, flags, image_format, image_desc, host_ptr, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateImage( context, flags, image_format, image_desc, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateImage_disp( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, const cl_image_desc* image_desc, void* host_ptr, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateImage( context, flags, image_format, image_desc, host_ptr, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBuiltInKernels( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const char* kernel_names, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateProgramWithBuiltInKernels( context, num_devices, device_list, kernel_names, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateProgramWithBuiltInKernels( context, num_devices, device_list, kernel_names, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_program CL_API_CALL clCreateProgramWithBuiltInKernels_disp( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const char* kernel_names, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateProgramWithBuiltInKernels( context, num_devices, device_list, kernel_names, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clCompileProgram( cl_program program, cl_uint num_devices, const cl_device_id* device_list, const char* options, cl_uint num_input_headers, const cl_program* input_headers, const char** header_include_names, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCompileProgram( program, num_devices, device_list, options, num_input_headers, input_headers, header_include_names, pfn_notify, user_data); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clCompileProgram( program, num_devices, device_list, options, num_input_headers, input_headers, header_include_names, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clCompileProgram_disp( cl_program program, cl_uint num_devices, const cl_device_id* device_list, const char* options, cl_uint num_input_headers, const cl_program* input_headers, const char** header_include_names, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clCompileProgram( program, num_devices, device_list, options, num_input_headers, input_headers, header_include_names, pfn_notify, user_data); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_program CL_API_CALL clLinkProgram( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const char* options, cl_uint num_input_programs, const cl_program* input_programs, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clLinkProgram( context, num_devices, device_list, options, num_input_programs, input_programs, pfn_notify, user_data, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clLinkProgram( context, num_devices, device_list, options, num_input_programs, input_programs, pfn_notify, user_data, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_program CL_API_CALL clLinkProgram_disp( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const char* options, cl_uint num_input_programs, const cl_program* input_programs, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clLinkProgram( context, num_devices, device_list, options, num_input_programs, input_programs, pfn_notify, user_data, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clUnloadPlatformCompiler( cl_platform_id platform) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clUnloadPlatformCompiler( platform); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); return KHR_ICD2_DISPATCH(platform)->clUnloadPlatformCompiler( platform); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clUnloadPlatformCompiler_disp( cl_platform_id platform) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); return KHR_ICD2_DISPATCH(platform)->clUnloadPlatformCompiler( platform); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetKernelArgInfo( cl_kernel kernel, cl_uint arg_index, cl_kernel_arg_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetKernelArgInfo( kernel, arg_index, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clGetKernelArgInfo( kernel, arg_index, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetKernelArgInfo_disp( cl_kernel kernel, cl_uint arg_index, cl_kernel_arg_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clGetKernelArgInfo( kernel, arg_index, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillBuffer( cl_command_queue command_queue, cl_mem buffer, const void* pattern, size_t pattern_size, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueFillBuffer( command_queue, buffer, pattern, pattern_size, offset, size, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueFillBuffer( command_queue, buffer, pattern, pattern_size, offset, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueFillBuffer_disp( cl_command_queue command_queue, cl_mem buffer, const void* pattern, size_t pattern_size, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueFillBuffer( command_queue, buffer, pattern, pattern_size, offset, size, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillImage( cl_command_queue command_queue, cl_mem image, const void* fill_color, const size_t* origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueFillImage( command_queue, image, fill_color, origin, region, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueFillImage( command_queue, image, fill_color, origin, region, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueFillImage_disp( cl_command_queue command_queue, cl_mem image, const void* fill_color, const size_t* origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueFillImage( command_queue, image, fill_color, origin, region, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjects( cl_command_queue command_queue, cl_uint num_mem_objects, const cl_mem* mem_objects, cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueMigrateMemObjects( command_queue, num_mem_objects, mem_objects, flags, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMigrateMemObjects( command_queue, num_mem_objects, mem_objects, flags, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueMigrateMemObjects_disp( cl_command_queue command_queue, cl_uint num_mem_objects, const cl_mem* mem_objects, cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMigrateMemObjects( command_queue, num_mem_objects, mem_objects, flags, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarkerWithWaitList( cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueMarkerWithWaitList( command_queue, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMarkerWithWaitList( command_queue, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueMarkerWithWaitList_disp( cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueMarkerWithWaitList( command_queue, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrierWithWaitList( cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueBarrierWithWaitList( command_queue, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueBarrierWithWaitList( command_queue, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueBarrierWithWaitList_disp( cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueBarrierWithWaitList( command_queue, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) extern void* CL_API_CALL clGetExtensionFunctionAddressForPlatform_disp( cl_platform_id platform, const char* func_name) CL_API_SUFFIX__VERSION_1_2; #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties( cl_context context, cl_device_id device, const cl_queue_properties* properties, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateCommandQueueWithProperties( context, device, properties, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateCommandQueueWithProperties( context, device, properties, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties_disp( cl_context context, cl_device_id device, const cl_queue_properties* properties, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateCommandQueueWithProperties( context, device, properties, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_mem CL_API_CALL clCreatePipe( cl_context context, cl_mem_flags flags, cl_uint pipe_packet_size, cl_uint pipe_max_packets, const cl_pipe_properties* properties, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreatePipe( context, flags, pipe_packet_size, pipe_max_packets, properties, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreatePipe( context, flags, pipe_packet_size, pipe_max_packets, properties, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreatePipe_disp( cl_context context, cl_mem_flags flags, cl_uint pipe_packet_size, cl_uint pipe_max_packets, const cl_pipe_properties* properties, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreatePipe( context, flags, pipe_packet_size, pipe_max_packets, properties, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetPipeInfo( cl_mem pipe, cl_pipe_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetPipeInfo( pipe, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(pipe, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(pipe)->clGetPipeInfo( pipe, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetPipeInfo_disp( cl_mem pipe, cl_pipe_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(pipe, CL_INVALID_MEM_OBJECT); return KHR_ICD2_DISPATCH(pipe)->clGetPipeInfo( pipe, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY void* CL_API_CALL clSVMAlloc( cl_context context, cl_svm_mem_flags flags, size_t size, cl_uint alignment) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSVMAlloc( context, flags, size, alignment); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, NULL); return KHR_ICD2_DISPATCH(context)->clSVMAlloc( context, flags, size, alignment); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static void* CL_API_CALL clSVMAlloc_disp( cl_context context, cl_svm_mem_flags flags, size_t size, cl_uint alignment) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, NULL); return KHR_ICD2_DISPATCH(context)->clSVMAlloc( context, flags, size, alignment); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY void CL_API_CALL clSVMFree( cl_context context, void* svm_pointer) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) { khrFirstLayer->dispatch.clSVMFree( context, svm_pointer); } else #endif // defined(CL_ENABLE_LAYERS) if (context != NULL) KHR_ICD2_DISPATCH(context)->clSVMFree( context, svm_pointer); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static void CL_API_CALL clSVMFree_disp( cl_context context, void* svm_pointer) { if (context != NULL) KHR_ICD2_DISPATCH(context)->clSVMFree( context, svm_pointer); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_sampler CL_API_CALL clCreateSamplerWithProperties( cl_context context, const cl_sampler_properties* sampler_properties, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateSamplerWithProperties( context, sampler_properties, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateSamplerWithProperties( context, sampler_properties, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_sampler CL_API_CALL clCreateSamplerWithProperties_disp( cl_context context, const cl_sampler_properties* sampler_properties, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateSamplerWithProperties( context, sampler_properties, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgSVMPointer( cl_kernel kernel, cl_uint arg_index, const void* arg_value) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetKernelArgSVMPointer( kernel, arg_index, arg_value); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clSetKernelArgSVMPointer( kernel, arg_index, arg_value); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetKernelArgSVMPointer_disp( cl_kernel kernel, cl_uint arg_index, const void* arg_value) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clSetKernelArgSVMPointer( kernel, arg_index, arg_value); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetKernelExecInfo( cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetKernelExecInfo( kernel, param_name, param_value_size, param_value); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clSetKernelExecInfo( kernel, param_name, param_value_size, param_value); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetKernelExecInfo_disp( cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clSetKernelExecInfo( kernel, param_name, param_value_size, param_value); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMFree( cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[], void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueSVMFree( command_queue, num_svm_pointers, svm_pointers, pfn_free_func, user_data, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMFree( command_queue, num_svm_pointers, svm_pointers, pfn_free_func, user_data, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueSVMFree_disp( cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[], void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMFree( command_queue, num_svm_pointers, svm_pointers, pfn_free_func, user_data, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMemcpy( cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueSVMMemcpy( command_queue, blocking_copy, dst_ptr, src_ptr, size, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMMemcpy( command_queue, blocking_copy, dst_ptr, src_ptr, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueSVMMemcpy_disp( cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMMemcpy( command_queue, blocking_copy, dst_ptr, src_ptr, size, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMemFill( cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueSVMMemFill( command_queue, svm_ptr, pattern, pattern_size, size, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMMemFill( command_queue, svm_ptr, pattern, pattern_size, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueSVMMemFill_disp( cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMMemFill( command_queue, svm_ptr, pattern, pattern_size, size, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMap( cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags flags, void* svm_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueSVMMap( command_queue, blocking_map, flags, svm_ptr, size, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMMap( command_queue, blocking_map, flags, svm_ptr, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueSVMMap_disp( cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags flags, void* svm_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMMap( command_queue, blocking_map, flags, svm_ptr, size, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMUnmap( cl_command_queue command_queue, void* svm_ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueSVMUnmap( command_queue, svm_ptr, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMUnmap( command_queue, svm_ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueSVMUnmap_disp( cl_command_queue command_queue, void* svm_ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMUnmap( command_queue, svm_ptr, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetDefaultDeviceCommandQueue( cl_context context, cl_device_id device, cl_command_queue command_queue) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetDefaultDeviceCommandQueue( context, device, command_queue); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clSetDefaultDeviceCommandQueue( context, device, command_queue); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetDefaultDeviceCommandQueue_disp( cl_context context, cl_device_id device, cl_command_queue command_queue) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clSetDefaultDeviceCommandQueue( context, device, command_queue); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetDeviceAndHostTimer( cl_device_id device, cl_ulong* device_timestamp, cl_ulong* host_timestamp) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetDeviceAndHostTimer( device, device_timestamp, host_timestamp); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clGetDeviceAndHostTimer( device, device_timestamp, host_timestamp); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetDeviceAndHostTimer_disp( cl_device_id device, cl_ulong* device_timestamp, cl_ulong* host_timestamp) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clGetDeviceAndHostTimer( device, device_timestamp, host_timestamp); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetHostTimer( cl_device_id device, cl_ulong* host_timestamp) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetHostTimer( device, host_timestamp); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clGetHostTimer( device, host_timestamp); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetHostTimer_disp( cl_device_id device, cl_ulong* host_timestamp) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); return KHR_ICD2_DISPATCH(device)->clGetHostTimer( device, host_timestamp); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithIL( cl_context context, const void* il, size_t length, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateProgramWithIL( context, il, length, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateProgramWithIL( context, il, length, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_program CL_API_CALL clCreateProgramWithIL_disp( cl_context context, const void* il, size_t length, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateProgramWithIL( context, il, length, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_kernel CL_API_CALL clCloneKernel( cl_kernel source_kernel, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCloneKernel( source_kernel, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(source_kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(source_kernel)->clCloneKernel( source_kernel, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_kernel CL_API_CALL clCloneKernel_disp( cl_kernel source_kernel, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(source_kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(source_kernel)->clCloneKernel( source_kernel, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clGetKernelSubGroupInfo( cl_kernel kernel, cl_device_id device, cl_kernel_sub_group_info param_name, size_t input_value_size, const void* input_value, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetKernelSubGroupInfo( kernel, device, param_name, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clGetKernelSubGroupInfo( kernel, device, param_name, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetKernelSubGroupInfo_disp( cl_kernel kernel, cl_device_id device, cl_kernel_sub_group_info param_name, size_t input_value_size, const void* input_value, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL); return KHR_ICD2_DISPATCH(kernel)->clGetKernelSubGroupInfo( kernel, device, param_name, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMigrateMem( cl_command_queue command_queue, cl_uint num_svm_pointers, const void** svm_pointers, const size_t* sizes, cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueSVMMigrateMem( command_queue, num_svm_pointers, svm_pointers, sizes, flags, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMMigrateMem( command_queue, num_svm_pointers, svm_pointers, sizes, flags, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueSVMMigrateMem_disp( cl_command_queue command_queue, cl_uint num_svm_pointers, const void** svm_pointers, const size_t* sizes, cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueSVMMigrateMem( command_queue, num_svm_pointers, svm_pointers, sizes, flags, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetProgramSpecializationConstant( cl_program program, cl_uint spec_id, size_t spec_size, const void* spec_value) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetProgramSpecializationConstant( program, spec_id, spec_size, spec_value); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clSetProgramSpecializationConstant( program, spec_id, spec_size, spec_value); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetProgramSpecializationConstant_disp( cl_program program, cl_uint spec_id, size_t spec_size, const void* spec_value) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clSetProgramSpecializationConstant( program, spec_id, spec_size, spec_value); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetProgramReleaseCallback( cl_program program, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetProgramReleaseCallback( program, pfn_notify, user_data); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clSetProgramReleaseCallback( program, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetProgramReleaseCallback_disp( cl_program program, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM); return KHR_ICD2_DISPATCH(program)->clSetProgramReleaseCallback( program, pfn_notify, user_data); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_int CL_API_CALL clSetContextDestructorCallback( cl_context context, void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data), void* user_data) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clSetContextDestructorCallback( context, pfn_notify, user_data); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clSetContextDestructorCallback( context, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clSetContextDestructorCallback_disp( cl_context context, void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data), void* user_data) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clSetContextDestructorCallback( context, pfn_notify, user_data); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_mem CL_API_CALL clCreateBufferWithProperties( cl_context context, const cl_mem_properties* properties, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateBufferWithProperties( context, properties, flags, size, host_ptr, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateBufferWithProperties( context, properties, flags, size, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateBufferWithProperties_disp( cl_context context, const cl_mem_properties* properties, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateBufferWithProperties( context, properties, flags, size, host_ptr, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// CL_API_ENTRY cl_mem CL_API_CALL clCreateImageWithProperties( cl_context context, const cl_mem_properties* properties, cl_mem_flags flags, const cl_image_format* image_format, const cl_image_desc* image_desc, void* host_ptr, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateImageWithProperties( context, properties, flags, image_format, image_desc, host_ptr, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateImageWithProperties( context, properties, flags, image_format, image_desc, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateImageWithProperties_disp( cl_context context, const cl_mem_properties* properties, cl_mem_flags flags, const cl_image_format* image_format, const cl_image_desc* image_desc, void* host_ptr, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); return KHR_ICD2_DISPATCH(context)->clCreateImageWithProperties( context, properties, flags, image_format, image_desc, host_ptr, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// // cl_ext_device_fission CL_API_ENTRY cl_int CL_API_CALL clReleaseDeviceEXT( cl_device_id device) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clReleaseDeviceEXT( device); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(device)->clReleaseDeviceEXT); return KHR_ICD2_DISPATCH(device)->clReleaseDeviceEXT( device); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clReleaseDeviceEXT_disp( cl_device_id device) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(device)->clReleaseDeviceEXT); return KHR_ICD2_DISPATCH(device)->clReleaseDeviceEXT( device); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clRetainDeviceEXT( cl_device_id device) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clRetainDeviceEXT( device); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(device)->clRetainDeviceEXT); return KHR_ICD2_DISPATCH(device)->clRetainDeviceEXT( device); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clRetainDeviceEXT_disp( cl_device_id device) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(device)->clRetainDeviceEXT); return KHR_ICD2_DISPATCH(device)->clRetainDeviceEXT( device); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clCreateSubDevicesEXT( cl_device_id in_device, const cl_device_partition_property_ext* properties, cl_uint num_entries, cl_device_id* out_devices, cl_uint* num_devices) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateSubDevicesEXT( in_device, properties, num_entries, out_devices, num_devices); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_device, CL_INVALID_DEVICE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(in_device)->clCreateSubDevicesEXT); return KHR_ICD2_DISPATCH(in_device)->clCreateSubDevicesEXT( in_device, properties, num_entries, out_devices, num_devices); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clCreateSubDevicesEXT_disp( cl_device_id in_device, const cl_device_partition_property_ext* properties, cl_uint num_entries, cl_device_id* out_devices, cl_uint* num_devices) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_device, CL_INVALID_DEVICE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(in_device)->clCreateSubDevicesEXT); return KHR_ICD2_DISPATCH(in_device)->clCreateSubDevicesEXT( in_device, properties, num_entries, out_devices, num_devices); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// // cl_khr_d3d10_sharing #if defined(_WIN32) CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR( cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source, void* d3d_object, cl_d3d10_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetDeviceIDsFromD3D10KHR( platform, d3d_device_source, d3d_object, d3d_device_set, num_entries, devices, num_devices); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromD3D10KHR); return KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromD3D10KHR( platform, d3d_device_source, d3d_object, d3d_device_set, num_entries, devices, num_devices); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR_disp( cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source, void* d3d_object, cl_d3d10_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromD3D10KHR); return KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromD3D10KHR( platform, d3d_device_source, d3d_object, d3d_device_set, num_entries, devices, num_devices); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10BufferKHR( cl_context context, cl_mem_flags flags, ID3D10Buffer* resource, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromD3D10BufferKHR( context, flags, resource, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D10BufferKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D10BufferKHR( context, flags, resource, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromD3D10BufferKHR_disp( cl_context context, cl_mem_flags flags, ID3D10Buffer* resource, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D10BufferKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D10BufferKHR( context, flags, resource, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10Texture2DKHR( cl_context context, cl_mem_flags flags, ID3D10Texture2D* resource, UINT subresource, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromD3D10Texture2DKHR( context, flags, resource, subresource, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D10Texture2DKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D10Texture2DKHR( context, flags, resource, subresource, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromD3D10Texture2DKHR_disp( cl_context context, cl_mem_flags flags, ID3D10Texture2D* resource, UINT subresource, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D10Texture2DKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D10Texture2DKHR( context, flags, resource, subresource, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10Texture3DKHR( cl_context context, cl_mem_flags flags, ID3D10Texture3D* resource, UINT subresource, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromD3D10Texture3DKHR( context, flags, resource, subresource, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D10Texture3DKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D10Texture3DKHR( context, flags, resource, subresource, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromD3D10Texture3DKHR_disp( cl_context context, cl_mem_flags flags, ID3D10Texture3D* resource, UINT subresource, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D10Texture3DKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D10Texture3DKHR( context, flags, resource, subresource, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireD3D10ObjectsKHR( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueAcquireD3D10ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireD3D10ObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireD3D10ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueAcquireD3D10ObjectsKHR_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireD3D10ObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireD3D10ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseD3D10ObjectsKHR( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueReleaseD3D10ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseD3D10ObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseD3D10ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueReleaseD3D10ObjectsKHR_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseD3D10ObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseD3D10ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_d3d11_sharing #if defined(_WIN32) CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR( cl_platform_id platform, cl_d3d11_device_source_khr d3d_device_source, void* d3d_object, cl_d3d11_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetDeviceIDsFromD3D11KHR( platform, d3d_device_source, d3d_object, d3d_device_set, num_entries, devices, num_devices); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromD3D11KHR); return KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromD3D11KHR( platform, d3d_device_source, d3d_object, d3d_device_set, num_entries, devices, num_devices); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR_disp( cl_platform_id platform, cl_d3d11_device_source_khr d3d_device_source, void* d3d_object, cl_d3d11_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromD3D11KHR); return KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromD3D11KHR( platform, d3d_device_source, d3d_object, d3d_device_set, num_entries, devices, num_devices); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11BufferKHR( cl_context context, cl_mem_flags flags, ID3D11Buffer* resource, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromD3D11BufferKHR( context, flags, resource, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D11BufferKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D11BufferKHR( context, flags, resource, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromD3D11BufferKHR_disp( cl_context context, cl_mem_flags flags, ID3D11Buffer* resource, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D11BufferKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D11BufferKHR( context, flags, resource, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11Texture2DKHR( cl_context context, cl_mem_flags flags, ID3D11Texture2D* resource, UINT subresource, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromD3D11Texture2DKHR( context, flags, resource, subresource, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D11Texture2DKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D11Texture2DKHR( context, flags, resource, subresource, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromD3D11Texture2DKHR_disp( cl_context context, cl_mem_flags flags, ID3D11Texture2D* resource, UINT subresource, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D11Texture2DKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D11Texture2DKHR( context, flags, resource, subresource, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11Texture3DKHR( cl_context context, cl_mem_flags flags, ID3D11Texture3D* resource, UINT subresource, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromD3D11Texture3DKHR( context, flags, resource, subresource, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D11Texture3DKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D11Texture3DKHR( context, flags, resource, subresource, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromD3D11Texture3DKHR_disp( cl_context context, cl_mem_flags flags, ID3D11Texture3D* resource, UINT subresource, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromD3D11Texture3DKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromD3D11Texture3DKHR( context, flags, resource, subresource, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireD3D11ObjectsKHR( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueAcquireD3D11ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireD3D11ObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireD3D11ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueAcquireD3D11ObjectsKHR_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireD3D11ObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireD3D11ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseD3D11ObjectsKHR( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueReleaseD3D11ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseD3D11ObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseD3D11ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueReleaseD3D11ObjectsKHR_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseD3D11ObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseD3D11ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_dx9_media_sharing #if defined(_WIN32) CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR( cl_platform_id platform, cl_uint num_media_adapters, cl_dx9_media_adapter_type_khr* media_adapter_type, void* media_adapters, cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetDeviceIDsFromDX9MediaAdapterKHR( platform, num_media_adapters, media_adapter_type, media_adapters, media_adapter_set, num_entries, devices, num_devices); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromDX9MediaAdapterKHR); return KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromDX9MediaAdapterKHR( platform, num_media_adapters, media_adapter_type, media_adapters, media_adapter_set, num_entries, devices, num_devices); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR_disp( cl_platform_id platform, cl_uint num_media_adapters, cl_dx9_media_adapter_type_khr* media_adapter_type, void* media_adapters, cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromDX9MediaAdapterKHR); return KHR_ICD2_DISPATCH(platform)->clGetDeviceIDsFromDX9MediaAdapterKHR( platform, num_media_adapters, media_adapter_type, media_adapters, media_adapter_set, num_entries, devices, num_devices); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceKHR( cl_context context, cl_mem_flags flags, cl_dx9_media_adapter_type_khr adapter_type, void* surface_info, cl_uint plane, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromDX9MediaSurfaceKHR( context, flags, adapter_type, surface_info, plane, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromDX9MediaSurfaceKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromDX9MediaSurfaceKHR( context, flags, adapter_type, surface_info, plane, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceKHR_disp( cl_context context, cl_mem_flags flags, cl_dx9_media_adapter_type_khr adapter_type, void* surface_info, cl_uint plane, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromDX9MediaSurfaceKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromDX9MediaSurfaceKHR( context, flags, adapter_type, surface_info, plane, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireDX9MediaSurfacesKHR( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueAcquireDX9MediaSurfacesKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireDX9MediaSurfacesKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireDX9MediaSurfacesKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueAcquireDX9MediaSurfacesKHR_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireDX9MediaSurfacesKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireDX9MediaSurfacesKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseDX9MediaSurfacesKHR( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueReleaseDX9MediaSurfacesKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseDX9MediaSurfacesKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseDX9MediaSurfacesKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueReleaseDX9MediaSurfacesKHR_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseDX9MediaSurfacesKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseDX9MediaSurfacesKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_egl_event CL_API_ENTRY cl_event CL_API_CALL clCreateEventFromEGLSyncKHR( cl_context context, CLeglSyncKHR sync, CLeglDisplayKHR display, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateEventFromEGLSyncKHR( context, sync, display, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateEventFromEGLSyncKHR); return KHR_ICD2_DISPATCH(context)->clCreateEventFromEGLSyncKHR( context, sync, display, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_event CL_API_CALL clCreateEventFromEGLSyncKHR_disp( cl_context context, CLeglSyncKHR sync, CLeglDisplayKHR display, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateEventFromEGLSyncKHR); return KHR_ICD2_DISPATCH(context)->clCreateEventFromEGLSyncKHR( context, sync, display, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// // cl_khr_egl_image CL_API_ENTRY cl_mem CL_API_CALL clCreateFromEGLImageKHR( cl_context context, CLeglDisplayKHR egldisplay, CLeglImageKHR eglimage, cl_mem_flags flags, const cl_egl_image_properties_khr* properties, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromEGLImageKHR( context, egldisplay, eglimage, flags, properties, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromEGLImageKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromEGLImageKHR( context, egldisplay, eglimage, flags, properties, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromEGLImageKHR_disp( cl_context context, CLeglDisplayKHR egldisplay, CLeglImageKHR eglimage, cl_mem_flags flags, const cl_egl_image_properties_khr* properties, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromEGLImageKHR); return KHR_ICD2_DISPATCH(context)->clCreateFromEGLImageKHR( context, egldisplay, eglimage, flags, properties, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireEGLObjectsKHR( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueAcquireEGLObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireEGLObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireEGLObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueAcquireEGLObjectsKHR_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireEGLObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireEGLObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseEGLObjectsKHR( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueReleaseEGLObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseEGLObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseEGLObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueReleaseEGLObjectsKHR_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseEGLObjectsKHR); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseEGLObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// // cl_khr_gl_event CL_API_ENTRY cl_event CL_API_CALL clCreateEventFromGLsyncKHR( cl_context context, cl_GLsync sync, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateEventFromGLsyncKHR( context, sync, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateEventFromGLsyncKHR); return KHR_ICD2_DISPATCH(context)->clCreateEventFromGLsyncKHR( context, sync, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_event CL_API_CALL clCreateEventFromGLsyncKHR_disp( cl_context context, cl_GLsync sync, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateEventFromGLsyncKHR); return KHR_ICD2_DISPATCH(context)->clCreateEventFromGLsyncKHR( context, sync, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// // cl_khr_gl_sharing CL_API_ENTRY cl_int CL_API_CALL clGetGLContextInfoKHR( const cl_context_properties* properties, cl_gl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetGLContextInfoKHR( properties, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) cl_platform_id platform = NULL; khrIcdContextPropertiesGetPlatform(properties, &platform); KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->clGetGLContextInfoKHR); return KHR_ICD2_DISPATCH(platform)->clGetGLContextInfoKHR( properties, param_name, param_value_size, param_value, param_value_size_ret); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetGLContextInfoKHR_disp( const cl_context_properties* properties, cl_gl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { cl_platform_id platform = NULL; khrIcdContextPropertiesGetPlatform(properties, &platform); KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->clGetGLContextInfoKHR); return KHR_ICD2_DISPATCH(platform)->clGetGLContextInfoKHR( properties, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLBuffer( cl_context context, cl_mem_flags flags, cl_GLuint bufobj, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromGLBuffer( context, flags, bufobj, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLBuffer); return KHR_ICD2_DISPATCH(context)->clCreateFromGLBuffer( context, flags, bufobj, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromGLBuffer_disp( cl_context context, cl_mem_flags flags, cl_GLuint bufobj, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLBuffer); return KHR_ICD2_DISPATCH(context)->clCreateFromGLBuffer( context, flags, bufobj, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromGLTexture( context, flags, target, miplevel, texture, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture); return KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture( context, flags, target, miplevel, texture, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromGLTexture_disp( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture); return KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture( context, flags, target, miplevel, texture, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLRenderbuffer( cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromGLRenderbuffer( context, flags, renderbuffer, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLRenderbuffer); return KHR_ICD2_DISPATCH(context)->clCreateFromGLRenderbuffer( context, flags, renderbuffer, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromGLRenderbuffer_disp( cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLRenderbuffer); return KHR_ICD2_DISPATCH(context)->clCreateFromGLRenderbuffer( context, flags, renderbuffer, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clGetGLObjectInfo( cl_mem memobj, cl_gl_object_type* gl_object_type, cl_GLuint* gl_object_name) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetGLObjectInfo( memobj, gl_object_type, gl_object_name); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(memobj)->clGetGLObjectInfo); return KHR_ICD2_DISPATCH(memobj)->clGetGLObjectInfo( memobj, gl_object_type, gl_object_name); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetGLObjectInfo_disp( cl_mem memobj, cl_gl_object_type* gl_object_type, cl_GLuint* gl_object_name) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(memobj)->clGetGLObjectInfo); return KHR_ICD2_DISPATCH(memobj)->clGetGLObjectInfo( memobj, gl_object_type, gl_object_name); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clGetGLTextureInfo( cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetGLTextureInfo( memobj, param_name, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(memobj)->clGetGLTextureInfo); return KHR_ICD2_DISPATCH(memobj)->clGetGLTextureInfo( memobj, param_name, param_value_size, param_value, param_value_size_ret); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetGLTextureInfo_disp( cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(memobj)->clGetGLTextureInfo); return KHR_ICD2_DISPATCH(memobj)->clGetGLTextureInfo( memobj, param_name, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireGLObjects( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueAcquireGLObjects( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireGLObjects); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireGLObjects( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueAcquireGLObjects_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireGLObjects); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueAcquireGLObjects( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseGLObjects( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clEnqueueReleaseGLObjects( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseGLObjects); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseGLObjects( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clEnqueueReleaseGLObjects_disp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseGLObjects); return KHR_ICD2_DISPATCH(command_queue)->clEnqueueReleaseGLObjects( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture2D( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromGLTexture2D( context, flags, target, miplevel, texture, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture2D); return KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture2D( context, flags, target, miplevel, texture, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromGLTexture2D_disp( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture2D); return KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture2D( context, flags, target, miplevel, texture, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture3D( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clCreateFromGLTexture3D( context, flags, target, miplevel, texture, errcode_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture3D); return KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture3D( context, flags, target, miplevel, texture, errcode_ret); } #if defined(CL_ENABLE_LAYERS) static cl_mem CL_API_CALL clCreateFromGLTexture3D_disp( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture3D); return KHR_ICD2_DISPATCH(context)->clCreateFromGLTexture3D( context, flags, target, miplevel, texture, errcode_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// // cl_khr_subgroups CL_API_ENTRY cl_int CL_API_CALL clGetKernelSubGroupInfoKHR( cl_kernel in_kernel, cl_device_id in_device, cl_kernel_sub_group_info param_name, size_t input_value_size, const void* input_value, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.clGetKernelSubGroupInfoKHR( in_kernel, in_device, param_name, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); #endif // defined(CL_ENABLE_LAYERS) KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_kernel, CL_INVALID_KERNEL); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(in_kernel)->clGetKernelSubGroupInfoKHR); return KHR_ICD2_DISPATCH(in_kernel)->clGetKernelSubGroupInfoKHR( in_kernel, in_device, param_name, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); } #if defined(CL_ENABLE_LAYERS) static cl_int CL_API_CALL clGetKernelSubGroupInfoKHR_disp( cl_kernel in_kernel, cl_device_id in_device, cl_kernel_sub_group_info param_name, size_t input_value_size, const void* input_value, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_kernel, CL_INVALID_KERNEL); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(in_kernel)->clGetKernelSubGroupInfoKHR); return KHR_ICD2_DISPATCH(in_kernel)->clGetKernelSubGroupInfoKHR( in_kernel, in_device, param_name, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); } #endif // defined(CL_ENABLE_LAYERS) /////////////////////////////////////////////////////////////////////////////// #if defined(CL_ENABLE_LAYERS) struct _cl_icd_dispatch khrMasterDispatch = { {&clGetPlatformIDs_disp}, &clGetPlatformInfo_disp, &clGetDeviceIDs_disp, &clGetDeviceInfo_disp, &clCreateContext_disp, &clCreateContextFromType_disp, &clRetainContext_disp, &clReleaseContext_disp, &clGetContextInfo_disp, &clCreateCommandQueue_disp, &clRetainCommandQueue_disp, &clReleaseCommandQueue_disp, &clGetCommandQueueInfo_disp, &clSetCommandQueueProperty_disp, &clCreateBuffer_disp, &clCreateImage2D_disp, &clCreateImage3D_disp, &clRetainMemObject_disp, &clReleaseMemObject_disp, &clGetSupportedImageFormats_disp, &clGetMemObjectInfo_disp, &clGetImageInfo_disp, &clCreateSampler_disp, &clRetainSampler_disp, &clReleaseSampler_disp, &clGetSamplerInfo_disp, &clCreateProgramWithSource_disp, &clCreateProgramWithBinary_disp, &clRetainProgram_disp, &clReleaseProgram_disp, &clBuildProgram_disp, {&clUnloadCompiler_disp}, &clGetProgramInfo_disp, &clGetProgramBuildInfo_disp, &clCreateKernel_disp, &clCreateKernelsInProgram_disp, &clRetainKernel_disp, &clReleaseKernel_disp, &clSetKernelArg_disp, &clGetKernelInfo_disp, &clGetKernelWorkGroupInfo_disp, &clWaitForEvents_disp, &clGetEventInfo_disp, &clRetainEvent_disp, &clReleaseEvent_disp, &clGetEventProfilingInfo_disp, &clFlush_disp, &clFinish_disp, &clEnqueueReadBuffer_disp, &clEnqueueWriteBuffer_disp, &clEnqueueCopyBuffer_disp, &clEnqueueReadImage_disp, &clEnqueueWriteImage_disp, &clEnqueueCopyImage_disp, &clEnqueueCopyImageToBuffer_disp, &clEnqueueCopyBufferToImage_disp, &clEnqueueMapBuffer_disp, &clEnqueueMapImage_disp, &clEnqueueUnmapMemObject_disp, &clEnqueueNDRangeKernel_disp, &clEnqueueTask_disp, &clEnqueueNativeKernel_disp, &clEnqueueMarker_disp, &clEnqueueWaitForEvents_disp, &clEnqueueBarrier_disp, &clGetExtensionFunctionAddress_disp, &clCreateFromGLBuffer_disp, &clCreateFromGLTexture2D_disp, &clCreateFromGLTexture3D_disp, &clCreateFromGLRenderbuffer_disp, &clGetGLObjectInfo_disp, &clGetGLTextureInfo_disp, &clEnqueueAcquireGLObjects_disp, &clEnqueueReleaseGLObjects_disp, &clGetGLContextInfoKHR_disp, /* cl_khr_d3d10_sharing */ #if defined(_WIN32) &clGetDeviceIDsFromD3D10KHR_disp, &clCreateFromD3D10BufferKHR_disp, &clCreateFromD3D10Texture2DKHR_disp, &clCreateFromD3D10Texture3DKHR_disp, &clEnqueueAcquireD3D10ObjectsKHR_disp, &clEnqueueReleaseD3D10ObjectsKHR_disp, #else NULL, NULL, NULL, NULL, NULL, NULL, #endif /* OpenCL 1.1 */ &clSetEventCallback_disp, &clCreateSubBuffer_disp, &clSetMemObjectDestructorCallback_disp, &clCreateUserEvent_disp, &clSetUserEventStatus_disp, &clEnqueueReadBufferRect_disp, &clEnqueueWriteBufferRect_disp, &clEnqueueCopyBufferRect_disp, /* cl_ext_device_fission */ &clCreateSubDevicesEXT_disp, &clRetainDeviceEXT_disp, &clReleaseDeviceEXT_disp, /* cl_khr_gl_event */ &clCreateEventFromGLsyncKHR_disp, /* OpenCL 1.2 */ &clCreateSubDevices_disp, &clRetainDevice_disp, &clReleaseDevice_disp, &clCreateImage_disp, &clCreateProgramWithBuiltInKernels_disp, &clCompileProgram_disp, &clLinkProgram_disp, &clUnloadPlatformCompiler_disp, &clGetKernelArgInfo_disp, &clEnqueueFillBuffer_disp, &clEnqueueFillImage_disp, &clEnqueueMigrateMemObjects_disp, &clEnqueueMarkerWithWaitList_disp, &clEnqueueBarrierWithWaitList_disp, &clGetExtensionFunctionAddressForPlatform_disp, &clCreateFromGLTexture_disp, /* cl_khr_d3d11_sharing */ #if defined(_WIN32) &clGetDeviceIDsFromD3D11KHR_disp, &clCreateFromD3D11BufferKHR_disp, &clCreateFromD3D11Texture2DKHR_disp, &clCreateFromD3D11Texture3DKHR_disp, &clCreateFromDX9MediaSurfaceKHR_disp, &clEnqueueAcquireD3D11ObjectsKHR_disp, &clEnqueueReleaseD3D11ObjectsKHR_disp, #else NULL, NULL, NULL, NULL, NULL, NULL, NULL, #endif /* cl_khr_dx9_media_sharing */ #if defined(_WIN32) &clGetDeviceIDsFromDX9MediaAdapterKHR_disp, &clEnqueueAcquireDX9MediaSurfacesKHR_disp, &clEnqueueReleaseDX9MediaSurfacesKHR_disp, #else NULL, NULL, NULL, #endif /* cl_khr_egl_image */ &clCreateFromEGLImageKHR_disp, &clEnqueueAcquireEGLObjectsKHR_disp, &clEnqueueReleaseEGLObjectsKHR_disp, /* cl_khr_egl_event */ &clCreateEventFromEGLSyncKHR_disp, /* OpenCL 2.0 */ &clCreateCommandQueueWithProperties_disp, &clCreatePipe_disp, &clGetPipeInfo_disp, &clSVMAlloc_disp, &clSVMFree_disp, &clEnqueueSVMFree_disp, &clEnqueueSVMMemcpy_disp, &clEnqueueSVMMemFill_disp, &clEnqueueSVMMap_disp, &clEnqueueSVMUnmap_disp, &clCreateSamplerWithProperties_disp, &clSetKernelArgSVMPointer_disp, &clSetKernelExecInfo_disp, /* cl_khr_sub_groups */ &clGetKernelSubGroupInfoKHR_disp, /* OpenCL 2.1 */ &clCloneKernel_disp, &clCreateProgramWithIL_disp, &clEnqueueSVMMigrateMem_disp, &clGetDeviceAndHostTimer_disp, &clGetHostTimer_disp, &clGetKernelSubGroupInfo_disp, &clSetDefaultDeviceCommandQueue_disp, /* OpenCL 2.2 */ &clSetProgramReleaseCallback_disp, &clSetProgramSpecializationConstant_disp, /* OpenCL 3.0 */ &clCreateBufferWithProperties_disp, &clCreateImageWithProperties_disp, &clSetContextDestructorCallback_disp }; #endif // defined(CL_ENABLE_LAYERS) #if defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) /////////////////////////////////////////////////////////////////////////////// // Core APIs: static cl_int CL_API_CALL clGetPlatformIDs_unsupp( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms) { (void)num_entries; (void)platforms; (void)num_platforms; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetPlatformInfo_unsupp( cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)platform; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetDeviceIDs_unsupp( cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { (void)platform; (void)device_type; (void)num_entries; (void)devices; (void)num_devices; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetDeviceInfo_unsupp( cl_device_id device, cl_device_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)device; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_context CL_API_CALL clCreateContext_unsupp( const cl_context_properties* properties, cl_uint num_devices, const cl_device_id* devices, void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data), void* user_data, cl_int* errcode_ret) { (void)properties; (void)num_devices; (void)devices; (void)pfn_notify; (void)user_data; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_context CL_API_CALL clCreateContextFromType_unsupp( const cl_context_properties* properties, cl_device_type device_type, void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data), void* user_data, cl_int* errcode_ret) { (void)properties; (void)device_type; (void)pfn_notify; (void)user_data; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainContext_unsupp( cl_context context) { (void)context; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clReleaseContext_unsupp( cl_context context) { (void)context; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetContextInfo_unsupp( cl_context context, cl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)context; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainCommandQueue_unsupp( cl_command_queue command_queue) { (void)command_queue; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clReleaseCommandQueue_unsupp( cl_command_queue command_queue) { (void)command_queue; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetCommandQueueInfo_unsupp( cl_command_queue command_queue, cl_command_queue_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)command_queue; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateBuffer_unsupp( cl_context context, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret) { (void)context; (void)flags; (void)size; (void)host_ptr; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainMemObject_unsupp( cl_mem memobj) { (void)memobj; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clReleaseMemObject_unsupp( cl_mem memobj) { (void)memobj; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetSupportedImageFormats_unsupp( cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries, cl_image_format* image_formats, cl_uint* num_image_formats) { (void)context; (void)flags; (void)image_type; (void)num_entries; (void)image_formats; (void)num_image_formats; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetMemObjectInfo_unsupp( cl_mem memobj, cl_mem_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)memobj; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetImageInfo_unsupp( cl_mem image, cl_image_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)image; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainSampler_unsupp( cl_sampler sampler) { (void)sampler; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clReleaseSampler_unsupp( cl_sampler sampler) { (void)sampler; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetSamplerInfo_unsupp( cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)sampler; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_program CL_API_CALL clCreateProgramWithSource_unsupp( cl_context context, cl_uint count, const char** strings, const size_t* lengths, cl_int* errcode_ret) { (void)context; (void)count; (void)strings; (void)lengths; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_program CL_API_CALL clCreateProgramWithBinary_unsupp( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const size_t* lengths, const unsigned char** binaries, cl_int* binary_status, cl_int* errcode_ret) { (void)context; (void)num_devices; (void)device_list; (void)lengths; (void)binaries; (void)binary_status; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainProgram_unsupp( cl_program program) { (void)program; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clReleaseProgram_unsupp( cl_program program) { (void)program; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clBuildProgram_unsupp( cl_program program, cl_uint num_devices, const cl_device_id* device_list, const char* options, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { (void)program; (void)num_devices; (void)device_list; (void)options; (void)pfn_notify; (void)user_data; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetProgramInfo_unsupp( cl_program program, cl_program_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)program; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetProgramBuildInfo_unsupp( cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)program; (void)device; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_kernel CL_API_CALL clCreateKernel_unsupp( cl_program program, const char* kernel_name, cl_int* errcode_ret) { (void)program; (void)kernel_name; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clCreateKernelsInProgram_unsupp( cl_program program, cl_uint num_kernels, cl_kernel* kernels, cl_uint* num_kernels_ret) { (void)program; (void)num_kernels; (void)kernels; (void)num_kernels_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainKernel_unsupp( cl_kernel kernel) { (void)kernel; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clReleaseKernel_unsupp( cl_kernel kernel) { (void)kernel; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetKernelArg_unsupp( cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void* arg_value) { (void)kernel; (void)arg_index; (void)arg_size; (void)arg_value; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetKernelInfo_unsupp( cl_kernel kernel, cl_kernel_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)kernel; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetKernelWorkGroupInfo_unsupp( cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)kernel; (void)device; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clWaitForEvents_unsupp( cl_uint num_events, const cl_event* event_list) { (void)num_events; (void)event_list; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetEventInfo_unsupp( cl_event event, cl_event_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)event; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainEvent_unsupp( cl_event event) { (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clReleaseEvent_unsupp( cl_event event) { (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetEventProfilingInfo_unsupp( cl_event event, cl_profiling_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)event; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clFlush_unsupp( cl_command_queue command_queue) { (void)command_queue; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clFinish_unsupp( cl_command_queue command_queue) { (void)command_queue; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueReadBuffer_unsupp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t size, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)buffer; (void)blocking_read; (void)offset; (void)size; (void)ptr; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueWriteBuffer_unsupp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t size, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)buffer; (void)blocking_write; (void)offset; (void)size; (void)ptr; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueCopyBuffer_unsupp( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)src_buffer; (void)dst_buffer; (void)src_offset; (void)dst_offset; (void)size; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueReadImage_unsupp( cl_command_queue command_queue, cl_mem image, cl_bool blocking_read, const size_t* origin, const size_t* region, size_t row_pitch, size_t slice_pitch, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)image; (void)blocking_read; (void)origin; (void)region; (void)row_pitch; (void)slice_pitch; (void)ptr; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueWriteImage_unsupp( cl_command_queue command_queue, cl_mem image, cl_bool blocking_write, const size_t* origin, const size_t* region, size_t input_row_pitch, size_t input_slice_pitch, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)image; (void)blocking_write; (void)origin; (void)region; (void)input_row_pitch; (void)input_slice_pitch; (void)ptr; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueCopyImage_unsupp( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image, const size_t* src_origin, const size_t* dst_origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)src_image; (void)dst_image; (void)src_origin; (void)dst_origin; (void)region; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueCopyImageToBuffer_unsupp( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer, const size_t* src_origin, const size_t* region, size_t dst_offset, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)src_image; (void)dst_buffer; (void)src_origin; (void)region; (void)dst_offset; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueCopyBufferToImage_unsupp( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image, size_t src_offset, const size_t* dst_origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)src_buffer; (void)dst_image; (void)src_offset; (void)dst_origin; (void)region; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static void* CL_API_CALL clEnqueueMapBuffer_unsupp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret) { (void)command_queue; (void)buffer; (void)blocking_map; (void)map_flags; (void)offset; (void)size; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static void* CL_API_CALL clEnqueueMapImage_unsupp( cl_command_queue command_queue, cl_mem image, cl_bool blocking_map, cl_map_flags map_flags, const size_t* origin, const size_t* region, size_t* image_row_pitch, size_t* image_slice_pitch, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret) { (void)command_queue; (void)image; (void)blocking_map; (void)map_flags; (void)origin; (void)region; (void)image_row_pitch; (void)image_slice_pitch; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueUnmapMemObject_unsupp( cl_command_queue command_queue, cl_mem memobj, void* mapped_ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)memobj; (void)mapped_ptr; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueNDRangeKernel_unsupp( cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t* global_work_offset, const size_t* global_work_size, const size_t* local_work_size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)kernel; (void)work_dim; (void)global_work_offset; (void)global_work_size; (void)local_work_size; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueNativeKernel_unsupp( cl_command_queue command_queue, void (CL_CALLBACK* user_func)(void*), void* args, size_t cb_args, cl_uint num_mem_objects, const cl_mem* mem_list, const void** args_mem_loc, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)user_func; (void)args; (void)cb_args; (void)num_mem_objects; (void)mem_list; (void)args_mem_loc; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetCommandQueueProperty_unsupp( cl_command_queue command_queue, cl_command_queue_properties properties, cl_bool enable, cl_command_queue_properties* old_properties) { (void)command_queue; (void)properties; (void)enable; (void)old_properties; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateImage2D_unsupp( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_row_pitch, void* host_ptr, cl_int* errcode_ret) { (void)context; (void)flags; (void)image_format; (void)image_width; (void)image_height; (void)image_row_pitch; (void)host_ptr; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateImage3D_unsupp( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_depth, size_t image_row_pitch, size_t image_slice_pitch, void* host_ptr, cl_int* errcode_ret) { (void)context; (void)flags; (void)image_format; (void)image_width; (void)image_height; (void)image_depth; (void)image_row_pitch; (void)image_slice_pitch; (void)host_ptr; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueMarker_unsupp( cl_command_queue command_queue, cl_event* event) { (void)command_queue; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueWaitForEvents_unsupp( cl_command_queue command_queue, cl_uint num_events, const cl_event* event_list) { (void)command_queue; (void)num_events; (void)event_list; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueBarrier_unsupp( cl_command_queue command_queue) { (void)command_queue; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clUnloadCompiler_unsupp( void ) { KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static void* CL_API_CALL clGetExtensionFunctionAddress_unsupp( const char* func_name) { (void)func_name; KHR_ICD_ERROR_RETURN_ERROR(NULL); } static cl_command_queue CL_API_CALL clCreateCommandQueue_unsupp( cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_int* errcode_ret) { (void)context; (void)device; (void)properties; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_sampler CL_API_CALL clCreateSampler_unsupp( cl_context context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int* errcode_ret) { (void)context; (void)normalized_coords; (void)addressing_mode; (void)filter_mode; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueTask_unsupp( cl_command_queue command_queue, cl_kernel kernel, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)kernel; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateSubBuffer_unsupp( cl_mem buffer, cl_mem_flags flags, cl_buffer_create_type buffer_create_type, const void* buffer_create_info, cl_int* errcode_ret) { (void)buffer; (void)flags; (void)buffer_create_type; (void)buffer_create_info; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetMemObjectDestructorCallback_unsupp( cl_mem memobj, void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data), void* user_data) { (void)memobj; (void)pfn_notify; (void)user_data; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_event CL_API_CALL clCreateUserEvent_unsupp( cl_context context, cl_int* errcode_ret) { (void)context; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetUserEventStatus_unsupp( cl_event event, cl_int execution_status) { (void)event; (void)execution_status; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetEventCallback_unsupp( cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK* pfn_notify)(cl_event event, cl_int event_command_status, void *user_data), void* user_data) { (void)event; (void)command_exec_callback_type; (void)pfn_notify; (void)user_data; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueReadBufferRect_unsupp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, const size_t* buffer_origin, const size_t* host_origin, const size_t* region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)buffer; (void)blocking_read; (void)buffer_origin; (void)host_origin; (void)region; (void)buffer_row_pitch; (void)buffer_slice_pitch; (void)host_row_pitch; (void)host_slice_pitch; (void)ptr; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueWriteBufferRect_unsupp( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, const size_t* buffer_origin, const size_t* host_origin, const size_t* region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)buffer; (void)blocking_write; (void)buffer_origin; (void)host_origin; (void)region; (void)buffer_row_pitch; (void)buffer_slice_pitch; (void)host_row_pitch; (void)host_slice_pitch; (void)ptr; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueCopyBufferRect_unsupp( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, const size_t* src_origin, const size_t* dst_origin, const size_t* region, size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch, size_t dst_slice_pitch, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)src_buffer; (void)dst_buffer; (void)src_origin; (void)dst_origin; (void)region; (void)src_row_pitch; (void)src_slice_pitch; (void)dst_row_pitch; (void)dst_slice_pitch; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clCreateSubDevices_unsupp( cl_device_id in_device, const cl_device_partition_property* properties, cl_uint num_devices, cl_device_id* out_devices, cl_uint* num_devices_ret) { (void)in_device; (void)properties; (void)num_devices; (void)out_devices; (void)num_devices_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainDevice_unsupp( cl_device_id device) { (void)device; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clReleaseDevice_unsupp( cl_device_id device) { (void)device; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateImage_unsupp( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, const cl_image_desc* image_desc, void* host_ptr, cl_int* errcode_ret) { (void)context; (void)flags; (void)image_format; (void)image_desc; (void)host_ptr; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_program CL_API_CALL clCreateProgramWithBuiltInKernels_unsupp( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const char* kernel_names, cl_int* errcode_ret) { (void)context; (void)num_devices; (void)device_list; (void)kernel_names; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clCompileProgram_unsupp( cl_program program, cl_uint num_devices, const cl_device_id* device_list, const char* options, cl_uint num_input_headers, const cl_program* input_headers, const char** header_include_names, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { (void)program; (void)num_devices; (void)device_list; (void)options; (void)num_input_headers; (void)input_headers; (void)header_include_names; (void)pfn_notify; (void)user_data; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_program CL_API_CALL clLinkProgram_unsupp( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const char* options, cl_uint num_input_programs, const cl_program* input_programs, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data, cl_int* errcode_ret) { (void)context; (void)num_devices; (void)device_list; (void)options; (void)num_input_programs; (void)input_programs; (void)pfn_notify; (void)user_data; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clUnloadPlatformCompiler_unsupp( cl_platform_id platform) { (void)platform; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetKernelArgInfo_unsupp( cl_kernel kernel, cl_uint arg_index, cl_kernel_arg_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)kernel; (void)arg_index; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueFillBuffer_unsupp( cl_command_queue command_queue, cl_mem buffer, const void* pattern, size_t pattern_size, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)buffer; (void)pattern; (void)pattern_size; (void)offset; (void)size; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueFillImage_unsupp( cl_command_queue command_queue, cl_mem image, const void* fill_color, const size_t* origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)image; (void)fill_color; (void)origin; (void)region; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueMigrateMemObjects_unsupp( cl_command_queue command_queue, cl_uint num_mem_objects, const cl_mem* mem_objects, cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_mem_objects; (void)mem_objects; (void)flags; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueMarkerWithWaitList_unsupp( cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueBarrierWithWaitList_unsupp( cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static void* CL_API_CALL clGetExtensionFunctionAddressForPlatform_unsupp( cl_platform_id platform, const char* func_name) { (void)platform; (void)func_name; KHR_ICD_ERROR_RETURN_ERROR(NULL); } static cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties_unsupp( cl_context context, cl_device_id device, const cl_queue_properties* properties, cl_int* errcode_ret) { (void)context; (void)device; (void)properties; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreatePipe_unsupp( cl_context context, cl_mem_flags flags, cl_uint pipe_packet_size, cl_uint pipe_max_packets, const cl_pipe_properties* properties, cl_int* errcode_ret) { (void)context; (void)flags; (void)pipe_packet_size; (void)pipe_max_packets; (void)properties; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetPipeInfo_unsupp( cl_mem pipe, cl_pipe_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)pipe; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static void* CL_API_CALL clSVMAlloc_unsupp( cl_context context, cl_svm_mem_flags flags, size_t size, cl_uint alignment) { (void)context; (void)flags; (void)size; (void)alignment; KHR_ICD_ERROR_RETURN_ERROR(NULL); } static void CL_API_CALL clSVMFree_unsupp( cl_context context, void* svm_pointer) { (void)context; (void)svm_pointer; return; } static cl_sampler CL_API_CALL clCreateSamplerWithProperties_unsupp( cl_context context, const cl_sampler_properties* sampler_properties, cl_int* errcode_ret) { (void)context; (void)sampler_properties; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetKernelArgSVMPointer_unsupp( cl_kernel kernel, cl_uint arg_index, const void* arg_value) { (void)kernel; (void)arg_index; (void)arg_value; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetKernelExecInfo_unsupp( cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value) { (void)kernel; (void)param_name; (void)param_value_size; (void)param_value; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueSVMFree_unsupp( cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[], void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_svm_pointers; (void)svm_pointers; (void)pfn_free_func; (void)user_data; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueSVMMemcpy_unsupp( cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)blocking_copy; (void)dst_ptr; (void)src_ptr; (void)size; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueSVMMemFill_unsupp( cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)svm_ptr; (void)pattern; (void)pattern_size; (void)size; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueSVMMap_unsupp( cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags flags, void* svm_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)blocking_map; (void)flags; (void)svm_ptr; (void)size; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueSVMUnmap_unsupp( cl_command_queue command_queue, void* svm_ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)svm_ptr; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetDefaultDeviceCommandQueue_unsupp( cl_context context, cl_device_id device, cl_command_queue command_queue) { (void)context; (void)device; (void)command_queue; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetDeviceAndHostTimer_unsupp( cl_device_id device, cl_ulong* device_timestamp, cl_ulong* host_timestamp) { (void)device; (void)device_timestamp; (void)host_timestamp; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetHostTimer_unsupp( cl_device_id device, cl_ulong* host_timestamp) { (void)device; (void)host_timestamp; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_program CL_API_CALL clCreateProgramWithIL_unsupp( cl_context context, const void* il, size_t length, cl_int* errcode_ret) { (void)context; (void)il; (void)length; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_kernel CL_API_CALL clCloneKernel_unsupp( cl_kernel source_kernel, cl_int* errcode_ret) { (void)source_kernel; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetKernelSubGroupInfo_unsupp( cl_kernel kernel, cl_device_id device, cl_kernel_sub_group_info param_name, size_t input_value_size, const void* input_value, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)kernel; (void)device; (void)param_name; (void)input_value_size; (void)input_value; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueSVMMigrateMem_unsupp( cl_command_queue command_queue, cl_uint num_svm_pointers, const void** svm_pointers, const size_t* sizes, cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_svm_pointers; (void)svm_pointers; (void)sizes; (void)flags; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetProgramSpecializationConstant_unsupp( cl_program program, cl_uint spec_id, size_t spec_size, const void* spec_value) { (void)program; (void)spec_id; (void)spec_size; (void)spec_value; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetProgramReleaseCallback_unsupp( cl_program program, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) { (void)program; (void)pfn_notify; (void)user_data; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clSetContextDestructorCallback_unsupp( cl_context context, void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data), void* user_data) { (void)context; (void)pfn_notify; (void)user_data; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateBufferWithProperties_unsupp( cl_context context, const cl_mem_properties* properties, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret) { (void)context; (void)properties; (void)flags; (void)size; (void)host_ptr; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateImageWithProperties_unsupp( cl_context context, const cl_mem_properties* properties, cl_mem_flags flags, const cl_image_format* image_format, const cl_image_desc* image_desc, void* host_ptr, cl_int* errcode_ret) { (void)context; (void)properties; (void)flags; (void)image_format; (void)image_desc; (void)host_ptr; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } /////////////////////////////////////////////////////////////////////////////// // cl_ext_device_fission static cl_int CL_API_CALL clReleaseDeviceEXT_unsupp( cl_device_id device) { (void)device; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clRetainDeviceEXT_unsupp( cl_device_id device) { (void)device; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clCreateSubDevicesEXT_unsupp( cl_device_id in_device, const cl_device_partition_property_ext* properties, cl_uint num_entries, cl_device_id* out_devices, cl_uint* num_devices) { (void)in_device; (void)properties; (void)num_entries; (void)out_devices; (void)num_devices; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_d3d10_sharing #if defined(_WIN32) static cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR_unsupp( cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source, void* d3d_object, cl_d3d10_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { (void)platform; (void)d3d_device_source; (void)d3d_object; (void)d3d_device_set; (void)num_entries; (void)devices; (void)num_devices; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromD3D10BufferKHR_unsupp( cl_context context, cl_mem_flags flags, ID3D10Buffer* resource, cl_int* errcode_ret) { (void)context; (void)flags; (void)resource; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromD3D10Texture2DKHR_unsupp( cl_context context, cl_mem_flags flags, ID3D10Texture2D* resource, UINT subresource, cl_int* errcode_ret) { (void)context; (void)flags; (void)resource; (void)subresource; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromD3D10Texture3DKHR_unsupp( cl_context context, cl_mem_flags flags, ID3D10Texture3D* resource, UINT subresource, cl_int* errcode_ret) { (void)context; (void)flags; (void)resource; (void)subresource; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueAcquireD3D10ObjectsKHR_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueReleaseD3D10ObjectsKHR_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_d3d11_sharing #if defined(_WIN32) static cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR_unsupp( cl_platform_id platform, cl_d3d11_device_source_khr d3d_device_source, void* d3d_object, cl_d3d11_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { (void)platform; (void)d3d_device_source; (void)d3d_object; (void)d3d_device_set; (void)num_entries; (void)devices; (void)num_devices; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromD3D11BufferKHR_unsupp( cl_context context, cl_mem_flags flags, ID3D11Buffer* resource, cl_int* errcode_ret) { (void)context; (void)flags; (void)resource; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromD3D11Texture2DKHR_unsupp( cl_context context, cl_mem_flags flags, ID3D11Texture2D* resource, UINT subresource, cl_int* errcode_ret) { (void)context; (void)flags; (void)resource; (void)subresource; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromD3D11Texture3DKHR_unsupp( cl_context context, cl_mem_flags flags, ID3D11Texture3D* resource, UINT subresource, cl_int* errcode_ret) { (void)context; (void)flags; (void)resource; (void)subresource; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueAcquireD3D11ObjectsKHR_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueReleaseD3D11ObjectsKHR_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_dx9_media_sharing #if defined(_WIN32) static cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR_unsupp( cl_platform_id platform, cl_uint num_media_adapters, cl_dx9_media_adapter_type_khr* media_adapter_type, void* media_adapters, cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) { (void)platform; (void)num_media_adapters; (void)media_adapter_type; (void)media_adapters; (void)media_adapter_set; (void)num_entries; (void)devices; (void)num_devices; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceKHR_unsupp( cl_context context, cl_mem_flags flags, cl_dx9_media_adapter_type_khr adapter_type, void* surface_info, cl_uint plane, cl_int* errcode_ret) { (void)context; (void)flags; (void)adapter_type; (void)surface_info; (void)plane; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueAcquireDX9MediaSurfacesKHR_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueReleaseDX9MediaSurfacesKHR_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_egl_event static cl_event CL_API_CALL clCreateEventFromEGLSyncKHR_unsupp( cl_context context, CLeglSyncKHR sync, CLeglDisplayKHR display, cl_int* errcode_ret) { (void)context; (void)sync; (void)display; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_egl_image static cl_mem CL_API_CALL clCreateFromEGLImageKHR_unsupp( cl_context context, CLeglDisplayKHR egldisplay, CLeglImageKHR eglimage, cl_mem_flags flags, const cl_egl_image_properties_khr* properties, cl_int* errcode_ret) { (void)context; (void)egldisplay; (void)eglimage; (void)flags; (void)properties; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueAcquireEGLObjectsKHR_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueReleaseEGLObjectsKHR_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_gl_event static cl_event CL_API_CALL clCreateEventFromGLsyncKHR_unsupp( cl_context context, cl_GLsync sync, cl_int* errcode_ret) { (void)context; (void)sync; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_gl_sharing static cl_int CL_API_CALL clGetGLContextInfoKHR_unsupp( const cl_context_properties* properties, cl_gl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)properties; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromGLBuffer_unsupp( cl_context context, cl_mem_flags flags, cl_GLuint bufobj, cl_int* errcode_ret) { (void)context; (void)flags; (void)bufobj; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromGLTexture_unsupp( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { (void)context; (void)flags; (void)target; (void)miplevel; (void)texture; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromGLRenderbuffer_unsupp( cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer, cl_int* errcode_ret) { (void)context; (void)flags; (void)renderbuffer; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetGLObjectInfo_unsupp( cl_mem memobj, cl_gl_object_type* gl_object_type, cl_GLuint* gl_object_name) { (void)memobj; (void)gl_object_type; (void)gl_object_name; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clGetGLTextureInfo_unsupp( cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)memobj; (void)param_name; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueAcquireGLObjects_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_int CL_API_CALL clEnqueueReleaseGLObjects_unsupp( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) { (void)command_queue; (void)num_objects; (void)mem_objects; (void)num_events_in_wait_list; (void)event_wait_list; (void)event; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromGLTexture2D_unsupp( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { (void)context; (void)flags; (void)target; (void)miplevel; (void)texture; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } static cl_mem CL_API_CALL clCreateFromGLTexture3D_unsupp( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) { (void)context; (void)flags; (void)target; (void)miplevel; (void)texture; (void)errcode_ret; KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_subgroups static cl_int CL_API_CALL clGetKernelSubGroupInfoKHR_unsupp( cl_kernel in_kernel, cl_device_id in_device, cl_kernel_sub_group_info param_name, size_t input_value_size, const void* input_value, size_t param_value_size, void* param_value, size_t* param_value_size_ret) { (void)in_kernel; (void)in_device; (void)param_name; (void)input_value_size; (void)input_value; (void)param_value_size; (void)param_value; (void)param_value_size_ret; KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); } /////////////////////////////////////////////////////////////////////////////// void khrIcd2PopulateDispatchTable( cl_platform_id platform, clIcdGetFunctionAddressForPlatformKHR_fn p_clIcdGetFunctionAddressForPlatform, struct _cl_icd_dispatch* dispatch) { /////////////////////////////////////////////////////////////////////////////// // Core APIs: dispatch->clGetPlatformIDs = (clGetPlatformIDs_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetPlatformIDs"); if (!dispatch->clGetPlatformIDs) dispatch->clGetPlatformIDs = &clGetPlatformIDs_unsupp; dispatch->clGetPlatformInfo = (clGetPlatformInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetPlatformInfo"); if (!dispatch->clGetPlatformInfo) dispatch->clGetPlatformInfo = &clGetPlatformInfo_unsupp; dispatch->clGetDeviceIDs = (clGetDeviceIDs_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetDeviceIDs"); if (!dispatch->clGetDeviceIDs) dispatch->clGetDeviceIDs = &clGetDeviceIDs_unsupp; dispatch->clGetDeviceInfo = (clGetDeviceInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetDeviceInfo"); if (!dispatch->clGetDeviceInfo) dispatch->clGetDeviceInfo = &clGetDeviceInfo_unsupp; dispatch->clCreateContext = (clCreateContext_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateContext"); if (!dispatch->clCreateContext) dispatch->clCreateContext = &clCreateContext_unsupp; dispatch->clCreateContextFromType = (clCreateContextFromType_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateContextFromType"); if (!dispatch->clCreateContextFromType) dispatch->clCreateContextFromType = &clCreateContextFromType_unsupp; dispatch->clRetainContext = (clRetainContext_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainContext"); if (!dispatch->clRetainContext) dispatch->clRetainContext = &clRetainContext_unsupp; dispatch->clReleaseContext = (clReleaseContext_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseContext"); if (!dispatch->clReleaseContext) dispatch->clReleaseContext = &clReleaseContext_unsupp; dispatch->clGetContextInfo = (clGetContextInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetContextInfo"); if (!dispatch->clGetContextInfo) dispatch->clGetContextInfo = &clGetContextInfo_unsupp; dispatch->clRetainCommandQueue = (clRetainCommandQueue_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainCommandQueue"); if (!dispatch->clRetainCommandQueue) dispatch->clRetainCommandQueue = &clRetainCommandQueue_unsupp; dispatch->clReleaseCommandQueue = (clReleaseCommandQueue_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseCommandQueue"); if (!dispatch->clReleaseCommandQueue) dispatch->clReleaseCommandQueue = &clReleaseCommandQueue_unsupp; dispatch->clGetCommandQueueInfo = (clGetCommandQueueInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetCommandQueueInfo"); if (!dispatch->clGetCommandQueueInfo) dispatch->clGetCommandQueueInfo = &clGetCommandQueueInfo_unsupp; dispatch->clCreateBuffer = (clCreateBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateBuffer"); if (!dispatch->clCreateBuffer) dispatch->clCreateBuffer = &clCreateBuffer_unsupp; dispatch->clRetainMemObject = (clRetainMemObject_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainMemObject"); if (!dispatch->clRetainMemObject) dispatch->clRetainMemObject = &clRetainMemObject_unsupp; dispatch->clReleaseMemObject = (clReleaseMemObject_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseMemObject"); if (!dispatch->clReleaseMemObject) dispatch->clReleaseMemObject = &clReleaseMemObject_unsupp; dispatch->clGetSupportedImageFormats = (clGetSupportedImageFormats_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetSupportedImageFormats"); if (!dispatch->clGetSupportedImageFormats) dispatch->clGetSupportedImageFormats = &clGetSupportedImageFormats_unsupp; dispatch->clGetMemObjectInfo = (clGetMemObjectInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetMemObjectInfo"); if (!dispatch->clGetMemObjectInfo) dispatch->clGetMemObjectInfo = &clGetMemObjectInfo_unsupp; dispatch->clGetImageInfo = (clGetImageInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetImageInfo"); if (!dispatch->clGetImageInfo) dispatch->clGetImageInfo = &clGetImageInfo_unsupp; dispatch->clRetainSampler = (clRetainSampler_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainSampler"); if (!dispatch->clRetainSampler) dispatch->clRetainSampler = &clRetainSampler_unsupp; dispatch->clReleaseSampler = (clReleaseSampler_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseSampler"); if (!dispatch->clReleaseSampler) dispatch->clReleaseSampler = &clReleaseSampler_unsupp; dispatch->clGetSamplerInfo = (clGetSamplerInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetSamplerInfo"); if (!dispatch->clGetSamplerInfo) dispatch->clGetSamplerInfo = &clGetSamplerInfo_unsupp; dispatch->clCreateProgramWithSource = (clCreateProgramWithSource_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateProgramWithSource"); if (!dispatch->clCreateProgramWithSource) dispatch->clCreateProgramWithSource = &clCreateProgramWithSource_unsupp; dispatch->clCreateProgramWithBinary = (clCreateProgramWithBinary_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateProgramWithBinary"); if (!dispatch->clCreateProgramWithBinary) dispatch->clCreateProgramWithBinary = &clCreateProgramWithBinary_unsupp; dispatch->clRetainProgram = (clRetainProgram_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainProgram"); if (!dispatch->clRetainProgram) dispatch->clRetainProgram = &clRetainProgram_unsupp; dispatch->clReleaseProgram = (clReleaseProgram_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseProgram"); if (!dispatch->clReleaseProgram) dispatch->clReleaseProgram = &clReleaseProgram_unsupp; dispatch->clBuildProgram = (clBuildProgram_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clBuildProgram"); if (!dispatch->clBuildProgram) dispatch->clBuildProgram = &clBuildProgram_unsupp; dispatch->clGetProgramInfo = (clGetProgramInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetProgramInfo"); if (!dispatch->clGetProgramInfo) dispatch->clGetProgramInfo = &clGetProgramInfo_unsupp; dispatch->clGetProgramBuildInfo = (clGetProgramBuildInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetProgramBuildInfo"); if (!dispatch->clGetProgramBuildInfo) dispatch->clGetProgramBuildInfo = &clGetProgramBuildInfo_unsupp; dispatch->clCreateKernel = (clCreateKernel_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateKernel"); if (!dispatch->clCreateKernel) dispatch->clCreateKernel = &clCreateKernel_unsupp; dispatch->clCreateKernelsInProgram = (clCreateKernelsInProgram_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateKernelsInProgram"); if (!dispatch->clCreateKernelsInProgram) dispatch->clCreateKernelsInProgram = &clCreateKernelsInProgram_unsupp; dispatch->clRetainKernel = (clRetainKernel_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainKernel"); if (!dispatch->clRetainKernel) dispatch->clRetainKernel = &clRetainKernel_unsupp; dispatch->clReleaseKernel = (clReleaseKernel_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseKernel"); if (!dispatch->clReleaseKernel) dispatch->clReleaseKernel = &clReleaseKernel_unsupp; dispatch->clSetKernelArg = (clSetKernelArg_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetKernelArg"); if (!dispatch->clSetKernelArg) dispatch->clSetKernelArg = &clSetKernelArg_unsupp; dispatch->clGetKernelInfo = (clGetKernelInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetKernelInfo"); if (!dispatch->clGetKernelInfo) dispatch->clGetKernelInfo = &clGetKernelInfo_unsupp; dispatch->clGetKernelWorkGroupInfo = (clGetKernelWorkGroupInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetKernelWorkGroupInfo"); if (!dispatch->clGetKernelWorkGroupInfo) dispatch->clGetKernelWorkGroupInfo = &clGetKernelWorkGroupInfo_unsupp; dispatch->clWaitForEvents = (clWaitForEvents_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clWaitForEvents"); if (!dispatch->clWaitForEvents) dispatch->clWaitForEvents = &clWaitForEvents_unsupp; dispatch->clGetEventInfo = (clGetEventInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetEventInfo"); if (!dispatch->clGetEventInfo) dispatch->clGetEventInfo = &clGetEventInfo_unsupp; dispatch->clRetainEvent = (clRetainEvent_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainEvent"); if (!dispatch->clRetainEvent) dispatch->clRetainEvent = &clRetainEvent_unsupp; dispatch->clReleaseEvent = (clReleaseEvent_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseEvent"); if (!dispatch->clReleaseEvent) dispatch->clReleaseEvent = &clReleaseEvent_unsupp; dispatch->clGetEventProfilingInfo = (clGetEventProfilingInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetEventProfilingInfo"); if (!dispatch->clGetEventProfilingInfo) dispatch->clGetEventProfilingInfo = &clGetEventProfilingInfo_unsupp; dispatch->clFlush = (clFlush_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clFlush"); if (!dispatch->clFlush) dispatch->clFlush = &clFlush_unsupp; dispatch->clFinish = (clFinish_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clFinish"); if (!dispatch->clFinish) dispatch->clFinish = &clFinish_unsupp; dispatch->clEnqueueReadBuffer = (clEnqueueReadBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueReadBuffer"); if (!dispatch->clEnqueueReadBuffer) dispatch->clEnqueueReadBuffer = &clEnqueueReadBuffer_unsupp; dispatch->clEnqueueWriteBuffer = (clEnqueueWriteBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueWriteBuffer"); if (!dispatch->clEnqueueWriteBuffer) dispatch->clEnqueueWriteBuffer = &clEnqueueWriteBuffer_unsupp; dispatch->clEnqueueCopyBuffer = (clEnqueueCopyBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueCopyBuffer"); if (!dispatch->clEnqueueCopyBuffer) dispatch->clEnqueueCopyBuffer = &clEnqueueCopyBuffer_unsupp; dispatch->clEnqueueReadImage = (clEnqueueReadImage_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueReadImage"); if (!dispatch->clEnqueueReadImage) dispatch->clEnqueueReadImage = &clEnqueueReadImage_unsupp; dispatch->clEnqueueWriteImage = (clEnqueueWriteImage_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueWriteImage"); if (!dispatch->clEnqueueWriteImage) dispatch->clEnqueueWriteImage = &clEnqueueWriteImage_unsupp; dispatch->clEnqueueCopyImage = (clEnqueueCopyImage_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueCopyImage"); if (!dispatch->clEnqueueCopyImage) dispatch->clEnqueueCopyImage = &clEnqueueCopyImage_unsupp; dispatch->clEnqueueCopyImageToBuffer = (clEnqueueCopyImageToBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueCopyImageToBuffer"); if (!dispatch->clEnqueueCopyImageToBuffer) dispatch->clEnqueueCopyImageToBuffer = &clEnqueueCopyImageToBuffer_unsupp; dispatch->clEnqueueCopyBufferToImage = (clEnqueueCopyBufferToImage_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueCopyBufferToImage"); if (!dispatch->clEnqueueCopyBufferToImage) dispatch->clEnqueueCopyBufferToImage = &clEnqueueCopyBufferToImage_unsupp; dispatch->clEnqueueMapBuffer = (clEnqueueMapBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueMapBuffer"); if (!dispatch->clEnqueueMapBuffer) dispatch->clEnqueueMapBuffer = &clEnqueueMapBuffer_unsupp; dispatch->clEnqueueMapImage = (clEnqueueMapImage_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueMapImage"); if (!dispatch->clEnqueueMapImage) dispatch->clEnqueueMapImage = &clEnqueueMapImage_unsupp; dispatch->clEnqueueUnmapMemObject = (clEnqueueUnmapMemObject_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueUnmapMemObject"); if (!dispatch->clEnqueueUnmapMemObject) dispatch->clEnqueueUnmapMemObject = &clEnqueueUnmapMemObject_unsupp; dispatch->clEnqueueNDRangeKernel = (clEnqueueNDRangeKernel_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueNDRangeKernel"); if (!dispatch->clEnqueueNDRangeKernel) dispatch->clEnqueueNDRangeKernel = &clEnqueueNDRangeKernel_unsupp; dispatch->clEnqueueNativeKernel = (clEnqueueNativeKernel_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueNativeKernel"); if (!dispatch->clEnqueueNativeKernel) dispatch->clEnqueueNativeKernel = &clEnqueueNativeKernel_unsupp; dispatch->clSetCommandQueueProperty = (clSetCommandQueueProperty_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetCommandQueueProperty"); if (!dispatch->clSetCommandQueueProperty) dispatch->clSetCommandQueueProperty = &clSetCommandQueueProperty_unsupp; dispatch->clCreateImage2D = (clCreateImage2D_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateImage2D"); if (!dispatch->clCreateImage2D) dispatch->clCreateImage2D = &clCreateImage2D_unsupp; dispatch->clCreateImage3D = (clCreateImage3D_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateImage3D"); if (!dispatch->clCreateImage3D) dispatch->clCreateImage3D = &clCreateImage3D_unsupp; dispatch->clEnqueueMarker = (clEnqueueMarker_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueMarker"); if (!dispatch->clEnqueueMarker) dispatch->clEnqueueMarker = &clEnqueueMarker_unsupp; dispatch->clEnqueueWaitForEvents = (clEnqueueWaitForEvents_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueWaitForEvents"); if (!dispatch->clEnqueueWaitForEvents) dispatch->clEnqueueWaitForEvents = &clEnqueueWaitForEvents_unsupp; dispatch->clEnqueueBarrier = (clEnqueueBarrier_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueBarrier"); if (!dispatch->clEnqueueBarrier) dispatch->clEnqueueBarrier = &clEnqueueBarrier_unsupp; dispatch->clUnloadCompiler = (clUnloadCompiler_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clUnloadCompiler"); if (!dispatch->clUnloadCompiler) dispatch->clUnloadCompiler = &clUnloadCompiler_unsupp; dispatch->clGetExtensionFunctionAddress = (clGetExtensionFunctionAddress_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetExtensionFunctionAddress"); if (!dispatch->clGetExtensionFunctionAddress) dispatch->clGetExtensionFunctionAddress = &clGetExtensionFunctionAddress_unsupp; dispatch->clCreateCommandQueue = (clCreateCommandQueue_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateCommandQueue"); if (!dispatch->clCreateCommandQueue) dispatch->clCreateCommandQueue = &clCreateCommandQueue_unsupp; dispatch->clCreateSampler = (clCreateSampler_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateSampler"); if (!dispatch->clCreateSampler) dispatch->clCreateSampler = &clCreateSampler_unsupp; dispatch->clEnqueueTask = (clEnqueueTask_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueTask"); if (!dispatch->clEnqueueTask) dispatch->clEnqueueTask = &clEnqueueTask_unsupp; dispatch->clCreateSubBuffer = (clCreateSubBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateSubBuffer"); if (!dispatch->clCreateSubBuffer) dispatch->clCreateSubBuffer = &clCreateSubBuffer_unsupp; dispatch->clSetMemObjectDestructorCallback = (clSetMemObjectDestructorCallback_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetMemObjectDestructorCallback"); if (!dispatch->clSetMemObjectDestructorCallback) dispatch->clSetMemObjectDestructorCallback = &clSetMemObjectDestructorCallback_unsupp; dispatch->clCreateUserEvent = (clCreateUserEvent_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateUserEvent"); if (!dispatch->clCreateUserEvent) dispatch->clCreateUserEvent = &clCreateUserEvent_unsupp; dispatch->clSetUserEventStatus = (clSetUserEventStatus_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetUserEventStatus"); if (!dispatch->clSetUserEventStatus) dispatch->clSetUserEventStatus = &clSetUserEventStatus_unsupp; dispatch->clSetEventCallback = (clSetEventCallback_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetEventCallback"); if (!dispatch->clSetEventCallback) dispatch->clSetEventCallback = &clSetEventCallback_unsupp; dispatch->clEnqueueReadBufferRect = (clEnqueueReadBufferRect_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueReadBufferRect"); if (!dispatch->clEnqueueReadBufferRect) dispatch->clEnqueueReadBufferRect = &clEnqueueReadBufferRect_unsupp; dispatch->clEnqueueWriteBufferRect = (clEnqueueWriteBufferRect_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueWriteBufferRect"); if (!dispatch->clEnqueueWriteBufferRect) dispatch->clEnqueueWriteBufferRect = &clEnqueueWriteBufferRect_unsupp; dispatch->clEnqueueCopyBufferRect = (clEnqueueCopyBufferRect_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueCopyBufferRect"); if (!dispatch->clEnqueueCopyBufferRect) dispatch->clEnqueueCopyBufferRect = &clEnqueueCopyBufferRect_unsupp; dispatch->clCreateSubDevices = (clCreateSubDevices_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateSubDevices"); if (!dispatch->clCreateSubDevices) dispatch->clCreateSubDevices = &clCreateSubDevices_unsupp; dispatch->clRetainDevice = (clRetainDevice_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainDevice"); if (!dispatch->clRetainDevice) dispatch->clRetainDevice = &clRetainDevice_unsupp; dispatch->clReleaseDevice = (clReleaseDevice_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseDevice"); if (!dispatch->clReleaseDevice) dispatch->clReleaseDevice = &clReleaseDevice_unsupp; dispatch->clCreateImage = (clCreateImage_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateImage"); if (!dispatch->clCreateImage) dispatch->clCreateImage = &clCreateImage_unsupp; dispatch->clCreateProgramWithBuiltInKernels = (clCreateProgramWithBuiltInKernels_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateProgramWithBuiltInKernels"); if (!dispatch->clCreateProgramWithBuiltInKernels) dispatch->clCreateProgramWithBuiltInKernels = &clCreateProgramWithBuiltInKernels_unsupp; dispatch->clCompileProgram = (clCompileProgram_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCompileProgram"); if (!dispatch->clCompileProgram) dispatch->clCompileProgram = &clCompileProgram_unsupp; dispatch->clLinkProgram = (clLinkProgram_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clLinkProgram"); if (!dispatch->clLinkProgram) dispatch->clLinkProgram = &clLinkProgram_unsupp; dispatch->clUnloadPlatformCompiler = (clUnloadPlatformCompiler_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clUnloadPlatformCompiler"); if (!dispatch->clUnloadPlatformCompiler) dispatch->clUnloadPlatformCompiler = &clUnloadPlatformCompiler_unsupp; dispatch->clGetKernelArgInfo = (clGetKernelArgInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetKernelArgInfo"); if (!dispatch->clGetKernelArgInfo) dispatch->clGetKernelArgInfo = &clGetKernelArgInfo_unsupp; dispatch->clEnqueueFillBuffer = (clEnqueueFillBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueFillBuffer"); if (!dispatch->clEnqueueFillBuffer) dispatch->clEnqueueFillBuffer = &clEnqueueFillBuffer_unsupp; dispatch->clEnqueueFillImage = (clEnqueueFillImage_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueFillImage"); if (!dispatch->clEnqueueFillImage) dispatch->clEnqueueFillImage = &clEnqueueFillImage_unsupp; dispatch->clEnqueueMigrateMemObjects = (clEnqueueMigrateMemObjects_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueMigrateMemObjects"); if (!dispatch->clEnqueueMigrateMemObjects) dispatch->clEnqueueMigrateMemObjects = &clEnqueueMigrateMemObjects_unsupp; dispatch->clEnqueueMarkerWithWaitList = (clEnqueueMarkerWithWaitList_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueMarkerWithWaitList"); if (!dispatch->clEnqueueMarkerWithWaitList) dispatch->clEnqueueMarkerWithWaitList = &clEnqueueMarkerWithWaitList_unsupp; dispatch->clEnqueueBarrierWithWaitList = (clEnqueueBarrierWithWaitList_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueBarrierWithWaitList"); if (!dispatch->clEnqueueBarrierWithWaitList) dispatch->clEnqueueBarrierWithWaitList = &clEnqueueBarrierWithWaitList_unsupp; dispatch->clGetExtensionFunctionAddressForPlatform = (clGetExtensionFunctionAddressForPlatform_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetExtensionFunctionAddressForPlatform"); if (!dispatch->clGetExtensionFunctionAddressForPlatform) dispatch->clGetExtensionFunctionAddressForPlatform = &clGetExtensionFunctionAddressForPlatform_unsupp; dispatch->clCreateCommandQueueWithProperties = (clCreateCommandQueueWithProperties_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateCommandQueueWithProperties"); if (!dispatch->clCreateCommandQueueWithProperties) dispatch->clCreateCommandQueueWithProperties = &clCreateCommandQueueWithProperties_unsupp; dispatch->clCreatePipe = (clCreatePipe_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreatePipe"); if (!dispatch->clCreatePipe) dispatch->clCreatePipe = &clCreatePipe_unsupp; dispatch->clGetPipeInfo = (clGetPipeInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetPipeInfo"); if (!dispatch->clGetPipeInfo) dispatch->clGetPipeInfo = &clGetPipeInfo_unsupp; dispatch->clSVMAlloc = (clSVMAlloc_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSVMAlloc"); if (!dispatch->clSVMAlloc) dispatch->clSVMAlloc = &clSVMAlloc_unsupp; dispatch->clSVMFree = (clSVMFree_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSVMFree"); if (!dispatch->clSVMFree) dispatch->clSVMFree = &clSVMFree_unsupp; dispatch->clCreateSamplerWithProperties = (clCreateSamplerWithProperties_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateSamplerWithProperties"); if (!dispatch->clCreateSamplerWithProperties) dispatch->clCreateSamplerWithProperties = &clCreateSamplerWithProperties_unsupp; dispatch->clSetKernelArgSVMPointer = (clSetKernelArgSVMPointer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetKernelArgSVMPointer"); if (!dispatch->clSetKernelArgSVMPointer) dispatch->clSetKernelArgSVMPointer = &clSetKernelArgSVMPointer_unsupp; dispatch->clSetKernelExecInfo = (clSetKernelExecInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetKernelExecInfo"); if (!dispatch->clSetKernelExecInfo) dispatch->clSetKernelExecInfo = &clSetKernelExecInfo_unsupp; dispatch->clEnqueueSVMFree = (clEnqueueSVMFree_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueSVMFree"); if (!dispatch->clEnqueueSVMFree) dispatch->clEnqueueSVMFree = &clEnqueueSVMFree_unsupp; dispatch->clEnqueueSVMMemcpy = (clEnqueueSVMMemcpy_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueSVMMemcpy"); if (!dispatch->clEnqueueSVMMemcpy) dispatch->clEnqueueSVMMemcpy = &clEnqueueSVMMemcpy_unsupp; dispatch->clEnqueueSVMMemFill = (clEnqueueSVMMemFill_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueSVMMemFill"); if (!dispatch->clEnqueueSVMMemFill) dispatch->clEnqueueSVMMemFill = &clEnqueueSVMMemFill_unsupp; dispatch->clEnqueueSVMMap = (clEnqueueSVMMap_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueSVMMap"); if (!dispatch->clEnqueueSVMMap) dispatch->clEnqueueSVMMap = &clEnqueueSVMMap_unsupp; dispatch->clEnqueueSVMUnmap = (clEnqueueSVMUnmap_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueSVMUnmap"); if (!dispatch->clEnqueueSVMUnmap) dispatch->clEnqueueSVMUnmap = &clEnqueueSVMUnmap_unsupp; dispatch->clSetDefaultDeviceCommandQueue = (clSetDefaultDeviceCommandQueue_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetDefaultDeviceCommandQueue"); if (!dispatch->clSetDefaultDeviceCommandQueue) dispatch->clSetDefaultDeviceCommandQueue = &clSetDefaultDeviceCommandQueue_unsupp; dispatch->clGetDeviceAndHostTimer = (clGetDeviceAndHostTimer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetDeviceAndHostTimer"); if (!dispatch->clGetDeviceAndHostTimer) dispatch->clGetDeviceAndHostTimer = &clGetDeviceAndHostTimer_unsupp; dispatch->clGetHostTimer = (clGetHostTimer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetHostTimer"); if (!dispatch->clGetHostTimer) dispatch->clGetHostTimer = &clGetHostTimer_unsupp; dispatch->clCreateProgramWithIL = (clCreateProgramWithIL_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateProgramWithIL"); if (!dispatch->clCreateProgramWithIL) dispatch->clCreateProgramWithIL = &clCreateProgramWithIL_unsupp; dispatch->clCloneKernel = (clCloneKernel_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCloneKernel"); if (!dispatch->clCloneKernel) dispatch->clCloneKernel = &clCloneKernel_unsupp; dispatch->clGetKernelSubGroupInfo = (clGetKernelSubGroupInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetKernelSubGroupInfo"); if (!dispatch->clGetKernelSubGroupInfo) dispatch->clGetKernelSubGroupInfo = &clGetKernelSubGroupInfo_unsupp; dispatch->clEnqueueSVMMigrateMem = (clEnqueueSVMMigrateMem_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueSVMMigrateMem"); if (!dispatch->clEnqueueSVMMigrateMem) dispatch->clEnqueueSVMMigrateMem = &clEnqueueSVMMigrateMem_unsupp; dispatch->clSetProgramSpecializationConstant = (clSetProgramSpecializationConstant_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetProgramSpecializationConstant"); if (!dispatch->clSetProgramSpecializationConstant) dispatch->clSetProgramSpecializationConstant = &clSetProgramSpecializationConstant_unsupp; dispatch->clSetProgramReleaseCallback = (clSetProgramReleaseCallback_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetProgramReleaseCallback"); if (!dispatch->clSetProgramReleaseCallback) dispatch->clSetProgramReleaseCallback = &clSetProgramReleaseCallback_unsupp; dispatch->clSetContextDestructorCallback = (clSetContextDestructorCallback_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clSetContextDestructorCallback"); if (!dispatch->clSetContextDestructorCallback) dispatch->clSetContextDestructorCallback = &clSetContextDestructorCallback_unsupp; dispatch->clCreateBufferWithProperties = (clCreateBufferWithProperties_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateBufferWithProperties"); if (!dispatch->clCreateBufferWithProperties) dispatch->clCreateBufferWithProperties = &clCreateBufferWithProperties_unsupp; dispatch->clCreateImageWithProperties = (clCreateImageWithProperties_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateImageWithProperties"); if (!dispatch->clCreateImageWithProperties) dispatch->clCreateImageWithProperties = &clCreateImageWithProperties_unsupp; /////////////////////////////////////////////////////////////////////////////// // cl_ext_device_fission dispatch->clReleaseDeviceEXT = (clReleaseDeviceEXT_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clReleaseDeviceEXT"); if (!dispatch->clReleaseDeviceEXT) dispatch->clReleaseDeviceEXT = &clReleaseDeviceEXT_unsupp; dispatch->clRetainDeviceEXT = (clRetainDeviceEXT_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clRetainDeviceEXT"); if (!dispatch->clRetainDeviceEXT) dispatch->clRetainDeviceEXT = &clRetainDeviceEXT_unsupp; dispatch->clCreateSubDevicesEXT = (clCreateSubDevicesEXT_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateSubDevicesEXT"); if (!dispatch->clCreateSubDevicesEXT) dispatch->clCreateSubDevicesEXT = &clCreateSubDevicesEXT_unsupp; /////////////////////////////////////////////////////////////////////////////// // cl_khr_d3d10_sharing #if defined(_WIN32) dispatch->clGetDeviceIDsFromD3D10KHR = (clGetDeviceIDsFromD3D10KHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetDeviceIDsFromD3D10KHR"); if (!dispatch->clGetDeviceIDsFromD3D10KHR) dispatch->clGetDeviceIDsFromD3D10KHR = &clGetDeviceIDsFromD3D10KHR_unsupp; dispatch->clCreateFromD3D10BufferKHR = (clCreateFromD3D10BufferKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromD3D10BufferKHR"); if (!dispatch->clCreateFromD3D10BufferKHR) dispatch->clCreateFromD3D10BufferKHR = &clCreateFromD3D10BufferKHR_unsupp; dispatch->clCreateFromD3D10Texture2DKHR = (clCreateFromD3D10Texture2DKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromD3D10Texture2DKHR"); if (!dispatch->clCreateFromD3D10Texture2DKHR) dispatch->clCreateFromD3D10Texture2DKHR = &clCreateFromD3D10Texture2DKHR_unsupp; dispatch->clCreateFromD3D10Texture3DKHR = (clCreateFromD3D10Texture3DKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromD3D10Texture3DKHR"); if (!dispatch->clCreateFromD3D10Texture3DKHR) dispatch->clCreateFromD3D10Texture3DKHR = &clCreateFromD3D10Texture3DKHR_unsupp; dispatch->clEnqueueAcquireD3D10ObjectsKHR = (clEnqueueAcquireD3D10ObjectsKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueAcquireD3D10ObjectsKHR"); if (!dispatch->clEnqueueAcquireD3D10ObjectsKHR) dispatch->clEnqueueAcquireD3D10ObjectsKHR = &clEnqueueAcquireD3D10ObjectsKHR_unsupp; dispatch->clEnqueueReleaseD3D10ObjectsKHR = (clEnqueueReleaseD3D10ObjectsKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueReleaseD3D10ObjectsKHR"); if (!dispatch->clEnqueueReleaseD3D10ObjectsKHR) dispatch->clEnqueueReleaseD3D10ObjectsKHR = &clEnqueueReleaseD3D10ObjectsKHR_unsupp; #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_d3d11_sharing #if defined(_WIN32) dispatch->clGetDeviceIDsFromD3D11KHR = (clGetDeviceIDsFromD3D11KHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetDeviceIDsFromD3D11KHR"); if (!dispatch->clGetDeviceIDsFromD3D11KHR) dispatch->clGetDeviceIDsFromD3D11KHR = &clGetDeviceIDsFromD3D11KHR_unsupp; dispatch->clCreateFromD3D11BufferKHR = (clCreateFromD3D11BufferKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromD3D11BufferKHR"); if (!dispatch->clCreateFromD3D11BufferKHR) dispatch->clCreateFromD3D11BufferKHR = &clCreateFromD3D11BufferKHR_unsupp; dispatch->clCreateFromD3D11Texture2DKHR = (clCreateFromD3D11Texture2DKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromD3D11Texture2DKHR"); if (!dispatch->clCreateFromD3D11Texture2DKHR) dispatch->clCreateFromD3D11Texture2DKHR = &clCreateFromD3D11Texture2DKHR_unsupp; dispatch->clCreateFromD3D11Texture3DKHR = (clCreateFromD3D11Texture3DKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromD3D11Texture3DKHR"); if (!dispatch->clCreateFromD3D11Texture3DKHR) dispatch->clCreateFromD3D11Texture3DKHR = &clCreateFromD3D11Texture3DKHR_unsupp; dispatch->clEnqueueAcquireD3D11ObjectsKHR = (clEnqueueAcquireD3D11ObjectsKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueAcquireD3D11ObjectsKHR"); if (!dispatch->clEnqueueAcquireD3D11ObjectsKHR) dispatch->clEnqueueAcquireD3D11ObjectsKHR = &clEnqueueAcquireD3D11ObjectsKHR_unsupp; dispatch->clEnqueueReleaseD3D11ObjectsKHR = (clEnqueueReleaseD3D11ObjectsKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueReleaseD3D11ObjectsKHR"); if (!dispatch->clEnqueueReleaseD3D11ObjectsKHR) dispatch->clEnqueueReleaseD3D11ObjectsKHR = &clEnqueueReleaseD3D11ObjectsKHR_unsupp; #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_dx9_media_sharing #if defined(_WIN32) dispatch->clGetDeviceIDsFromDX9MediaAdapterKHR = (clGetDeviceIDsFromDX9MediaAdapterKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetDeviceIDsFromDX9MediaAdapterKHR"); if (!dispatch->clGetDeviceIDsFromDX9MediaAdapterKHR) dispatch->clGetDeviceIDsFromDX9MediaAdapterKHR = &clGetDeviceIDsFromDX9MediaAdapterKHR_unsupp; dispatch->clCreateFromDX9MediaSurfaceKHR = (clCreateFromDX9MediaSurfaceKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromDX9MediaSurfaceKHR"); if (!dispatch->clCreateFromDX9MediaSurfaceKHR) dispatch->clCreateFromDX9MediaSurfaceKHR = &clCreateFromDX9MediaSurfaceKHR_unsupp; dispatch->clEnqueueAcquireDX9MediaSurfacesKHR = (clEnqueueAcquireDX9MediaSurfacesKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueAcquireDX9MediaSurfacesKHR"); if (!dispatch->clEnqueueAcquireDX9MediaSurfacesKHR) dispatch->clEnqueueAcquireDX9MediaSurfacesKHR = &clEnqueueAcquireDX9MediaSurfacesKHR_unsupp; dispatch->clEnqueueReleaseDX9MediaSurfacesKHR = (clEnqueueReleaseDX9MediaSurfacesKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueReleaseDX9MediaSurfacesKHR"); if (!dispatch->clEnqueueReleaseDX9MediaSurfacesKHR) dispatch->clEnqueueReleaseDX9MediaSurfacesKHR = &clEnqueueReleaseDX9MediaSurfacesKHR_unsupp; #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_egl_event dispatch->clCreateEventFromEGLSyncKHR = (clCreateEventFromEGLSyncKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateEventFromEGLSyncKHR"); if (!dispatch->clCreateEventFromEGLSyncKHR) dispatch->clCreateEventFromEGLSyncKHR = &clCreateEventFromEGLSyncKHR_unsupp; /////////////////////////////////////////////////////////////////////////////// // cl_khr_egl_image dispatch->clCreateFromEGLImageKHR = (clCreateFromEGLImageKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromEGLImageKHR"); if (!dispatch->clCreateFromEGLImageKHR) dispatch->clCreateFromEGLImageKHR = &clCreateFromEGLImageKHR_unsupp; dispatch->clEnqueueAcquireEGLObjectsKHR = (clEnqueueAcquireEGLObjectsKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueAcquireEGLObjectsKHR"); if (!dispatch->clEnqueueAcquireEGLObjectsKHR) dispatch->clEnqueueAcquireEGLObjectsKHR = &clEnqueueAcquireEGLObjectsKHR_unsupp; dispatch->clEnqueueReleaseEGLObjectsKHR = (clEnqueueReleaseEGLObjectsKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueReleaseEGLObjectsKHR"); if (!dispatch->clEnqueueReleaseEGLObjectsKHR) dispatch->clEnqueueReleaseEGLObjectsKHR = &clEnqueueReleaseEGLObjectsKHR_unsupp; /////////////////////////////////////////////////////////////////////////////// // cl_khr_gl_event dispatch->clCreateEventFromGLsyncKHR = (clCreateEventFromGLsyncKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateEventFromGLsyncKHR"); if (!dispatch->clCreateEventFromGLsyncKHR) dispatch->clCreateEventFromGLsyncKHR = &clCreateEventFromGLsyncKHR_unsupp; /////////////////////////////////////////////////////////////////////////////// // cl_khr_gl_sharing dispatch->clGetGLContextInfoKHR = (clGetGLContextInfoKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetGLContextInfoKHR"); if (!dispatch->clGetGLContextInfoKHR) dispatch->clGetGLContextInfoKHR = &clGetGLContextInfoKHR_unsupp; dispatch->clCreateFromGLBuffer = (clCreateFromGLBuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromGLBuffer"); if (!dispatch->clCreateFromGLBuffer) dispatch->clCreateFromGLBuffer = &clCreateFromGLBuffer_unsupp; dispatch->clCreateFromGLTexture = (clCreateFromGLTexture_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromGLTexture"); if (!dispatch->clCreateFromGLTexture) dispatch->clCreateFromGLTexture = &clCreateFromGLTexture_unsupp; dispatch->clCreateFromGLRenderbuffer = (clCreateFromGLRenderbuffer_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromGLRenderbuffer"); if (!dispatch->clCreateFromGLRenderbuffer) dispatch->clCreateFromGLRenderbuffer = &clCreateFromGLRenderbuffer_unsupp; dispatch->clGetGLObjectInfo = (clGetGLObjectInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetGLObjectInfo"); if (!dispatch->clGetGLObjectInfo) dispatch->clGetGLObjectInfo = &clGetGLObjectInfo_unsupp; dispatch->clGetGLTextureInfo = (clGetGLTextureInfo_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetGLTextureInfo"); if (!dispatch->clGetGLTextureInfo) dispatch->clGetGLTextureInfo = &clGetGLTextureInfo_unsupp; dispatch->clEnqueueAcquireGLObjects = (clEnqueueAcquireGLObjects_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueAcquireGLObjects"); if (!dispatch->clEnqueueAcquireGLObjects) dispatch->clEnqueueAcquireGLObjects = &clEnqueueAcquireGLObjects_unsupp; dispatch->clEnqueueReleaseGLObjects = (clEnqueueReleaseGLObjects_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clEnqueueReleaseGLObjects"); if (!dispatch->clEnqueueReleaseGLObjects) dispatch->clEnqueueReleaseGLObjects = &clEnqueueReleaseGLObjects_unsupp; dispatch->clCreateFromGLTexture2D = (clCreateFromGLTexture2D_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromGLTexture2D"); if (!dispatch->clCreateFromGLTexture2D) dispatch->clCreateFromGLTexture2D = &clCreateFromGLTexture2D_unsupp; dispatch->clCreateFromGLTexture3D = (clCreateFromGLTexture3D_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clCreateFromGLTexture3D"); if (!dispatch->clCreateFromGLTexture3D) dispatch->clCreateFromGLTexture3D = &clCreateFromGLTexture3D_unsupp; /////////////////////////////////////////////////////////////////////////////// // cl_khr_subgroups dispatch->clGetKernelSubGroupInfoKHR = (clGetKernelSubGroupInfoKHR_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "clGetKernelSubGroupInfoKHR"); if (!dispatch->clGetKernelSubGroupInfoKHR) dispatch->clGetKernelSubGroupInfoKHR = &clGetKernelSubGroupInfoKHR_unsupp; /////////////////////////////////////////////////////////////////////////////// } #endif // defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) #ifdef __cplusplus } #endif OpenCL-ICD-Loader-2025.07.22/loader/icd_envvars.h000066400000000000000000000015431503776305700207760ustar00rootroot00000000000000/* * Copyright (c) 2016-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #ifndef _ICD_ENVVARS_H_ #define _ICD_ENVVARS_H_ char *khrIcd_getenv(const char *name); char *khrIcd_secure_getenv(const char *name); void khrIcd_free_getenv(char *val); #endif OpenCL-ICD-Loader-2025.07.22/loader/icd_platform.h000066400000000000000000000026061503776305700211370ustar00rootroot00000000000000/* * Copyright (c) 2016-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #ifndef _ICD_PLATFORM_H_ #define _ICD_PLATFORM_H_ #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__QNXNTO__) #define PATH_SEPARATOR ':' #define DIRECTORY_SYMBOL '/' #ifdef __ANDROID__ #define ICD_VENDOR_PATH "/system/vendor/Khronos/OpenCL/vendors" #define LAYER_PATH "/system/vendor/Khronos/OpenCL/layers" #else #define ICD_VENDOR_PATH "/etc/OpenCL/vendors" #define LAYER_PATH "/etc/OpenCL/layers" #endif // ANDROID #elif defined(_WIN32) #define PATH_SEPARATOR ';' #define DIRECTORY_SYMBOL '\\' #else #error Unknown OS! #endif #ifdef __MINGW32__ #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600) #undef _WIN32_WINNT #define _WIN32_WINNT 0x0600 #endif #endif // __MINGW32__ #endif OpenCL-ICD-Loader-2025.07.22/loader/icd_version.h000066400000000000000000000036711503776305700210030ustar00rootroot00000000000000/* * Copyright (c) 2016-2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #ifndef _ICD_VERSION_H_ #define _ICD_VERSION_H_ #define OPENCL_ICD_LOADER_NAME_STRING "Khronos OpenCL ICD Loader" #define OPENCL_ICD_LOADER_VENDOR_STRING "Khronos Group" #define OPENCL_ICD_LOADER_VAL(_v) #_v #define OPENCL_ICD_LOADER_TOSTRING(_d) OPENCL_ICD_LOADER_VAL(_d) #define OPENCL_ICD_LOADER_VERSION_STRING \ OPENCL_ICD_LOADER_TOSTRING(OPENCL_ICD_LOADER_VERSION_MAJOR) "." \ OPENCL_ICD_LOADER_TOSTRING(OPENCL_ICD_LOADER_VERSION_MINOR) "." \ OPENCL_ICD_LOADER_TOSTRING(OPENCL_ICD_LOADER_VERSION_REV) #if CL_TARGET_OPENCL_VERSION == 100 #define OPENCL_ICD_LOADER_OCL_VERSION_NUMBER "1.0" #endif #if CL_TARGET_OPENCL_VERSION == 110 #define OPENCL_ICD_LOADER_OCL_VERSION_NUMBER "1.1" #endif #if CL_TARGET_OPENCL_VERSION == 120 #define OPENCL_ICD_LOADER_OCL_VERSION_NUMBER "1.2" #endif #if CL_TARGET_OPENCL_VERSION == 200 #define OPENCL_ICD_LOADER_OCL_VERSION_NUMBER "2.0" #endif #if CL_TARGET_OPENCL_VERSION == 210 #define OPENCL_ICD_LOADER_OCL_VERSION_NUMBER "2.1" #endif #if CL_TARGET_OPENCL_VERSION == 220 #define OPENCL_ICD_LOADER_OCL_VERSION_NUMBER "2.2" #endif #if CL_TARGET_OPENCL_VERSION == 300 #define OPENCL_ICD_LOADER_OCL_VERSION_NUMBER "3.0" #endif #define OPENCL_ICD_LOADER_OCL_VERSION_STRING \ "OpenCL " OPENCL_ICD_LOADER_OCL_VERSION_NUMBER #endif OpenCL-ICD-Loader-2025.07.22/loader/linux/000077500000000000000000000000001503776305700174565ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/loader/linux/icd_exports.map000066400000000000000000000110561503776305700225030ustar00rootroot00000000000000/* * Copyright (c) 2016-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ OPENCL_1.0 { global: clBuildProgram; clCreateBuffer; clCreateCommandQueue; clCreateContext; clCreateContextFromType; clCreateFromGLBuffer; clCreateFromGLRenderbuffer; clCreateFromGLTexture2D; clCreateFromGLTexture3D; clCreateImage2D; clCreateImage3D; clCreateKernel; clCreateKernelsInProgram; clCreateProgramWithBinary; clCreateProgramWithSource; clCreateSampler; clEnqueueAcquireGLObjects; clEnqueueBarrier; clEnqueueCopyBuffer; clEnqueueCopyBufferToImage; clEnqueueCopyImage; clEnqueueCopyImageToBuffer; clEnqueueMapBuffer; clEnqueueMapImage; clEnqueueMarker; clEnqueueNDRangeKernel; clEnqueueNativeKernel; clEnqueueReadBuffer; clEnqueueReadImage; clEnqueueReleaseGLObjects; clEnqueueTask; clEnqueueUnmapMemObject; clEnqueueWaitForEvents; clEnqueueWriteBuffer; clEnqueueWriteImage; clFinish; clFlush; clGetCommandQueueInfo; clGetContextInfo; clGetDeviceIDs; clGetDeviceInfo; clGetEventInfo; clGetEventProfilingInfo; clGetExtensionFunctionAddress; clGetGLObjectInfo; clGetGLTextureInfo; clGetImageInfo; clGetKernelInfo; clGetKernelWorkGroupInfo; clGetMemObjectInfo; clGetPlatformIDs; clGetPlatformInfo; clGetProgramBuildInfo; clGetProgramInfo; clGetSamplerInfo; clGetSupportedImageFormats; clReleaseCommandQueue; clReleaseContext; clReleaseEvent; clReleaseKernel; clReleaseMemObject; clReleaseProgram; clReleaseSampler; clRetainCommandQueue; clRetainContext; clRetainEvent; clRetainKernel; clRetainMemObject; clRetainProgram; clRetainSampler; clSetCommandQueueProperty; clSetKernelArg; clUnloadCompiler; clWaitForEvents; local: /* Everything else is local to ICD. */ *; }; OPENCL_1.1 { global: clCreateSubBuffer; clCreateUserEvent; clEnqueueCopyBufferRect; clEnqueueReadBufferRect; clEnqueueWriteBufferRect; clSetEventCallback; clSetMemObjectDestructorCallback; clSetUserEventStatus; } OPENCL_1.0; OPENCL_1.2 { global: clCompileProgram; clCreateFromGLTexture; clCreateImage; clCreateProgramWithBuiltInKernels; clCreateSubDevices; clEnqueueBarrierWithWaitList; clEnqueueFillBuffer; clEnqueueFillImage; clEnqueueMarkerWithWaitList; clEnqueueMigrateMemObjects; clGetExtensionFunctionAddressForPlatform; clGetKernelArgInfo; clLinkProgram; clReleaseDevice; clRetainDevice; clUnloadPlatformCompiler; } OPENCL_1.1; OPENCL_2.0 { global: clCreateCommandQueueWithProperties; clCreatePipe; clGetPipeInfo; clSVMAlloc; clSVMFree; clEnqueueSVMFree; clEnqueueSVMMemcpy; clEnqueueSVMMemFill; clEnqueueSVMMap; clEnqueueSVMUnmap; clCreateSamplerWithProperties; clSetKernelArgSVMPointer; clSetKernelExecInfo; } OPENCL_1.2; OPENCL_2.1 { global: clCloneKernel; clCreateProgramWithIL; clEnqueueSVMMigrateMem; clGetDeviceAndHostTimer; clGetHostTimer; clGetKernelSubGroupInfo; clSetDefaultDeviceCommandQueue; } OPENCL_2.0; OPENCL_2.2 { global: clSetProgramReleaseCallback; clSetProgramSpecializationConstant; } OPENCL_2.1; OPENCL_3.0 { global: clCreateBufferWithProperties; clCreateImageWithProperties; clSetContextDestructorCallback; } OPENCL_2.2; OpenCL-ICD-Loader-2025.07.22/loader/linux/icd_linux.c000066400000000000000000000171741503776305700216120ustar00rootroot00000000000000/* * Copyright (c) 2016-2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd.h" #include "icd_envvars.h" #include #include #include #include #include #include #include #include #include static pthread_once_t initialized = PTHREAD_ONCE_INIT; /* * * Vendor enumeration functions * */ typedef void khrIcdFileAdd(const char *); static inline void khrIcdOsDirEntryValidateAndAdd(const char *d_name, const char *path, const char *extension, khrIcdFileAdd addFunc) { struct stat statBuff; char* fileName = NULL; // make sure the file name ends in `extension` (eg. .icd, or .lay) if (strlen(extension) > strlen(d_name)) { return; } if (strcmp(d_name + strlen(d_name) - strlen(extension), extension)) { return; } // allocate space for the full path of the vendor library name fileName = malloc(strlen(d_name) + strlen(path) + 2); if (!fileName) { KHR_ICD_TRACE("Failed allocate space for ICD file path\n"); return; } sprintf(fileName, "%s/%s", path, d_name); if (stat(fileName, &statBuff)) { KHR_ICD_TRACE("Failed stat for: %s, continuing\n", fileName); free(fileName); return; } if (S_ISREG(statBuff.st_mode) || S_ISLNK(statBuff.st_mode)) { FILE *fin = NULL; char* buffer = NULL; long bufferSize = 0; // open the file and read its contents fin = fopen(fileName, "r"); if (!fin) { free(fileName); return; } fseek(fin, 0, SEEK_END); bufferSize = ftell(fin); buffer = malloc(bufferSize+1); if (!buffer) { free(fileName); fclose(fin); return; } memset(buffer, 0, bufferSize+1); fseek(fin, 0, SEEK_SET); if (bufferSize != (long)fread(buffer, 1, bufferSize, fin)) { free(fileName); free(buffer); fclose(fin); return; } // ignore a newline at the end of the file if (buffer[bufferSize-1] == '\n') buffer[bufferSize-1] = '\0'; // load the string read from the file addFunc(buffer); free(fileName); free(buffer); fclose(fin); } else { KHR_ICD_TRACE("File %s is not a regular file nor symbolic link, continuing\n", fileName); free(fileName); } } struct dirElem { char *d_name; unsigned char d_type; }; static int compareDirElem(const void *a, const void *b) { // sort files the same way libc alpahnumerically sorts directory entries. return strcoll(((const struct dirElem *)a)->d_name, ((const struct dirElem *)b)->d_name); } static inline void khrIcdOsDirEnumerate(const char *path, const char *env, const char *extension, khrIcdFileAdd addFunc, int bSort) { DIR *dir = NULL; char* envPath = NULL; envPath = khrIcd_secure_getenv(env); if (NULL != envPath) { path = envPath; } dir = opendir(path); if (NULL == dir) { KHR_ICD_TRACE("Failed to open path %s, continuing\n", path); } else { struct dirent *dirEntry = NULL; // attempt to load all files in the directory if (bSort) { // store the entries name and type in a buffer for sorting size_t sz = 0; size_t elemCount = 0; size_t elemAlloc = 0; struct dirElem *dirElems = NULL; struct dirElem *newDirElems = NULL; const size_t startupAlloc = 8; // start with a small buffer dirElems = (struct dirElem *)malloc(startupAlloc*sizeof(struct dirElem)); if (NULL != dirElems) { elemAlloc = startupAlloc; for (dirEntry = readdir(dir); dirEntry; dirEntry = readdir(dir) ) { char *nameCopy = NULL; if (elemCount + 1 > elemAlloc) { // double buffer size if necessary and possible if (elemAlloc >= UINT_MAX/2) break; newDirElems = (struct dirElem *)realloc(dirElems, elemAlloc*2*sizeof(struct dirElem)); if (NULL == newDirElems) break; dirElems = newDirElems; elemAlloc *= 2; } sz = strlen(dirEntry->d_name) + 1; nameCopy = (char *)malloc(sz); if (NULL == nameCopy) break; memcpy(nameCopy, dirEntry->d_name, sz); dirElems[elemCount].d_name = nameCopy; #if defined(__QNXNTO__) dirElems[elemCount].d_type = _DEXTRA_FIRST(dirEntry)->d_type; #else dirElems[elemCount].d_type = dirEntry->d_type; #endif elemCount++; } qsort(dirElems, elemCount, sizeof(struct dirElem), compareDirElem); for (struct dirElem *elem = dirElems; elem < dirElems + elemCount; ++elem) { khrIcdOsDirEntryValidateAndAdd(elem->d_name, path, extension, addFunc); free(elem->d_name); } free(dirElems); } } else // use system provided ordering for (dirEntry = readdir(dir); dirEntry; dirEntry = readdir(dir) ) khrIcdOsDirEntryValidateAndAdd(dirEntry->d_name, path, extension, addFunc); closedir(dir); } if (NULL != envPath) { khrIcd_free_getenv(envPath); } } // go through the list of vendors in the two configuration files void khrIcdOsVendorsEnumerate(void) { khrIcdInitializeTrace(); khrIcdVendorsEnumerateEnv(); khrIcdOsDirEnumerate(ICD_VENDOR_PATH, "OCL_ICD_VENDORS", ".icd", khrIcdVendorAdd, 0); #if defined(CL_ENABLE_LAYERS) // system layers should be closer to the driver khrIcdOsDirEnumerate(LAYER_PATH, "OPENCL_LAYER_PATH", ".lay", khrIcdLayerAdd, 1); khrIcdLayersEnumerateEnv(); #endif // defined(CL_ENABLE_LAYERS) } // go through the list of vendors only once void khrIcdOsVendorsEnumerateOnce(void) { pthread_once(&initialized, khrIcdOsVendorsEnumerate); } /* * * Dynamic library loading functions * */ // dynamically load a library. returns NULL on failure void *khrIcdOsLibraryLoad(const char *libraryName) { void* ret = dlopen (libraryName, RTLD_NOW); if (NULL == ret) { KHR_ICD_TRACE("Failed to load driver because %s.\n", dlerror()); } return ret; } // get a function pointer from a loaded library. returns NULL on failure. void *khrIcdOsLibraryGetFunctionAddress(void *library, const char *functionName) { return dlsym(library, functionName); } // unload a library void khrIcdOsLibraryUnload(void *library) { dlclose(library); } OpenCL-ICD-Loader-2025.07.22/loader/linux/icd_linux_envvars.c000066400000000000000000000043031503776305700233440ustar00rootroot00000000000000/* * Copyright (c) 2016-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ // for secure_getenv(): #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include "icd_cmake_config.h" #include #include char *khrIcd_getenv(const char *name) { // No allocation of memory necessary for Linux. return getenv(name); } char *khrIcd_secure_getenv(const char *name) { #if defined(__APPLE__) || defined(__QNXNTO__) // Apple does not appear to have a secure getenv implementation. // The main difference between secure getenv and getenv is that secure getenv // returns NULL if the process is being run with elevated privileges by a normal user. // The idea is to prevent the reading of malicious environment variables by a process // that can do damage. // This algorithm is derived from glibc code that sets an internal // variable (__libc_enable_secure) if the process is running under setuid or setgid. return geteuid() != getuid() || getegid() != getgid() ? NULL : khrIcd_getenv(name); #else // Linux #ifdef HAVE_SECURE_GETENV return secure_getenv(name); #elif defined(HAVE___SECURE_GETENV) return __secure_getenv(name); #else #pragma message( \ "Warning: Falling back to non-secure getenv for environmental lookups! Consider" \ " updating to a different libc.") return khrIcd_getenv(name); #endif #endif } void khrIcd_free_getenv(char *val) { // No freeing of memory necessary for Linux, but we should at least touch // val to get rid of compiler warnings. (void)val; } OpenCL-ICD-Loader-2025.07.22/loader/windows/000077500000000000000000000000001503776305700200115ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/loader/windows/OpenCL-mingw-i686.def000066400000000000000000000152331503776305700234260ustar00rootroot00000000000000; ; Copyright (c) 2022 The Khronos Group Inc. ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ; ; OpenCL is a trademark of Apple Inc. used under license by Khronos. EXPORTS ; ; Note: This is a special .def file that should only be needed for i686 ; (32-bit) mingw builds. In this case we need to export the stdcall- ; decorated functions. In all other cases we can use the standard .def ; file that does not have decorated functions. ; ; OpenCL 1.0 API clBuildProgram@24 == clBuildProgram clCreateBuffer@24 == clCreateBuffer clCreateCommandQueue@20 == clCreateCommandQueue clCreateContext@24 == clCreateContext clCreateContextFromType@24 == clCreateContextFromType clCreateFromGLBuffer@20 == clCreateFromGLBuffer clCreateFromGLRenderbuffer@20 == clCreateFromGLRenderbuffer clCreateFromGLTexture2D@28 == clCreateFromGLTexture2D clCreateFromGLTexture3D@28 == clCreateFromGLTexture3D clCreateImage2D@36 == clCreateImage2D clCreateImage3D@44 == clCreateImage3D clCreateKernel@12 == clCreateKernel clCreateKernelsInProgram@16 == clCreateKernelsInProgram clCreateProgramWithBinary@28 == clCreateProgramWithBinary clCreateProgramWithSource@20 == clCreateProgramWithSource clCreateSampler@20 == clCreateSampler clEnqueueAcquireGLObjects@24 == clEnqueueAcquireGLObjects clEnqueueBarrier@4 == clEnqueueBarrier clEnqueueCopyBuffer@36 == clEnqueueCopyBuffer clEnqueueCopyBufferToImage@36 == clEnqueueCopyBufferToImage clEnqueueCopyImage@36 == clEnqueueCopyImage clEnqueueCopyImageToBuffer@36 == clEnqueueCopyImageToBuffer clEnqueueMapBuffer@44 == clEnqueueMapBuffer clEnqueueMapImage@52 == clEnqueueMapImage clEnqueueMarker@8 == clEnqueueMarker clEnqueueNDRangeKernel@36 == clEnqueueNDRangeKernel clEnqueueNativeKernel@40 == clEnqueueNativeKernel clEnqueueReadBuffer@36 == clEnqueueReadBuffer clEnqueueReadImage@44 == clEnqueueReadImage clEnqueueReleaseGLObjects@24 == clEnqueueReleaseGLObjects clEnqueueTask@20 == clEnqueueTask clEnqueueUnmapMemObject@24 == clEnqueueUnmapMemObject clEnqueueWaitForEvents@12 == clEnqueueWaitForEvents clEnqueueWriteBuffer@36 == clEnqueueWriteBuffer clEnqueueWriteImage@44 == clEnqueueWriteImage clFinish@4 == clFinish clFlush@4 == clFlush clGetCommandQueueInfo@20 == clGetCommandQueueInfo clGetContextInfo@20 == clGetContextInfo clGetDeviceIDs@24 == clGetDeviceIDs clGetDeviceInfo@20 == clGetDeviceInfo clGetEventInfo@20 == clGetEventInfo clGetEventProfilingInfo@20 == clGetEventProfilingInfo clGetExtensionFunctionAddress@4 == clGetExtensionFunctionAddress clGetGLObjectInfo@12 == clGetGLObjectInfo clGetGLTextureInfo@20 == clGetGLTextureInfo clGetImageInfo@20 == clGetImageInfo clGetKernelInfo@20 == clGetKernelInfo clGetKernelWorkGroupInfo@24 == clGetKernelWorkGroupInfo clGetMemObjectInfo@20 == clGetMemObjectInfo clGetPlatformIDs@12 == clGetPlatformIDs clGetPlatformInfo@20 == clGetPlatformInfo clGetProgramBuildInfo@24 == clGetProgramBuildInfo clGetProgramInfo@20 == clGetProgramInfo clGetSamplerInfo@20 == clGetSamplerInfo clGetSupportedImageFormats@28 == clGetSupportedImageFormats clReleaseCommandQueue@4 == clReleaseCommandQueue clReleaseContext@4 == clReleaseContext clReleaseEvent@4 == clReleaseEvent clReleaseKernel@4 == clReleaseKernel clReleaseMemObject@4 == clReleaseMemObject clReleaseProgram@4 == clReleaseProgram clReleaseSampler@4 == clReleaseSampler clRetainCommandQueue@4 == clRetainCommandQueue clRetainContext@4 == clRetainContext clRetainEvent@4 == clRetainEvent clRetainKernel@4 == clRetainKernel clRetainMemObject@4 == clRetainMemObject clRetainProgram@4 == clRetainProgram clRetainSampler@4 == clRetainSampler clSetCommandQueueProperty@20 == clSetCommandQueueProperty clSetKernelArg@16 == clSetKernelArg clUnloadCompiler@0 == clUnloadCompiler clWaitForEvents@8 == clWaitForEvents ; OpenCL 1.1 API clCreateSubBuffer@24 == clCreateSubBuffer clCreateUserEvent@8 == clCreateUserEvent clEnqueueCopyBufferRect@52 == clEnqueueCopyBufferRect clEnqueueReadBufferRect@56 == clEnqueueReadBufferRect clEnqueueWriteBufferRect@56 == clEnqueueWriteBufferRect clSetEventCallback@16 == clSetEventCallback clSetMemObjectDestructorCallback@12 == clSetMemObjectDestructorCallback clSetUserEventStatus@8 == clSetUserEventStatus ; OpenCL 1.2 API clCompileProgram@36 == clCompileProgram clCreateFromGLTexture@28 == clCreateFromGLTexture clCreateImage@28 == clCreateImage clCreateProgramWithBuiltInKernels@20 == clCreateProgramWithBuiltInKernels clCreateSubDevices@20 == clCreateSubDevices clEnqueueBarrierWithWaitList@16 == clEnqueueBarrierWithWaitList clEnqueueFillBuffer@36 == clEnqueueFillBuffer clEnqueueFillImage@32 == clEnqueueFillImage clEnqueueMarkerWithWaitList@16 == clEnqueueMarkerWithWaitList clEnqueueMigrateMemObjects@32 == clEnqueueMigrateMemObjects clGetExtensionFunctionAddressForPlatform@8 == clGetExtensionFunctionAddressForPlatform clGetKernelArgInfo@24 == clGetKernelArgInfo clLinkProgram@36 == clLinkProgram clReleaseDevice@4 == clReleaseDevice clRetainDevice@4 == clRetainDevice clUnloadPlatformCompiler@4 == clUnloadPlatformCompiler ; OpenCL 2.0 API clCreateCommandQueueWithProperties@16 == clCreateCommandQueueWithProperties clCreatePipe@28 == clCreatePipe clCreateSamplerWithProperties@12 == clCreateSamplerWithProperties clEnqueueSVMFree@32 == clEnqueueSVMFree clEnqueueSVMMap@36 == clEnqueueSVMMap clEnqueueSVMMemcpy@32 == clEnqueueSVMMemcpy clEnqueueSVMMemFill@32 == clEnqueueSVMMemFill clEnqueueSVMUnmap@20 == clEnqueueSVMUnmap clGetPipeInfo@20 == clGetPipeInfo clSetKernelArgSVMPointer@12 == clSetKernelArgSVMPointer clSetKernelExecInfo@16 == clSetKernelExecInfo clSVMAlloc@20 == clSVMAlloc clSVMFree@8 == clSVMFree ; OpenCL 2.1 API clCloneKernel@8 == clCloneKernel clCreateProgramWithIL@16 == clCreateProgramWithIL clEnqueueSVMMigrateMem@36 == clEnqueueSVMMigrateMem clGetDeviceAndHostTimer@12 == clGetDeviceAndHostTimer clGetHostTimer@8 == clGetHostTimer clGetKernelSubGroupInfo@32 == clGetKernelSubGroupInfo clSetDefaultDeviceCommandQueue@12 == clSetDefaultDeviceCommandQueue ; OpenCL 2.2 API clSetProgramReleaseCallback@12 == clSetProgramReleaseCallback clSetProgramSpecializationConstant@16 == clSetProgramSpecializationConstant ; OpenCL 3.0 API clCreateBufferWithProperties@28 == clCreateBufferWithProperties clCreateImageWithProperties@32 == clCreateImageWithProperties clSetContextDestructorCallback@12 == clSetContextDestructorCallback OpenCL-ICD-Loader-2025.07.22/loader/windows/OpenCL.def000066400000000000000000000067641503776305700216260ustar00rootroot00000000000000; ; Copyright (c) 2016-2019 The Khronos Group Inc. ; ; Licensed under the Apache License, Version 2.0 (the "License"); ; you may not use this file except in compliance with the License. ; You may obtain a copy of the License at ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; See the License for the specific language governing permissions and ; limitations under the License. ; ; OpenCL is a trademark of Apple Inc. used under license by Khronos. EXPORTS ; ; Note: ; ; 1. Functions are grouped into blocks according to the OpenCL API version they ; were introduced in. ; ; 2. Function blocks are sorted in ascending order of the API version. ; ; 3. Functions within a block are sorted alphabetically. ; ; OpenCL 1.0 API clBuildProgram clCreateBuffer clCreateCommandQueue clCreateContext clCreateContextFromType clCreateFromGLBuffer clCreateFromGLRenderbuffer clCreateFromGLTexture2D clCreateFromGLTexture3D clCreateImage2D clCreateImage3D clCreateKernel clCreateKernelsInProgram clCreateProgramWithBinary clCreateProgramWithSource clCreateSampler clEnqueueAcquireGLObjects clEnqueueBarrier clEnqueueCopyBuffer clEnqueueCopyBufferToImage clEnqueueCopyImage clEnqueueCopyImageToBuffer clEnqueueMapBuffer clEnqueueMapImage clEnqueueMarker clEnqueueNDRangeKernel clEnqueueNativeKernel clEnqueueReadBuffer clEnqueueReadImage clEnqueueReleaseGLObjects clEnqueueTask clEnqueueUnmapMemObject clEnqueueWaitForEvents clEnqueueWriteBuffer clEnqueueWriteImage clFinish clFlush clGetCommandQueueInfo clGetContextInfo clGetDeviceIDs clGetDeviceInfo clGetEventInfo clGetEventProfilingInfo clGetExtensionFunctionAddress clGetGLObjectInfo clGetGLTextureInfo clGetImageInfo clGetKernelInfo clGetKernelWorkGroupInfo clGetMemObjectInfo clGetPlatformIDs clGetPlatformInfo clGetProgramBuildInfo clGetProgramInfo clGetSamplerInfo clGetSupportedImageFormats clReleaseCommandQueue clReleaseContext clReleaseEvent clReleaseKernel clReleaseMemObject clReleaseProgram clReleaseSampler clRetainCommandQueue clRetainContext clRetainEvent clRetainKernel clRetainMemObject clRetainProgram clRetainSampler clSetCommandQueueProperty clSetKernelArg clUnloadCompiler clWaitForEvents ; OpenCL 1.1 API clCreateSubBuffer clCreateUserEvent clEnqueueCopyBufferRect clEnqueueReadBufferRect clEnqueueWriteBufferRect clSetEventCallback clSetMemObjectDestructorCallback clSetUserEventStatus ; OpenCL 1.2 API clCompileProgram clCreateFromGLTexture clCreateImage clCreateProgramWithBuiltInKernels clCreateSubDevices clEnqueueBarrierWithWaitList clEnqueueFillBuffer clEnqueueFillImage clEnqueueMarkerWithWaitList clEnqueueMigrateMemObjects clGetExtensionFunctionAddressForPlatform clGetKernelArgInfo clLinkProgram clReleaseDevice clRetainDevice clUnloadPlatformCompiler ; OpenCL 2.0 API clCreateCommandQueueWithProperties clCreatePipe clCreateSamplerWithProperties clEnqueueSVMFree clEnqueueSVMMap clEnqueueSVMMemcpy clEnqueueSVMMemFill clEnqueueSVMUnmap clGetPipeInfo clSetKernelArgSVMPointer clSetKernelExecInfo clSVMAlloc clSVMFree ; OpenCL 2.1 API clCloneKernel clCreateProgramWithIL clEnqueueSVMMigrateMem clGetDeviceAndHostTimer clGetHostTimer clGetKernelSubGroupInfo clSetDefaultDeviceCommandQueue ; OpenCL 2.2 API clSetProgramReleaseCallback clSetProgramSpecializationConstant ; OpenCL 3.0 API clCreateBufferWithProperties clCreateImageWithProperties clSetContextDestructorCallback OpenCL-ICD-Loader-2025.07.22/loader/windows/OpenCL.rc000066400000000000000000000033051503776305700214600ustar00rootroot00000000000000/* * Copyright (c) 2016-2023 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #include #ifdef RC_INVOKED VS_VERSION_INFO VERSIONINFO FILEVERSION OPENCL_ICD_LOADER_VERSION_MAJOR,OPENCL_ICD_LOADER_VERSION_MINOR,OPENCL_ICD_LOADER_VERSION_REV,0 PRODUCTVERSION OPENCL_ICD_LOADER_VERSION_MAJOR,OPENCL_ICD_LOADER_VERSION_MINOR,OPENCL_ICD_LOADER_VERSION_REV,0 FILETYPE VFT_DLL BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" BEGIN VALUE "FileDescription" ,"OpenCL Client DLL" VALUE "ProductName" ,OPENCL_ICD_LOADER_NAME_STRING VALUE "LegalCopyright" ,L"Copyright \251 The Khronos Group Inc 2016-2023" VALUE "FileVersion" ,OPENCL_ICD_LOADER_VERSION_STRING ".0" VALUE "CompanyName" ,OPENCL_ICD_LOADER_VENDOR_STRING VALUE "InternalName" ,"OpenCL" VALUE "OriginalFilename","OpenCL.dll" END END BLOCK "VarFileInfo" BEGIN // extend this line for localized versions VALUE "Translation", 0x0409, 0x04E4 END END #endif OpenCL-ICD-Loader-2025.07.22/loader/windows/adapter.h000066400000000000000000000044731503776305700216120ustar00rootroot00000000000000/* * Copyright (c) 2019 The Khronos Group Inc. * Copyright (c) 2019 Valve Corporation * Copyright (c) 2019 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: Lenny Komow */ typedef struct LoaderEnumAdapters2 { ULONG adapter_count; struct { UINT handle; LUID luid; ULONG source_count; BOOL present_move_regions_preferred; } * adapters; } LoaderEnumAdapters2; typedef _Check_return_ NTSTATUS(APIENTRY *PFN_LoaderEnumAdapters2)(const LoaderEnumAdapters2 *); typedef enum AdapterInfoType { LOADER_QUERY_TYPE_REGISTRY = 48, } AdapterInfoType; typedef struct LoaderQueryAdapterInfo { UINT handle; AdapterInfoType type; VOID *private_data; UINT private_data_size; } LoaderQueryAdapterInfo; typedef _Check_return_ NTSTATUS(APIENTRY *PFN_LoaderQueryAdapterInfo)(const LoaderQueryAdapterInfo *); typedef enum LoaderQueryRegistryType { LOADER_QUERY_REGISTRY_ADAPTER_KEY = 1, } LoaderQueryRegistryType; typedef enum LoaderQueryRegistryStatus { LOADER_QUERY_REGISTRY_STATUS_SUCCESS = 0, LOADER_QUERY_REGISTRY_STATUS_BUFFER_OVERFLOW = 1, } LoaderQueryRegistryStatus; typedef struct LoaderQueryRegistryFlags { union { struct { UINT translate_path : 1; UINT mutable_value : 1; UINT reserved : 30; }; UINT value; }; } LoaderQueryRegistryFlags; typedef struct LoaderQueryRegistryInfo { LoaderQueryRegistryType query_type; LoaderQueryRegistryFlags query_flags; WCHAR value_name[MAX_PATH]; ULONG value_type; ULONG physical_adapter_index; ULONG output_value_size; LoaderQueryRegistryStatus status; union { DWORD output_dword; UINT64 output_qword; WCHAR output_string[1]; BYTE output_binary[1]; }; } LoaderQueryRegistryInfo; OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows.c000066400000000000000000000321651503776305700224750ustar00rootroot00000000000000/* * Copyright (c) 2016-2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #include "icd.h" #include "icd_windows.h" #include "icd_windows_hkr.h" #include "icd_windows_dxgk.h" #include "icd_windows_apppackage.h" #include #include #include #include #include typedef HRESULT (WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID, void **); static INIT_ONCE initialized = INIT_ONCE_STATIC_INIT; typedef struct WinAdapter { char * szName; LUID luid; } WinAdapter; const LUID ZeroLuid = { 0, 0 }; static WinAdapter* pWinAdapterBegin = NULL; static WinAdapter* pWinAdapterEnd = NULL; static WinAdapter* pWinAdapterCapacity = NULL; BOOL adapterAdd(const char* szName, LUID luid) { BOOL result = TRUE; if (pWinAdapterEnd == pWinAdapterCapacity) { size_t oldCapacity = pWinAdapterCapacity - pWinAdapterBegin; size_t newCapacity = oldCapacity; if (0 == newCapacity) { newCapacity = 1; } else if(newCapacity < UINT_MAX/2) { newCapacity *= 2; } WinAdapter* pNewBegin = malloc(newCapacity * sizeof(*pWinAdapterBegin)); if (!pNewBegin) result = FALSE; else { if (pWinAdapterBegin) { memcpy(pNewBegin, pWinAdapterBegin, oldCapacity * sizeof(*pWinAdapterBegin)); free(pWinAdapterBegin); } pWinAdapterCapacity = pNewBegin + newCapacity; pWinAdapterEnd = pNewBegin + oldCapacity; pWinAdapterBegin = pNewBegin; } } if (pWinAdapterEnd != pWinAdapterCapacity) { size_t nameLen = (strlen(szName) + 1)*sizeof(szName[0]); pWinAdapterEnd->szName = malloc(nameLen); if (!pWinAdapterEnd->szName) result = FALSE; else { memcpy(pWinAdapterEnd->szName, szName, nameLen); pWinAdapterEnd->luid = luid; ++pWinAdapterEnd; } } return result; } void adapterFree(WinAdapter *pWinAdapter) { free(pWinAdapter->szName); pWinAdapter->szName = NULL; } #if defined(CL_ENABLE_LAYERS) typedef struct WinLayer { char * szName; DWORD priority; } WinLayer; static WinLayer* pWinLayerBegin; static WinLayer* pWinLayerEnd; static WinLayer* pWinLayerCapacity; static int __cdecl compareLayer(const void *a, const void *b) { return ((const WinLayer *)a)->priority < ((const WinLayer *)b)->priority ? -1 : ((const WinLayer *)a)->priority > ((const WinLayer *)b)->priority ? 1 : 0; } static BOOL layerAdd(const char* szName, DWORD priority) { BOOL result = TRUE; if (pWinLayerEnd == pWinLayerCapacity) { size_t oldCapacity = pWinLayerCapacity - pWinLayerBegin; size_t newCapacity = oldCapacity; if (0 == newCapacity) { newCapacity = 1; } else if(newCapacity < UINT_MAX/2) { newCapacity *= 2; } WinLayer* pNewBegin = malloc(newCapacity * sizeof(*pWinLayerBegin)); if (!pNewBegin) { KHR_ICD_TRACE("Failed allocate space for Layers array\n"); result = FALSE; } else { if (pWinLayerBegin) { memcpy(pNewBegin, pWinLayerBegin, oldCapacity * sizeof(*pWinLayerBegin)); free(pWinLayerBegin); } pWinLayerCapacity = pNewBegin + newCapacity; pWinLayerEnd = pNewBegin + oldCapacity; pWinLayerBegin = pNewBegin; } } if (pWinLayerEnd != pWinLayerCapacity) { size_t nameLen = (strlen(szName) + 1)*sizeof(szName[0]); pWinLayerEnd->szName = malloc(nameLen); if (!pWinLayerEnd->szName) { KHR_ICD_TRACE("Failed allocate space for Layer file path\n"); result = FALSE; } else { memcpy(pWinLayerEnd->szName, szName, nameLen); pWinLayerEnd->priority = priority; ++pWinLayerEnd; } } return result; } void layerFree(WinLayer *pWinLayer) { free(pWinLayer->szName); pWinLayer->szName = NULL; } #endif // defined(CL_ENABLE_LAYERS) /* * * Vendor enumeration functions * */ // go through the list of vendors in the registry and call khrIcdVendorAdd // for each vendor encountered BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContext) { (void)InitOnce; (void)Parameter; (void)lpContext; LONG result; BOOL status = FALSE, currentStatus = FALSE; const char* platformsName = "SOFTWARE\\Khronos\\OpenCL\\Vendors"; HKEY platformsKey = NULL; DWORD dwIndex; khrIcdInitializeTrace(); khrIcdVendorsEnumerateEnv(); currentStatus = khrIcdOsVendorsEnumerateDXGK(); status |= currentStatus; if (!currentStatus) { KHR_ICD_TRACE("Failed to load via DXGK interface on RS4, continuing\n"); } currentStatus = khrIcdOsVendorsEnumerateHKR(); status |= currentStatus; if (!currentStatus) { KHR_ICD_TRACE("Failed to enumerate HKR entries, continuing\n"); } currentStatus = khrIcdOsVendorsEnumerateAppPackage(); status |= currentStatus; if (!currentStatus) { KHR_ICD_TRACE("Failed to enumerate App package entry, continuing\n"); } KHR_ICD_TRACE("Opening key HKLM\\%s...\n", platformsName); result = RegOpenKeyExA( HKEY_LOCAL_MACHINE, platformsName, 0, KEY_READ, &platformsKey); if (ERROR_SUCCESS != result) { KHR_ICD_TRACE("Failed to open platforms key %s, continuing\n", platformsName); } else { // for each value for (dwIndex = 0;; ++dwIndex) { char cszLibraryName[1024] = {0}; DWORD dwLibraryNameSize = sizeof(cszLibraryName); DWORD dwLibraryNameType = 0; DWORD dwValue = 0; DWORD dwValueSize = sizeof(dwValue); // read the value name KHR_ICD_TRACE("Reading value %"PRIuDW"...\n", dwIndex); result = RegEnumValueA( platformsKey, dwIndex, cszLibraryName, &dwLibraryNameSize, NULL, &dwLibraryNameType, (LPBYTE)&dwValue, &dwValueSize); // if RegEnumKeyEx fails, we are done with the enumeration if (ERROR_SUCCESS != result) { KHR_ICD_TRACE("Failed to read value %"PRIuDW", done reading key.\n", dwIndex); break; } KHR_ICD_TRACE("Value %s found...\n", cszLibraryName); // Require that the value be a DWORD and equal zero if (REG_DWORD != dwLibraryNameType) { KHR_ICD_TRACE("Value not a DWORD, skipping\n"); continue; } if (dwValue) { KHR_ICD_TRACE("Value not zero, skipping\n"); continue; } // add the library status |= adapterAdd(cszLibraryName, ZeroLuid); } } // Add adapters according to DXGI's preference order HMODULE hDXGI = LoadLibraryA("dxgi.dll"); if (hDXGI) { IDXGIFactory* pFactory = NULL; PFN_CREATE_DXGI_FACTORY pCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)(void*)GetProcAddress(hDXGI, "CreateDXGIFactory"); if (pCreateDXGIFactory) { HRESULT hr = pCreateDXGIFactory(&IID_IDXGIFactory, (void **)&pFactory); if (SUCCEEDED(hr)) { UINT i = 0; IDXGIAdapter* pAdapter = NULL; while (SUCCEEDED(pFactory->lpVtbl->EnumAdapters(pFactory, i++, &pAdapter))) { DXGI_ADAPTER_DESC AdapterDesc; if (SUCCEEDED(pAdapter->lpVtbl->GetDesc(pAdapter, &AdapterDesc))) { for (WinAdapter* iterAdapter = pWinAdapterBegin; iterAdapter != pWinAdapterEnd; ++iterAdapter) { if (iterAdapter->luid.LowPart == AdapterDesc.AdapterLuid.LowPart && iterAdapter->luid.HighPart == AdapterDesc.AdapterLuid.HighPart) { khrIcdVendorAdd(iterAdapter->szName); break; } } } pAdapter->lpVtbl->Release(pAdapter); } pFactory->lpVtbl->Release(pFactory); } } FreeLibrary(hDXGI); } // Go through the list again, putting any remaining adapters at the end of the list in an undefined order for (WinAdapter* iterAdapter = pWinAdapterBegin; iterAdapter != pWinAdapterEnd; ++iterAdapter) { khrIcdVendorAdd(iterAdapter->szName); adapterFree(iterAdapter); } free(pWinAdapterBegin); pWinAdapterBegin = NULL; pWinAdapterEnd = NULL; pWinAdapterCapacity = NULL; result = RegCloseKey(platformsKey); if (ERROR_SUCCESS != result) { KHR_ICD_TRACE("Failed to close platforms key %s, ignoring\n", platformsName); } #if defined(CL_ENABLE_LAYERS) const char* layersName = "SOFTWARE\\Khronos\\OpenCL\\Layers"; HKEY layersKey = NULL; KHR_ICD_TRACE("Opening key HKLM\\%s...\n", layersName); result = RegOpenKeyExA( HKEY_LOCAL_MACHINE, layersName, 0, KEY_READ, &layersKey); if (ERROR_SUCCESS != result) { KHR_ICD_TRACE("Failed to open layers key %s, continuing\n", layersName); } else { // for each value for (dwIndex = 0;; ++dwIndex) { char cszLibraryName[1024] = {0}; DWORD dwLibraryNameSize = sizeof(cszLibraryName); DWORD dwLibraryNameType = 0; DWORD dwValue = 0; DWORD dwValueSize = sizeof(dwValue); // read the value name KHR_ICD_TRACE("Reading value %"PRIuDW"...\n", dwIndex); result = RegEnumValueA( layersKey, dwIndex, cszLibraryName, &dwLibraryNameSize, NULL, &dwLibraryNameType, (LPBYTE)&dwValue, &dwValueSize); // if RegEnumKeyEx fails, we are done with the enumeration if (ERROR_SUCCESS != result) { KHR_ICD_TRACE("Failed to read value %"PRIuDW", done reading key.\n", dwIndex); break; } KHR_ICD_TRACE("Value %s found...\n", cszLibraryName); // Require that the value be a DWORD if (REG_DWORD != dwLibraryNameType) { KHR_ICD_TRACE("Value not a DWORD, skipping\n"); continue; } // add the library status |= layerAdd(cszLibraryName, dwValue); } qsort(pWinLayerBegin, pWinLayerEnd - pWinLayerBegin, sizeof(WinLayer), compareLayer); for (WinLayer* iterLayer = pWinLayerBegin; iterLayer != pWinLayerEnd; ++iterLayer) { khrIcdLayerAdd(iterLayer->szName); layerFree(iterLayer); } } free(pWinLayerBegin); pWinLayerBegin = NULL; pWinLayerEnd = NULL; pWinLayerCapacity = NULL; result = RegCloseKey(layersKey); khrIcdLayersEnumerateEnv(); #endif // defined(CL_ENABLE_LAYERS) return status; } // go through the list of vendors only once void khrIcdOsVendorsEnumerateOnce() { InitOnceExecuteOnce(&initialized, khrIcdOsVendorsEnumerate, NULL, NULL); } /* * * Dynamic library loading functions * */ // dynamically load a library. returns NULL on failure void *khrIcdOsLibraryLoad(const char *libraryName) { HMODULE hTemp = LoadLibraryExA(libraryName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (!hTemp && GetLastError() == ERROR_INVALID_PARAMETER) { hTemp = LoadLibraryExA(libraryName, NULL, 0); } if (!hTemp) { KHR_ICD_TRACE("Failed to load driver. Windows error code is %"PRIuDW".\n", GetLastError()); } return (void*)hTemp; } // get a function pointer from a loaded library. returns NULL on failure. void *khrIcdOsLibraryGetFunctionAddress(void *library, const char *functionName) { if (!library || !functionName) { return NULL; } return GetProcAddress( (HMODULE)library, functionName); } // unload a library. void khrIcdOsLibraryUnload(void *library) { FreeLibrary( (HMODULE)library); } OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows.h000066400000000000000000000023011503776305700224670ustar00rootroot00000000000000/* * Copyright (c) 2017-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #include #ifdef _LP64 #define PRIDW_PREFIX #define PRIUL_PREFIX #else #define PRIDW_PREFIX "l" #define PRIUL_PREFIX "l" #endif #define PRIuDW PRIDW_PREFIX "u" #define PRIxDW PRIDW_PREFIX "x" #define PRIuUL PRIUL_PREFIX "u" #define PRIxUL PRIUL_PREFIX "x" #ifdef __cplusplus extern "C" { #endif extern const LUID ZeroLuid; BOOL adapterAdd(const char* szName, LUID luid); // Do not free the memory returned by this function. const char* getOpenCLRegKeyName(void); #ifdef __cplusplus } #endif OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows_apppackage.c000066400000000000000000000100251503776305700246400ustar00rootroot00000000000000/* * Copyright (c) 2017-2022 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #include "icd_windows_apppackage.h" typedef _Check_return_ LONG(WINAPI *PFN_GetPackagesByPackageFamily)( _In_ PCWSTR packageFamilyName, _Inout_ UINT32* count, _Out_writes_opt_(*count) PWSTR* packageFullNames, _Inout_ UINT32* bufferLength, _Out_writes_opt_(*bufferLength) WCHAR* buffer ); typedef LONG (WINAPI *PFN_GetPackagePathByFullName)( _In_ PCWSTR packageFullName, _Inout_ UINT32* pathLength, _Out_writes_opt_(*pathLength) PWSTR path ); bool khrIcdOsVendorsEnumerateAppPackage(void) { bool ret = false; WCHAR *buffer = NULL; PWSTR *packages = NULL; HMODULE h = LoadLibraryA("kernel32.dll"); if (h == NULL) return ret; PFN_GetPackagesByPackageFamily pGetPackagesByPackageFamily = (PFN_GetPackagesByPackageFamily)(void*)GetProcAddress(h, "GetPackagesByPackageFamily"); if (!pGetPackagesByPackageFamily) { KHR_ICD_TRACE("GetProcAddress failed for GetPackagesByPackageFamily\n"); goto cleanup; } PFN_GetPackagePathByFullName pGetPackagePathByFullName = (PFN_GetPackagePathByFullName)(void*)GetProcAddress(h, "GetPackagePathByFullName"); if (!pGetPackagePathByFullName) { KHR_ICD_TRACE("GetProcAddress failed for GetPackagePathByFullName\n"); goto cleanup; } UINT32 numPackages = 0, bufferLength = 0; PCWSTR familyName = L"Microsoft.D3DMappingLayers_8wekyb3d8bbwe"; if (ERROR_INSUFFICIENT_BUFFER != pGetPackagesByPackageFamily(familyName, &numPackages, NULL, &bufferLength, NULL) || numPackages == 0 || bufferLength == 0) { KHR_ICD_TRACE("Failed to find mapping layers packages by family name\n"); goto cleanup; } buffer = malloc(sizeof(WCHAR) * bufferLength); packages = malloc(sizeof(PWSTR) * numPackages); if (!buffer || !packages) { KHR_ICD_TRACE("Failed to allocate memory for package names\n"); goto cleanup; } if (ERROR_SUCCESS != pGetPackagesByPackageFamily(familyName, &numPackages, packages, &bufferLength, buffer)) { KHR_ICD_TRACE("Failed to get mapping layers package full names\n"); goto cleanup; } UINT32 pathLength = 0; WCHAR path[MAX_PATH]; if (ERROR_INSUFFICIENT_BUFFER != pGetPackagePathByFullName(packages[0], &pathLength, NULL) || pathLength > MAX_PATH || ERROR_SUCCESS != pGetPackagePathByFullName(packages[0], &pathLength, path)) { KHR_ICD_TRACE("Failed to get mapping layers package path length\n"); goto cleanup; } #if defined(_M_AMD64) #define PLATFORM_PATH L"x64" #elif defined(_M_ARM) #define PLATFORM_PATH L"arm" #elif defined(_M_ARM64) #define PLATFORM_PATH L"arm64" #elif defined(_M_IX86) #define PLATFORM_PATH L"x86" #endif wchar_t dllPath[MAX_PATH]; wcscpy_s(dllPath, MAX_PATH, path); wcscat_s(dllPath, MAX_PATH, L"\\" PLATFORM_PATH L"\\OpenCLOn12.dll"); char narrowDllPath[MAX_PATH]; WideCharToMultiByte(CP_UTF8, 0, dllPath, -1, narrowDllPath, MAX_PATH, NULL, NULL); ret = adapterAdd(narrowDllPath, ZeroLuid); cleanup: FreeLibrary(h); free(buffer); free(packages); return ret; } OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows_apppackage.h000066400000000000000000000014171503776305700246520ustar00rootroot00000000000000/* * Copyright (c) 2017-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #include "icd_windows.h" bool khrIcdOsVendorsEnumerateAppPackage(void); OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows_dxgk.c000066400000000000000000000152771503776305700235170ustar00rootroot00000000000000/* * Copyright (c) 2017-2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd.h" #include "icd_windows_dxgk.h" #include #include "adapter.h" #ifndef NTSTATUS typedef LONG NTSTATUS; #define STATUS_SUCCESS ((NTSTATUS)0x00000000L) #define STATUS_BUFFER_TOO_SMALL ((NTSTATUS)0xC0000023) #define NT_SUCCESS(status) (((NTSTATUS)(status)) >= 0) #endif bool khrIcdOsVendorsEnumerateDXGK(void) { bool ret = false; int result = 0; // Get handle to GDI Runtime HMODULE h = LoadLibraryA("gdi32.dll"); if (h == NULL) return ret; if(GetProcAddress(h, "D3DKMTSubmitPresentBltToHwQueue")) // OS Version check { LoaderEnumAdapters2 EnumAdapters; NTSTATUS status = STATUS_SUCCESS; EnumAdapters.adapter_count = 0; EnumAdapters.adapters = NULL; PFN_LoaderEnumAdapters2 pEnumAdapters2 = (PFN_LoaderEnumAdapters2)(void*)GetProcAddress(h, "D3DKMTEnumAdapters2"); if (!pEnumAdapters2) { KHR_ICD_TRACE("GetProcAddress failed for D3DKMTEnumAdapters2\n"); goto out; } PFN_LoaderQueryAdapterInfo pQueryAdapterInfo = (PFN_LoaderQueryAdapterInfo)(void*)GetProcAddress(h, "D3DKMTQueryAdapterInfo"); if (!pQueryAdapterInfo) { KHR_ICD_TRACE("GetProcAddress failed for D3DKMTQueryAdapterInfo\n"); goto out; } while (1) { EnumAdapters.adapter_count = 0; EnumAdapters.adapters = NULL; status = pEnumAdapters2(&EnumAdapters); if (status == STATUS_BUFFER_TOO_SMALL) { // Number of Adapters increased between calls, retry; continue; } else if (!NT_SUCCESS(status)) { KHR_ICD_TRACE("D3DKMTEnumAdapters2 status != SUCCESS\n"); goto out; } break; } EnumAdapters.adapters = malloc(sizeof(*EnumAdapters.adapters)*(EnumAdapters.adapter_count)); if (EnumAdapters.adapters == NULL) { KHR_ICD_TRACE("Allocation failure for adapters buffer\n"); goto out; } status = pEnumAdapters2(&EnumAdapters); if (!NT_SUCCESS(status)) { KHR_ICD_TRACE("D3DKMTEnumAdapters2 status != SUCCESS\n"); goto out; } const char* cszOpenCLRegKeyName = getOpenCLRegKeyName(); const int szOpenCLRegKeyName = (int)(strlen(cszOpenCLRegKeyName) + 1)*sizeof(cszOpenCLRegKeyName[0]); for (UINT AdapterIndex = 0; AdapterIndex < EnumAdapters.adapter_count; AdapterIndex++) { LoaderQueryRegistryInfo queryArgs = {0}; LoaderQueryRegistryInfo* pQueryArgs = &queryArgs; LoaderQueryRegistryInfo* pQueryBuffer = NULL; queryArgs.query_type = LOADER_QUERY_REGISTRY_ADAPTER_KEY; queryArgs.query_flags.translate_path = TRUE; queryArgs.value_type = REG_SZ; result = MultiByteToWideChar( CP_UTF8, 0, cszOpenCLRegKeyName, szOpenCLRegKeyName, queryArgs.value_name, ARRAYSIZE(queryArgs.value_name)); if (!result) { KHR_ICD_TRACE("MultiByteToWideChar status != SUCCESS\n"); continue; } LoaderQueryAdapterInfo queryAdapterInfo = {0}; queryAdapterInfo.handle = EnumAdapters.adapters[AdapterIndex].handle; queryAdapterInfo.type = LOADER_QUERY_TYPE_REGISTRY; queryAdapterInfo.private_data = &queryArgs; queryAdapterInfo.private_data_size = sizeof(queryArgs); status = pQueryAdapterInfo(&queryAdapterInfo); if (!NT_SUCCESS(status)) { // Try a different value type. Some vendors write the key as a multi-string type. queryArgs.value_type = REG_MULTI_SZ; status = pQueryAdapterInfo(&queryAdapterInfo); if (NT_SUCCESS(status)) { KHR_ICD_TRACE("Accepting multi-string registry key type\n"); } else { // Continue trying to get as much info on each adapter as possible. // It's too late to return FALSE and claim WDDM2_4 enumeration is not available here. continue; } } if (NT_SUCCESS(status) && pQueryArgs->status == LOADER_QUERY_REGISTRY_STATUS_BUFFER_OVERFLOW) { ULONG queryBufferSize = sizeof(LoaderQueryRegistryInfo) + queryArgs.output_value_size; pQueryBuffer = malloc(queryBufferSize); if (pQueryBuffer == NULL) continue; memcpy(pQueryBuffer, &queryArgs, sizeof(LoaderQueryRegistryInfo)); queryAdapterInfo.private_data = pQueryBuffer; queryAdapterInfo.private_data_size = queryBufferSize; status = pQueryAdapterInfo(&queryAdapterInfo); pQueryArgs = pQueryBuffer; } if (NT_SUCCESS(status) && pQueryArgs->status == LOADER_QUERY_REGISTRY_STATUS_SUCCESS) { char cszLibraryName[MAX_PATH]; result = WideCharToMultiByte( CP_UTF8, 0, pQueryArgs->output_string, -1, cszLibraryName, MAX_PATH, NULL, NULL); if (!result) { KHR_ICD_TRACE("WideCharToMultiByte status != SUCCESS\n"); } else { ret |= adapterAdd(cszLibraryName, EnumAdapters.adapters[AdapterIndex].luid); } } else if (status == (NTSTATUS)STATUS_INVALID_PARAMETER) { free(pQueryBuffer); goto out; } free(pQueryBuffer); } out: free(EnumAdapters.adapters); } FreeLibrary(h); return ret; } OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows_dxgk.h000066400000000000000000000014111503776305700235050ustar00rootroot00000000000000/* * Copyright (c) 2017-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #include "icd_windows.h" bool khrIcdOsVendorsEnumerateDXGK(void); OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows_envvars.c000066400000000000000000000051541503776305700242370ustar00rootroot00000000000000/* * Copyright (c) 2016-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #include #include char *khrIcd_getenv(const char *name) { char *retVal; DWORD valSize; valSize = GetEnvironmentVariableA(name, NULL, 0); // valSize DOES include the null terminator, so for any set variable // will always be at least 1. If it's 0, the variable wasn't set. if (valSize == 0) return NULL; // Allocate the space necessary for the registry entry retVal = (char *)malloc(valSize); if (NULL != retVal) { GetEnvironmentVariableA(name, retVal, valSize); } return retVal; } static bool khrIcd_IsHighIntegrityLevel() { bool isHighIntegrityLevel = false; HANDLE processToken; if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_QUERY_SOURCE, &processToken)) { // Maximum possible size of SID_AND_ATTRIBUTES is maximum size of a SID + size of attributes DWORD. char mandatoryLabelBuffer[SECURITY_MAX_SID_SIZE + sizeof(DWORD)] = {0}; DWORD bufferSize; if (GetTokenInformation(processToken, TokenIntegrityLevel, mandatoryLabelBuffer, sizeof(mandatoryLabelBuffer), &bufferSize) != 0) { const TOKEN_MANDATORY_LABEL* mandatoryLabel = (const TOKEN_MANDATORY_LABEL*)(mandatoryLabelBuffer); const DWORD subAuthorityCount = *GetSidSubAuthorityCount(mandatoryLabel->Label.Sid); const DWORD integrityLevel = *GetSidSubAuthority(mandatoryLabel->Label.Sid, subAuthorityCount - 1); isHighIntegrityLevel = integrityLevel > SECURITY_MANDATORY_MEDIUM_RID; } CloseHandle(processToken); } return isHighIntegrityLevel; } char *khrIcd_secure_getenv(const char *name) { if (khrIcd_IsHighIntegrityLevel()) { KHR_ICD_TRACE("Running at a high integrity level, so secure_getenv is returning NULL\n"); return NULL; } return khrIcd_getenv(name); } void khrIcd_free_getenv(char *val) { free((void *)val); } OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows_hkr.c000066400000000000000000000252441503776305700233410ustar00rootroot00000000000000/* * Copyright (c) 2017-2022 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd.h" #include "icd_windows_hkr.h" #include #include "icd_windows_dxgk.h" #include #include #include #include #include #include // This GUID was only added to devguid.h on Windows SDK v10.0.16232 which // corresponds to Windows 10 Redstone 3 (Windows 10 Fall Creators Update). DEFINE_GUID(OCL_GUID_DEVCLASS_SOFTWARECOMPONENT, 0x5c4c3332, 0x344d, 0x483c, 0x87, 0x39, 0x25, 0x9e, 0x93, 0x4c, 0x9c, 0xc8); typedef enum { ProbeFailure, PendingReboot, Valid } DeviceProbeResult; #define KHR_SAFE_RELEASE(mem) \ do \ { \ free(mem); \ mem = NULL; \ } while (0) static const char OPENCL_REG_SUB_KEY[] = "OpenCLDriverName"; #ifndef _WIN64 static const char OPENCL_REG_SUB_KEY_WOW[] = "OpenCLDriverNameWow"; #endif // Do not free the memory returned by this function. const char* getOpenCLRegKeyName(void) { #ifdef _WIN64 return OPENCL_REG_SUB_KEY; #else // The suffix/substring "WoW" is meaningful only when a 32-bit // application is running on a 64-bit Windows OS. A 32-bit application // running on a 32-bit OS uses non-WoW names. BOOL is_wow64; if (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64) { return OPENCL_REG_SUB_KEY_WOW; } return OPENCL_REG_SUB_KEY; #endif } static bool ReadOpenCLKey(DEVINST dnDevNode) { HKEY hkey = 0; CONFIGRET ret; bool bRet = false; DWORD dwLibraryNameType = 0; char *cszOclPath = NULL; DWORD dwOclPathSize = 0; LSTATUS result; ret = CM_Open_DevNode_Key( dnDevNode, KEY_QUERY_VALUE, 0, RegDisposition_OpenExisting, &hkey, CM_REGISTRY_SOFTWARE); if (CR_SUCCESS != ret) { KHR_ICD_TRACE("Failed with ret 0x%"PRIxDW"\n", ret); goto out; } else { result = RegQueryValueExA( hkey, getOpenCLRegKeyName(), NULL, &dwLibraryNameType, NULL, &dwOclPathSize); if (ERROR_SUCCESS != result) { KHR_ICD_TRACE("Failed to open sub key 0x%"PRIxDW"\n", result); goto out; } cszOclPath = malloc(dwOclPathSize); if (NULL == cszOclPath) { KHR_ICD_TRACE("Failed to allocate %"PRIuDW" bytes for registry value\n", dwOclPathSize); goto out; } result = RegQueryValueExA( hkey, getOpenCLRegKeyName(), NULL, &dwLibraryNameType, (LPBYTE)cszOclPath, &dwOclPathSize); if (ERROR_SUCCESS != result) { KHR_ICD_TRACE("Failed to open sub key 0x%"PRIxDW"\n", result); goto out; } if (REG_SZ != dwLibraryNameType) { if (REG_MULTI_SZ == dwLibraryNameType) { KHR_ICD_TRACE("Accepting multi-string registry key type\n"); } else { KHR_ICD_TRACE("Unexpected registry entry 0x%"PRIxDW"! continuing\n", dwLibraryNameType); goto out; } } KHR_ICD_TRACE(" Path: %s\n", cszOclPath); bRet |= adapterAdd(cszOclPath, ZeroLuid); } out: free(cszOclPath); if (hkey) { result = RegCloseKey(hkey); if (ERROR_SUCCESS != result) { KHR_ICD_TRACE("WARNING: failed to close hkey 0x%"PRIxDW"\n", result); } } return bRet; } static DeviceProbeResult ProbeDevice(DEVINST devnode) { CONFIGRET ret; ULONG ulStatus; ULONG ulProblem; ret = CM_Get_DevNode_Status( &ulStatus, &ulProblem, devnode, 0); if (CR_SUCCESS != ret) { KHR_ICD_TRACE(" WARNING: failed to probe the status of the device 0x%"PRIxDW"\n", ret); return ProbeFailure; } // // Careful here, we need to check 2 scenarios: // 1. DN_NEED_RESTART // status flag indicates that a reboot is needed when an _already started_ // device cannot be stopped. This covers devices that are still started with their // old KMD (because they couldn't be stopped/restarted) while the UMD is updated // and possibly out of sync. // // 2. Status & DN_HAS_PROBLEM && Problem == CM_PROB_NEED_RESTART // indicates that a reboot is needed when a _stopped device_ cannot be (re)started. // if (((ulStatus & DN_HAS_PROBLEM) && ulProblem == CM_PROB_NEED_RESTART) || ulStatus & DN_NEED_RESTART) { KHR_ICD_TRACE(" WARNING: device is pending reboot (0x%" PRIxUL "), skipping...\n", ulStatus); return PendingReboot; } return Valid; } // Tries to look for the OpenCL key under the display devices and // if not found, falls back to software component devices. bool khrIcdOsVendorsEnumerateHKR(void) { CONFIGRET ret; int iret; bool foundOpenCLKey = false; DEVINST devinst = 0; DEVINST devchild = 0; wchar_t *deviceIdList = NULL; ULONG szBuffer = 0; OLECHAR display_adapter_guid_str[MAX_GUID_STRING_LEN]; #if defined(CM_GETIDLIST_FILTER_CLASS) && defined(CM_GETIDLIST_FILTER_PRESENT) ULONG ulFlags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT; #else ULONG ulFlags = 0x300; #endif iret = StringFromGUID2( &GUID_DEVCLASS_DISPLAY, display_adapter_guid_str, MAX_GUID_STRING_LEN); if (MAX_GUID_STRING_LEN != iret) { KHR_ICD_TRACE("StringFromGUID2 failed with %d\n", iret); goto out; } // Paranoia: we might have a new device added to the list between the call // to CM_Get_Device_ID_List_Size() and the call to CM_Get_Device_ID_List(). do { ret = CM_Get_Device_ID_List_SizeW( &szBuffer, display_adapter_guid_str, ulFlags); if (CR_SUCCESS != ret) { KHR_ICD_TRACE("CM_Get_Device_ID_List_size failed with 0x%"PRIxDW"\n", ret); break; } // "pulLen [out] Receives a value representing the required buffer // size, in characters." // So we need to allocate the right size in bytes but we still need // to keep szBuffer as it was returned from CM_Get_Device_ID_List_Size so // the call to CM_Get_Device_ID_List will receive the correct size. deviceIdList = malloc(szBuffer * sizeof(wchar_t)); if (NULL == deviceIdList) { KHR_ICD_TRACE("Failed to allocate %" PRIuUL " bytes for device ID strings\n", szBuffer); break; } ret = CM_Get_Device_ID_ListW( display_adapter_guid_str, deviceIdList, szBuffer, ulFlags); if (CR_SUCCESS != ret) { KHR_ICD_TRACE("CM_Get_Device_ID_List failed with 0x%"PRIxDW"\n", ret); KHR_SAFE_RELEASE(deviceIdList); } } while (CR_BUFFER_SMALL == ret); if (NULL == deviceIdList) { goto out; } for (PWSTR deviceId = deviceIdList; *deviceId; deviceId += wcslen(deviceId) + 1) { KHR_ICD_WIDE_TRACE(L"Device ID: %ls\n", deviceId); ret = CM_Locate_DevNodeW(&devinst, deviceId, 0); if (CR_SUCCESS == ret) { KHR_ICD_TRACE(" devinst: %lu\n", devinst); } else { KHR_ICD_TRACE("CM_Locate_DevNode failed with 0x%"PRIxDW"\n", ret); continue; } if (ProbeDevice(devinst) != Valid) { continue; } KHR_ICD_TRACE(" Trying to look for the key in the display adapter HKR...\n"); if (ReadOpenCLKey(devinst)) { foundOpenCLKey = true; continue; } KHR_ICD_TRACE(" Could not find the key, proceeding to children software components...\n"); ret = CM_Get_Child( &devchild, devinst, 0); if (CR_SUCCESS != ret) { KHR_ICD_TRACE(" CM_Get_Child returned 0x%"PRIxDW", skipping children...\n", ret); } else { do { wchar_t deviceInstanceID[MAX_DEVICE_ID_LEN] = { 0 }; GUID guid; ULONG szGuid = sizeof(guid); KHR_ICD_TRACE(" devchild: %lu\n", devchild); ret = CM_Get_Device_IDW( devchild, deviceInstanceID, sizeof(deviceInstanceID), 0); if (CR_SUCCESS != ret) { KHR_ICD_TRACE(" CM_Get_Device_ID returned 0x%"PRIxDW", skipping device...\n", ret); continue; } else { KHR_ICD_WIDE_TRACE(L" deviceInstanceID: %ls\n", deviceInstanceID); } ret = CM_Get_DevNode_Registry_PropertyW( devchild, CM_DRP_CLASSGUID, NULL, (PBYTE)&guid, &szGuid, 0); if (CR_SUCCESS != ret) { KHR_ICD_TRACE(" CM_Get_DevNode_Registry_PropertyW returned 0x%"PRIxDW", skipping device...\n", ret); continue; } else if (!IsEqualGUID(&OCL_GUID_DEVCLASS_SOFTWARECOMPONENT, &guid)) { KHR_ICD_TRACE(" GUID does not match, skipping device...\n"); continue; } if (ProbeDevice(devchild) != Valid) { continue; } if (ReadOpenCLKey(devchild)) { foundOpenCLKey = true; break; } } while (CM_Get_Sibling(&devchild, devchild, 0) == CR_SUCCESS); } } out: free(deviceIdList); return foundOpenCLKey; } OpenCL-ICD-Loader-2025.07.22/loader/windows/icd_windows_hkr.h000066400000000000000000000014101503776305700233330ustar00rootroot00000000000000/* * Copyright (c) 2017-2019 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include #include "icd_windows.h" bool khrIcdOsVendorsEnumerateHKR(void); OpenCL-ICD-Loader-2025.07.22/scripts/000077500000000000000000000000001503776305700165405ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/scripts/.gitignore000066400000000000000000000000241503776305700205240ustar00rootroot00000000000000gen/__pycache__ *.c OpenCL-ICD-Loader-2025.07.22/scripts/README.md000066400000000000000000000032271503776305700200230ustar00rootroot00000000000000# OpenCL ICD Loader Code Generation ## Introduction In order to ease maintenance and enable faster development of related OpenCL ICD loader features, the OpenCL ICD loader API dispatch functions are generated from the OpenCL XML machine readable grammar. ## Dependencies The API dispatch functions are generated using Python [Mako Templates](https://www.makotemplates.org/). In most cases, after installing Python for your platform, Mako may be installed using: ```sh $ pip install Mako ``` ## Making Changes Most changes only require modifications to the Mako templates. Small changes modifying syntax or layout are simple and straightforward. Occasionally more complicated changes will be required, say when a new API is added that is unlike any previous API, but this should be rare. The Python script should only need to be modified if additional information needs to be propagated from the XML file into the Mako template itself. ## Generating Files Files for the OpenCL ICD loader, or the test layer, may be generated by executing the scripts `gen_loader.py`, or `gen_print_layer.py`, respectively. The script requires the `cl.xml` machine readable grammar. By default, the script searches for `cl.xml` in the current directory. The latest version of `cl.xml` may be found in the Khronos OpenCL-Docs repo [here](https://github.com/KhronosGroup/OpenCL-Docs/blob/main/xml/cl.xml). The output from the script is placed in the current directory by default, to allow easy comparisons between the generated files and the current files. After the generated files are evaluated, they should be manually copied into the source tree. These steps may be automated in the future. OpenCL-ICD-Loader-2025.07.22/scripts/gen/000077500000000000000000000000001503776305700173115ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/scripts/gen/__init__.py000066400000000000000000000105601503776305700214240ustar00rootroot00000000000000# Copyright (c) 2020 The Khronos Group Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from collections import OrderedDict from collections import namedtuple import argparse import sys import urllib import xml.etree.ElementTree as etree import urllib.request # parse_xml - Helper function to parse the XML file from a URL or local file. def parse_xml(path): file = urllib.request.urlopen(path) if path.startswith("http") else open(path, 'r') with file: tree = etree.parse(file) return tree # noneStr - returns string argument, or "" if argument is None. def noneStr(s): if s: return s return "" def parse_args(): parser = argparse.ArgumentParser() # To pull the latest registry file from GitHub, pass: # -registry "https://raw.githubusercontent.com/KhronosGroup/OpenCL-Docs/main/xml/cl.xml" parser.add_argument('-registry', action='store', default='cl.xml', help='Use specified registry file instead of cl.xml') parser.add_argument('-o', action='store', dest='directory', default='.', help='Create target and related files in specified directory') args = parser.parse_args() return args def load_spec(args): specpath = args.registry print('Parsing XML file from: ' + specpath) spec = parse_xml(specpath) return spec def get_apisigs(spec): # Generate the API function signatures dictionary: apisigs = OrderedDict() ApiSignature = namedtuple('ApiSignature', 'Name RetType Params Suffix') ApiParam = namedtuple('ApiParam', 'Type TypeEnd Name') print('Generating API signatures dictionary...') for command in spec.findall('commands/command'): suffix = noneStr(command.get('suffix')) proto = command.find('proto') ret = noneStr(proto.text) name = "" params = "" for elem in proto: if elem.tag == 'name': name = noneStr(elem.text) + noneStr(elem.tail) else: ret = ret + noneStr(elem.text) + noneStr(elem.tail) ret = ret.strip() name = name.strip() plist = [] for param in command.findall('param'): ptype = noneStr(param.text) ptypeend = "" pname = "" for elem in param: if elem.tag == 'name': pname = noneStr(elem.text) ptypeend = noneStr(elem.tail) else: ptype = ptype + noneStr(elem.text) + noneStr(elem.tail) ptype = ptype.strip() ptypeend = ptypeend.strip() pname = pname.strip() plist.append(ApiParam(ptype, ptypeend, pname)) # For an empty parameter list (for e.g. clUnloadCompiler), add a single # unnamed void parameter to make generation easier. if len(plist) == 0: plist.append(ApiParam("void", "", "")) apisigs[name] = ApiSignature(name, ret, plist, suffix) return apisigs def get_apis(spec, apisigs): # Generate the core API dictionary: coreapis = OrderedDict() print('Generating core API dictionary...') for feature in spec.findall('feature'): version = noneStr(feature.get('name')) alist = [] for function in feature.findall('require/command'): name = function.get('name') alist.append(apisigs[name]) coreapis[version] = alist # Generate the extensions API dictionary: extapis = OrderedDict() print('Generating API extensions dictionary...') for feature in spec.findall('extensions/extension'): extension = noneStr(feature.get('name')) alist = [] for function in feature.findall('require/command'): name = function.get('name') alist.append(apisigs[name]) extapis[extension] = alist return (coreapis, extapis) OpenCL-ICD-Loader-2025.07.22/scripts/gen_loader.py000066400000000000000000000031731503776305700212150ustar00rootroot00000000000000#!/usr/bin/python3 # Copyright (c) 2020 The Khronos Group Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import gen from mako.template import Template from mako.exceptions import RichTraceback if __name__ == "__main__": args = gen.parse_args() spec = gen.load_spec(args) apisigs = gen.get_apisigs(spec) (coreapis, extapis) = gen.get_apis(spec, apisigs) try: # Create the loader cpp file from the API dictionary: test = open(args.directory + '/icd_dispatch_generated.c', 'wb') icd_dispatch_generated_template = Template(filename='icd_dispatch_generated.c.mako') test.write( icd_dispatch_generated_template.render_unicode( spec=spec, apisigs=apisigs, coreapis=coreapis, extapis=extapis). encode('utf-8', 'replace')) except: traceback = RichTraceback() for (filename, lineno, function, line) in traceback.traceback: print('%s(%s) : error in %s' % (filename, lineno, function)) print(' ', line) print('%s: %s' % (str(traceback.error.__class__.__name__), traceback.error)) OpenCL-ICD-Loader-2025.07.22/scripts/gen_print_layer.py000066400000000000000000000031721503776305700222760ustar00rootroot00000000000000#!/usr/bin/python3 # Copyright (c) 2020 The Khronos Group Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import gen from mako.template import Template from mako.exceptions import RichTraceback if __name__ == "__main__": args = gen.parse_args() spec = gen.load_spec(args) apisigs = gen.get_apisigs(spec) (coreapis, extapis) = gen.get_apis(spec, apisigs) try: # Create the layer cpp file from the API dictionary: test = open(args.directory + '/icd_print_layer_generated.c', 'wb') icd_layer_generated_template = Template(filename='icd_print_layer_generated.c.mako') test.write( icd_layer_generated_template.render_unicode( spec=spec, apisigs=apisigs, coreapis=coreapis, extapis=extapis). encode('utf-8', 'replace')) except: traceback = RichTraceback() for (filename, lineno, function, line) in traceback.traceback: print('%s(%s) : error in %s' % (filename, lineno, function)) print(' ', line) print('%s: %s' % (str(traceback.error.__class__.__name__), traceback.error)) OpenCL-ICD-Loader-2025.07.22/scripts/icd_dispatch_generated.c.mako000066400000000000000000000416551503776305700243010ustar00rootroot00000000000000<% # APIs to skip - they need to be done "manually": apiskip = { 'clGetPlatformIDs', # to query platforms 'clGetExtensionFunctionAddress', # to return ICD-aware extensions 'clGetExtensionFunctionAddressForPlatform', # to return ICD-aware extensions } apiinit = { 'clCreateContextFromType', 'clGetGLContextInfoKHR', } # Handles, and mappings to errors when handles are invalid: apihandles = { 'cl_command_queue' : 'CL_INVALID_COMMAND_QUEUE', 'cl_context' : 'CL_INVALID_CONTEXT', 'cl_device_id' : 'CL_INVALID_DEVICE', 'cl_event' : 'CL_INVALID_EVENT', 'cl_kernel' : 'CL_INVALID_KERNEL', 'cl_mem' : 'CL_INVALID_MEM_OBJECT', 'cl_platform_id' : 'CL_INVALID_PLATFORM', 'cl_program' : 'CL_INVALID_PROGRAM', 'cl_sampler' : 'CL_INVALID_SAMPLER', } %>/* * Copyright (c) 2012-2023 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd.h" #include "icd_dispatch.h" #ifdef __cplusplus extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// // Core APIs: %for apis in coreapis.values(): %for api in apis: %if not api.Name in apiskip: <% handle = api.Params[0] if handle.Type in apihandles: invalid = apihandles[handle.Type] else: invalid = 'NULL' %> %for disp in [0, 1]: % if disp == 1: #if defined(CL_ENABLE_LAYERS) % endif ${("CL_API_ENTRY", "static")[disp]} ${api.RetType} CL_API_CALL ${api.Name + ("", "_disp")[disp]}( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Type} ${param.Name}${param.TypeEnd}, % else: ${param.Type} ${param.Name}${param.TypeEnd}) % endif %endfor { %if api.Name in apiinit: khrIcdInitialize(); %endif %if disp == 0: #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) % if api.Name == "clSVMFree": { khrFirstLayer->dispatch.${api.Name}( % else: return khrFirstLayer->dispatch.${api.Name}( % endif %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Name}, % else: ${param.Name}); % endif %endfor % if api.Name == "clSVMFree": } else % endif #endif // defined(CL_ENABLE_LAYERS) %endif %if api.RetType in apihandles or api.RetType == "void*": ## clCreateContext is a special case, since it calls through ## the dispatch table via the first "device": % if api.Name == "clCreateContext": if (${api.Params[1].Name} == 0 || ${api.Params[2].Name} == NULL) { KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(NULL, CL_INVALID_VALUE); } KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(${api.Params[2].Name}[0], CL_INVALID_DEVICE); ## clCreateContextFromType is a special case, since it calls ## through a platform passed via properties: % elif api.Name == "clCreateContextFromType": cl_platform_id platform = NULL; khrIcdContextPropertiesGetPlatform(properties, &platform); KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(platform, CL_INVALID_PLATFORM); ## These APIs are special cases because they return a void*, but ## do not nave an errcode_ret: % elif api.Name == "clSVMAlloc" or api.Name == "clGetExtensionFunctionAddressForPlatform": KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(${handle.Name}, NULL); % else: KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(${handle.Name}, ${invalid}); % endif %elif api.Name == "clSVMFree": ## clSVMFree has no return value or errcode_ret: if (${handle.Name} != NULL) ## clWaitForEvents is a special case, since it calls through ## the dispatch table via the first "event": %elif api.Name == "clWaitForEvents": if (${api.Params[0].Name} == 0 || ${api.Params[1].Name} == NULL) { return CL_INVALID_VALUE; } KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(${api.Params[1].Name}[0], CL_INVALID_EVENT); %elif api.Name == "clUnloadCompiler": // Nothing! %else: KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(${handle.Name}, ${invalid}); %endif %if api.Name == "clCreateContext": return KHR_ICD2_DISPATCH(${api.Params[2].Name}[0])->${api.Name}( %elif api.Name == "clWaitForEvents": return KHR_ICD2_DISPATCH(${api.Params[1].Name}[0])->${api.Name}( %elif api.Name == "clCreateContextFromType": return KHR_ICD2_DISPATCH(platform)->${api.Name}( %elif api.Name == "clSVMFree": KHR_ICD2_DISPATCH(${handle.Name})->${api.Name}( %elif api.Name == "clUnloadCompiler": return CL_SUCCESS; %else: return KHR_ICD2_DISPATCH(${handle.Name})->${api.Name}( %endif: %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Name}, % elif param.Name: # for clUnloadCompiler ${param.Name}); % endif %endfor } % if disp == 1: #endif // defined(CL_ENABLE_LAYERS) % endif /////////////////////////////////////////////////////////////////////////////// %endfor %else: #if defined(CL_ENABLE_LAYERS) extern ${api.RetType} CL_API_CALL ${api.Name + "_disp"}( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Type} ${param.Name}${param.TypeEnd}, % else: ${param.Type} ${param.Name}${param.TypeEnd}) ${api.Suffix}; % endif %endfor #endif // defined(CL_ENABLE_LAYERS) %endif %endfor %endfor <% icdextensions = [ 'cl_ext_device_fission', 'cl_khr_d3d10_sharing', 'cl_khr_d3d11_sharing', 'cl_khr_dx9_media_sharing', 'cl_khr_egl_event', 'cl_khr_egl_image', 'cl_khr_gl_event', 'cl_khr_gl_sharing', 'cl_khr_subgroups' ] win32extensions = { 'cl_khr_d3d10_sharing', 'cl_khr_d3d11_sharing', 'cl_khr_dx9_media_sharing', } %> %for extension in icdextensions: <% apis = extapis[extension] %>// ${extension} %if extension in win32extensions: #if defined(_WIN32) %endif %for api in apis: <% handle = api.Params[0] if handle.Type in apihandles: invalid = apihandles[handle.Type] else: invalid = 'NULL' %> %for disp in [0, 1]: % if disp == 1: #if defined(CL_ENABLE_LAYERS) % endif ${("CL_API_ENTRY", "static")[disp]} ${api.RetType} CL_API_CALL ${api.Name + ("", "_disp")[disp]}( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Type} ${param.Name}${param.TypeEnd}, % else: ${param.Type} ${param.Name}${param.TypeEnd}) % endif %endfor { %if disp == 0: #if defined(CL_ENABLE_LAYERS) if (khrFirstLayer) return khrFirstLayer->dispatch.${api.Name}( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Name}, % else: ${param.Name}); % endif %endfor #endif // defined(CL_ENABLE_LAYERS) %endif %if api.RetType in apihandles or api.RetType == "void*": % if False: // api.Name == "clXXX": # There are currently no API special cases here. % else: KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(${handle.Name}, ${invalid}); KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(KHR_ICD2_DISPATCH(${handle.Name})->${api.Name}); % endif %else: % if api.Name == "clGetGLContextInfoKHR": cl_platform_id platform = NULL; khrIcdContextPropertiesGetPlatform(properties, &platform); KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(platform)->${api.Name}); % else: KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(${handle.Name}, ${invalid}); KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(KHR_ICD2_DISPATCH(${handle.Name})->${api.Name}); % endif %endif %if api.Name == "clGetGLContextInfoKHR": return KHR_ICD2_DISPATCH(platform)->${api.Name}( %else: return KHR_ICD2_DISPATCH(${handle.Name})->${api.Name}( %endif %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Name}, % elif param.Name: # for clUnloadCompiler ${param.Name}); % endif %endfor } % if disp == 1: #endif // defined(CL_ENABLE_LAYERS) % endif %endfor %endfor %if extension in win32extensions: #endif // defined(_WIN32) %endif /////////////////////////////////////////////////////////////////////////////// %endfor #if defined(CL_ENABLE_LAYERS) struct _cl_icd_dispatch khrMasterDispatch = { {&clGetPlatformIDs_disp}, &clGetPlatformInfo_disp, &clGetDeviceIDs_disp, &clGetDeviceInfo_disp, &clCreateContext_disp, &clCreateContextFromType_disp, &clRetainContext_disp, &clReleaseContext_disp, &clGetContextInfo_disp, &clCreateCommandQueue_disp, &clRetainCommandQueue_disp, &clReleaseCommandQueue_disp, &clGetCommandQueueInfo_disp, &clSetCommandQueueProperty_disp, &clCreateBuffer_disp, &clCreateImage2D_disp, &clCreateImage3D_disp, &clRetainMemObject_disp, &clReleaseMemObject_disp, &clGetSupportedImageFormats_disp, &clGetMemObjectInfo_disp, &clGetImageInfo_disp, &clCreateSampler_disp, &clRetainSampler_disp, &clReleaseSampler_disp, &clGetSamplerInfo_disp, &clCreateProgramWithSource_disp, &clCreateProgramWithBinary_disp, &clRetainProgram_disp, &clReleaseProgram_disp, &clBuildProgram_disp, {&clUnloadCompiler_disp}, &clGetProgramInfo_disp, &clGetProgramBuildInfo_disp, &clCreateKernel_disp, &clCreateKernelsInProgram_disp, &clRetainKernel_disp, &clReleaseKernel_disp, &clSetKernelArg_disp, &clGetKernelInfo_disp, &clGetKernelWorkGroupInfo_disp, &clWaitForEvents_disp, &clGetEventInfo_disp, &clRetainEvent_disp, &clReleaseEvent_disp, &clGetEventProfilingInfo_disp, &clFlush_disp, &clFinish_disp, &clEnqueueReadBuffer_disp, &clEnqueueWriteBuffer_disp, &clEnqueueCopyBuffer_disp, &clEnqueueReadImage_disp, &clEnqueueWriteImage_disp, &clEnqueueCopyImage_disp, &clEnqueueCopyImageToBuffer_disp, &clEnqueueCopyBufferToImage_disp, &clEnqueueMapBuffer_disp, &clEnqueueMapImage_disp, &clEnqueueUnmapMemObject_disp, &clEnqueueNDRangeKernel_disp, &clEnqueueTask_disp, &clEnqueueNativeKernel_disp, &clEnqueueMarker_disp, &clEnqueueWaitForEvents_disp, &clEnqueueBarrier_disp, &clGetExtensionFunctionAddress_disp, &clCreateFromGLBuffer_disp, &clCreateFromGLTexture2D_disp, &clCreateFromGLTexture3D_disp, &clCreateFromGLRenderbuffer_disp, &clGetGLObjectInfo_disp, &clGetGLTextureInfo_disp, &clEnqueueAcquireGLObjects_disp, &clEnqueueReleaseGLObjects_disp, &clGetGLContextInfoKHR_disp, /* cl_khr_d3d10_sharing */ #if defined(_WIN32) &clGetDeviceIDsFromD3D10KHR_disp, &clCreateFromD3D10BufferKHR_disp, &clCreateFromD3D10Texture2DKHR_disp, &clCreateFromD3D10Texture3DKHR_disp, &clEnqueueAcquireD3D10ObjectsKHR_disp, &clEnqueueReleaseD3D10ObjectsKHR_disp, #else NULL, NULL, NULL, NULL, NULL, NULL, #endif /* OpenCL 1.1 */ &clSetEventCallback_disp, &clCreateSubBuffer_disp, &clSetMemObjectDestructorCallback_disp, &clCreateUserEvent_disp, &clSetUserEventStatus_disp, &clEnqueueReadBufferRect_disp, &clEnqueueWriteBufferRect_disp, &clEnqueueCopyBufferRect_disp, /* cl_ext_device_fission */ &clCreateSubDevicesEXT_disp, &clRetainDeviceEXT_disp, &clReleaseDeviceEXT_disp, /* cl_khr_gl_event */ &clCreateEventFromGLsyncKHR_disp, /* OpenCL 1.2 */ &clCreateSubDevices_disp, &clRetainDevice_disp, &clReleaseDevice_disp, &clCreateImage_disp, &clCreateProgramWithBuiltInKernels_disp, &clCompileProgram_disp, &clLinkProgram_disp, &clUnloadPlatformCompiler_disp, &clGetKernelArgInfo_disp, &clEnqueueFillBuffer_disp, &clEnqueueFillImage_disp, &clEnqueueMigrateMemObjects_disp, &clEnqueueMarkerWithWaitList_disp, &clEnqueueBarrierWithWaitList_disp, &clGetExtensionFunctionAddressForPlatform_disp, &clCreateFromGLTexture_disp, /* cl_khr_d3d11_sharing */ #if defined(_WIN32) &clGetDeviceIDsFromD3D11KHR_disp, &clCreateFromD3D11BufferKHR_disp, &clCreateFromD3D11Texture2DKHR_disp, &clCreateFromD3D11Texture3DKHR_disp, &clCreateFromDX9MediaSurfaceKHR_disp, &clEnqueueAcquireD3D11ObjectsKHR_disp, &clEnqueueReleaseD3D11ObjectsKHR_disp, #else NULL, NULL, NULL, NULL, NULL, NULL, NULL, #endif /* cl_khr_dx9_media_sharing */ #if defined(_WIN32) &clGetDeviceIDsFromDX9MediaAdapterKHR_disp, &clEnqueueAcquireDX9MediaSurfacesKHR_disp, &clEnqueueReleaseDX9MediaSurfacesKHR_disp, #else NULL, NULL, NULL, #endif /* cl_khr_egl_image */ &clCreateFromEGLImageKHR_disp, &clEnqueueAcquireEGLObjectsKHR_disp, &clEnqueueReleaseEGLObjectsKHR_disp, /* cl_khr_egl_event */ &clCreateEventFromEGLSyncKHR_disp, /* OpenCL 2.0 */ &clCreateCommandQueueWithProperties_disp, &clCreatePipe_disp, &clGetPipeInfo_disp, &clSVMAlloc_disp, &clSVMFree_disp, &clEnqueueSVMFree_disp, &clEnqueueSVMMemcpy_disp, &clEnqueueSVMMemFill_disp, &clEnqueueSVMMap_disp, &clEnqueueSVMUnmap_disp, &clCreateSamplerWithProperties_disp, &clSetKernelArgSVMPointer_disp, &clSetKernelExecInfo_disp, /* cl_khr_sub_groups */ &clGetKernelSubGroupInfoKHR_disp, /* OpenCL 2.1 */ &clCloneKernel_disp, &clCreateProgramWithIL_disp, &clEnqueueSVMMigrateMem_disp, &clGetDeviceAndHostTimer_disp, &clGetHostTimer_disp, &clGetKernelSubGroupInfo_disp, &clSetDefaultDeviceCommandQueue_disp, /* OpenCL 2.2 */ &clSetProgramReleaseCallback_disp, &clSetProgramSpecializationConstant_disp, /* OpenCL 3.0 */ &clCreateBufferWithProperties_disp, &clCreateImageWithProperties_disp, &clSetContextDestructorCallback_disp }; #endif // defined(CL_ENABLE_LAYERS) #if defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) /////////////////////////////////////////////////////////////////////////////// // Core APIs: %for apis in coreapis.values(): %for api in apis: static ${api.RetType} CL_API_CALL ${api.Name}_unsupp( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Type} ${param.Name}${param.TypeEnd}, % else: ${param.Type} ${param.Name}${param.TypeEnd}) % endif %endfor { %for param in api.Params: % if param.Name: (void)${param.Name}; % endif %endfor %if api.Name == "clSVMAlloc" or api.Name == "clGetExtensionFunctionAddressForPlatform" or api.Name == "clGetExtensionFunctionAddress": KHR_ICD_ERROR_RETURN_ERROR(NULL); %elif api.Name == "clSVMFree": return; %elif api.RetType in apihandles or api.RetType == "void*": KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); %else: KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); %endif } %endfor %endfor /////////////////////////////////////////////////////////////////////////////// %for extension in icdextensions: <% apis = extapis[extension] %>// ${extension} %if extension in win32extensions: #if defined(_WIN32) %endif %for api in apis: static ${api.RetType} CL_API_CALL ${api.Name}_unsupp( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Type} ${param.Name}${param.TypeEnd}, % else: ${param.Type} ${param.Name}${param.TypeEnd}) % endif %endfor { %for param in api.Params: % if param.Name: (void)${param.Name}; % endif %endfor %if api.RetType in apihandles or api.RetType == "void*": KHR_ICD_ERROR_RETURN_HANDLE(CL_INVALID_OPERATION); %else: KHR_ICD_ERROR_RETURN_ERROR(CL_INVALID_OPERATION); %endif } %endfor %if extension in win32extensions: #endif // defined(_WIN32) %endif /////////////////////////////////////////////////////////////////////////////// %endfor void khrIcd2PopulateDispatchTable( cl_platform_id platform, clIcdGetFunctionAddressForPlatformKHR_fn p_clIcdGetFunctionAddressForPlatform, struct _cl_icd_dispatch* dispatch) { /////////////////////////////////////////////////////////////////////////////// // Core APIs: %for apis in coreapis.values(): %for api in apis: dispatch->${api.Name} = (${api.Name}_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "${api.Name}"); if (!dispatch->${api.Name}) dispatch->${api.Name} = &${api.Name}_unsupp; %endfor %endfor /////////////////////////////////////////////////////////////////////////////// %for extension in icdextensions: <% apis = extapis[extension] %>// ${extension} %if extension in win32extensions: #if defined(_WIN32) %endif %for api in apis: dispatch->${api.Name} = (${api.Name}_t *)(size_t)p_clIcdGetFunctionAddressForPlatform(platform, "${api.Name}"); if (!dispatch->${api.Name}) dispatch->${api.Name} = &${api.Name}_unsupp; %endfor %if extension in win32extensions: #endif // defined(_WIN32) %endif /////////////////////////////////////////////////////////////////////////////// %endfor } #endif // defined(CL_ENABLE_LOADER_MANAGED_DISPATCH) #ifdef __cplusplus } #endif OpenCL-ICD-Loader-2025.07.22/scripts/icd_print_layer_generated.c.mako000066400000000000000000000327501503776305700250260ustar00rootroot00000000000000/* * Copyright (c) 2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd_print_layer.h" /////////////////////////////////////////////////////////////////////////////// // Core APIs: %for apis in coreapis.values(): %for api in apis: static ${api.RetType} CL_API_CALL ${api.Name + "_wrap"}( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Type} ${param.Name}${param.TypeEnd}, % else: ${param.Type} ${param.Name}${param.TypeEnd}) ${api.Suffix} % endif %endfor { printf("${api.Name}\n"); % if api.Name == "clSVMFree": tdispatch->${api.Name}( % else: return tdispatch->${api.Name}( % endif %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Name}, % else: ${param.Name}); % endif %endfor } /////////////////////////////////////////////////////////////////////////////// %endfor %endfor <% icdextensions = [ 'cl_ext_device_fission', 'cl_khr_d3d10_sharing', 'cl_khr_d3d11_sharing', 'cl_khr_dx9_media_sharing', 'cl_khr_egl_event', 'cl_khr_egl_image', 'cl_khr_gl_event', 'cl_khr_gl_sharing', 'cl_khr_subgroups' ] win32extensions = { 'cl_khr_d3d10_sharing', 'cl_khr_d3d11_sharing', 'cl_khr_dx9_media_sharing', } %> %for extension in icdextensions: <% apis = extapis[extension] %>// ${extension} %if extension in win32extensions: #if defined(_WIN32) %endif %for api in apis: static ${api.RetType} CL_API_CALL ${api.Name + "_wrap"}( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Type} ${param.Name}${param.TypeEnd}, % else: ${param.Type} ${param.Name}${param.TypeEnd}) ${api.Suffix} % endif %endfor { printf("${api.Name}\n"); return tdispatch->${api.Name}( %for i, param in enumerate(api.Params): % if i < len(api.Params)-1: ${param.Name}, % else: ${param.Name}); % endif %endfor } %endfor %if extension in win32extensions: #endif // defined(_WIN32) %endif /////////////////////////////////////////////////////////////////////////////// %endfor void _init_dispatch(void) { dispatch.clGetPlatformIDs = &clGetPlatformIDs_wrap; dispatch.clGetPlatformInfo = &clGetPlatformInfo_wrap; dispatch.clGetDeviceIDs = &clGetDeviceIDs_wrap; dispatch.clGetDeviceInfo = &clGetDeviceInfo_wrap; dispatch.clCreateContext = &clCreateContext_wrap; dispatch.clCreateContextFromType = &clCreateContextFromType_wrap; dispatch.clRetainContext = &clRetainContext_wrap; dispatch.clReleaseContext = &clReleaseContext_wrap; dispatch.clGetContextInfo = &clGetContextInfo_wrap; dispatch.clCreateCommandQueue = &clCreateCommandQueue_wrap; dispatch.clRetainCommandQueue = &clRetainCommandQueue_wrap; dispatch.clReleaseCommandQueue = &clReleaseCommandQueue_wrap; dispatch.clGetCommandQueueInfo = &clGetCommandQueueInfo_wrap; dispatch.clSetCommandQueueProperty = &clSetCommandQueueProperty_wrap; dispatch.clCreateBuffer = &clCreateBuffer_wrap; dispatch.clCreateImage2D = &clCreateImage2D_wrap; dispatch.clCreateImage3D = &clCreateImage3D_wrap; dispatch.clRetainMemObject = &clRetainMemObject_wrap; dispatch.clReleaseMemObject = &clReleaseMemObject_wrap; dispatch.clGetSupportedImageFormats = &clGetSupportedImageFormats_wrap; dispatch.clGetMemObjectInfo = &clGetMemObjectInfo_wrap; dispatch.clGetImageInfo = &clGetImageInfo_wrap; dispatch.clCreateSampler = &clCreateSampler_wrap; dispatch.clRetainSampler = &clRetainSampler_wrap; dispatch.clReleaseSampler = &clReleaseSampler_wrap; dispatch.clGetSamplerInfo = &clGetSamplerInfo_wrap; dispatch.clCreateProgramWithSource = &clCreateProgramWithSource_wrap; dispatch.clCreateProgramWithBinary = &clCreateProgramWithBinary_wrap; dispatch.clRetainProgram = &clRetainProgram_wrap; dispatch.clReleaseProgram = &clReleaseProgram_wrap; dispatch.clBuildProgram = &clBuildProgram_wrap; dispatch.clUnloadCompiler = &clUnloadCompiler_wrap; dispatch.clGetProgramInfo = &clGetProgramInfo_wrap; dispatch.clGetProgramBuildInfo = &clGetProgramBuildInfo_wrap; dispatch.clCreateKernel = &clCreateKernel_wrap; dispatch.clCreateKernelsInProgram = &clCreateKernelsInProgram_wrap; dispatch.clRetainKernel = &clRetainKernel_wrap; dispatch.clReleaseKernel = &clReleaseKernel_wrap; dispatch.clSetKernelArg = &clSetKernelArg_wrap; dispatch.clGetKernelInfo = &clGetKernelInfo_wrap; dispatch.clGetKernelWorkGroupInfo = &clGetKernelWorkGroupInfo_wrap; dispatch.clWaitForEvents = &clWaitForEvents_wrap; dispatch.clGetEventInfo = &clGetEventInfo_wrap; dispatch.clRetainEvent = &clRetainEvent_wrap; dispatch.clReleaseEvent = &clReleaseEvent_wrap; dispatch.clGetEventProfilingInfo = &clGetEventProfilingInfo_wrap; dispatch.clFlush = &clFlush_wrap; dispatch.clFinish = &clFinish_wrap; dispatch.clEnqueueReadBuffer = &clEnqueueReadBuffer_wrap; dispatch.clEnqueueWriteBuffer = &clEnqueueWriteBuffer_wrap; dispatch.clEnqueueCopyBuffer = &clEnqueueCopyBuffer_wrap; dispatch.clEnqueueReadImage = &clEnqueueReadImage_wrap; dispatch.clEnqueueWriteImage = &clEnqueueWriteImage_wrap; dispatch.clEnqueueCopyImage = &clEnqueueCopyImage_wrap; dispatch.clEnqueueCopyImageToBuffer = &clEnqueueCopyImageToBuffer_wrap; dispatch.clEnqueueCopyBufferToImage = &clEnqueueCopyBufferToImage_wrap; dispatch.clEnqueueMapBuffer = &clEnqueueMapBuffer_wrap; dispatch.clEnqueueMapImage = &clEnqueueMapImage_wrap; dispatch.clEnqueueUnmapMemObject = &clEnqueueUnmapMemObject_wrap; dispatch.clEnqueueNDRangeKernel = &clEnqueueNDRangeKernel_wrap; dispatch.clEnqueueTask = &clEnqueueTask_wrap; dispatch.clEnqueueNativeKernel = &clEnqueueNativeKernel_wrap; dispatch.clEnqueueMarker = &clEnqueueMarker_wrap; dispatch.clEnqueueWaitForEvents = &clEnqueueWaitForEvents_wrap; dispatch.clEnqueueBarrier = &clEnqueueBarrier_wrap; dispatch.clGetExtensionFunctionAddress = &clGetExtensionFunctionAddress_wrap; dispatch.clCreateFromGLBuffer = &clCreateFromGLBuffer_wrap; dispatch.clCreateFromGLTexture2D = &clCreateFromGLTexture2D_wrap; dispatch.clCreateFromGLTexture3D = &clCreateFromGLTexture3D_wrap; dispatch.clCreateFromGLRenderbuffer = &clCreateFromGLRenderbuffer_wrap; dispatch.clGetGLObjectInfo = &clGetGLObjectInfo_wrap; dispatch.clGetGLTextureInfo = &clGetGLTextureInfo_wrap; dispatch.clEnqueueAcquireGLObjects = &clEnqueueAcquireGLObjects_wrap; dispatch.clEnqueueReleaseGLObjects = &clEnqueueReleaseGLObjects_wrap; dispatch.clGetGLContextInfoKHR = &clGetGLContextInfoKHR_wrap; /* cl_khr_d3d10_sharing */ #if defined(_WIN32) dispatch.clGetDeviceIDsFromD3D10KHR = &clGetDeviceIDsFromD3D10KHR_wrap; dispatch.clCreateFromD3D10BufferKHR = &clCreateFromD3D10BufferKHR_wrap; dispatch.clCreateFromD3D10Texture2DKHR = &clCreateFromD3D10Texture2DKHR_wrap; dispatch.clCreateFromD3D10Texture3DKHR = &clCreateFromD3D10Texture3DKHR_wrap; dispatch.clEnqueueAcquireD3D10ObjectsKHR = &clEnqueueAcquireD3D10ObjectsKHR_wrap; dispatch.clEnqueueReleaseD3D10ObjectsKHR = &clEnqueueReleaseD3D10ObjectsKHR_wrap; #else dispatch.clGetDeviceIDsFromD3D10KHR = NULL; dispatch.clCreateFromD3D10BufferKHR = NULL; dispatch.clCreateFromD3D10Texture2DKHR = NULL; dispatch.clCreateFromD3D10Texture3DKHR = NULL; dispatch.clEnqueueAcquireD3D10ObjectsKHR = NULL; dispatch.clEnqueueReleaseD3D10ObjectsKHR = NULL; #endif /* OpenCL 1.1 */ dispatch.clSetEventCallback = &clSetEventCallback_wrap; dispatch.clCreateSubBuffer = &clCreateSubBuffer_wrap; dispatch.clSetMemObjectDestructorCallback = &clSetMemObjectDestructorCallback_wrap; dispatch.clCreateUserEvent = &clCreateUserEvent_wrap; dispatch.clSetUserEventStatus = &clSetUserEventStatus_wrap; dispatch.clEnqueueReadBufferRect = &clEnqueueReadBufferRect_wrap; dispatch.clEnqueueWriteBufferRect = &clEnqueueWriteBufferRect_wrap; dispatch.clEnqueueCopyBufferRect = &clEnqueueCopyBufferRect_wrap; /* cl_ext_device_fission */ dispatch.clCreateSubDevicesEXT = &clCreateSubDevicesEXT_wrap; dispatch.clRetainDeviceEXT = &clRetainDeviceEXT_wrap; dispatch.clReleaseDeviceEXT = &clReleaseDeviceEXT_wrap; /* cl_khr_gl_event */ dispatch.clCreateEventFromGLsyncKHR = &clCreateEventFromGLsyncKHR_wrap; /* OpenCL 1.2 */ dispatch.clCreateSubDevices = &clCreateSubDevices_wrap; dispatch.clRetainDevice = &clRetainDevice_wrap; dispatch.clReleaseDevice = &clReleaseDevice_wrap; dispatch.clCreateImage = &clCreateImage_wrap; dispatch.clCreateProgramWithBuiltInKernels = &clCreateProgramWithBuiltInKernels_wrap; dispatch.clCompileProgram = &clCompileProgram_wrap; dispatch.clLinkProgram = &clLinkProgram_wrap; dispatch.clUnloadPlatformCompiler = &clUnloadPlatformCompiler_wrap; dispatch.clGetKernelArgInfo = &clGetKernelArgInfo_wrap; dispatch.clEnqueueFillBuffer = &clEnqueueFillBuffer_wrap; dispatch.clEnqueueFillImage = &clEnqueueFillImage_wrap; dispatch.clEnqueueMigrateMemObjects = &clEnqueueMigrateMemObjects_wrap; dispatch.clEnqueueMarkerWithWaitList = &clEnqueueMarkerWithWaitList_wrap; dispatch.clEnqueueBarrierWithWaitList = &clEnqueueBarrierWithWaitList_wrap; dispatch.clGetExtensionFunctionAddressForPlatform = &clGetExtensionFunctionAddressForPlatform_wrap; dispatch.clCreateFromGLTexture = &clCreateFromGLTexture_wrap; /* cl_khr_d3d11_sharing */ #if defined(_WIN32) dispatch.clGetDeviceIDsFromD3D11KHR = &clGetDeviceIDsFromD3D11KHR_wrap; dispatch.clCreateFromD3D11BufferKHR = &clCreateFromD3D11BufferKHR_wrap; dispatch.clCreateFromD3D11Texture2DKHR = &clCreateFromD3D11Texture2DKHR_wrap; dispatch.clCreateFromD3D11Texture3DKHR = &clCreateFromD3D11Texture3DKHR_wrap; dispatch.clCreateFromDX9MediaSurfaceKHR = &clCreateFromDX9MediaSurfaceKHR_wrap; dispatch.clEnqueueAcquireD3D11ObjectsKHR = &clEnqueueAcquireD3D11ObjectsKHR_wrap; dispatch.clEnqueueReleaseD3D11ObjectsKHR = &clEnqueueReleaseD3D11ObjectsKHR_wrap; #else dispatch.clGetDeviceIDsFromD3D11KHR = NULL; dispatch.clCreateFromD3D11BufferKHR = NULL; dispatch.clCreateFromD3D11Texture2DKHR = NULL; dispatch.clCreateFromD3D11Texture3DKHR = NULL; dispatch.clCreateFromDX9MediaSurfaceKHR = NULL; dispatch.clEnqueueAcquireD3D11ObjectsKHR = NULL; dispatch.clEnqueueReleaseD3D11ObjectsKHR = NULL; #endif /* cl_khr_dx9_media_sharing */ #if defined(_WIN32) dispatch.clGetDeviceIDsFromDX9MediaAdapterKHR = &clGetDeviceIDsFromDX9MediaAdapterKHR_wrap; dispatch.clEnqueueAcquireDX9MediaSurfacesKHR = &clEnqueueAcquireDX9MediaSurfacesKHR_wrap; dispatch.clEnqueueReleaseDX9MediaSurfacesKHR = &clEnqueueReleaseDX9MediaSurfacesKHR_wrap; #else dispatch.clGetDeviceIDsFromDX9MediaAdapterKHR = NULL; dispatch.clEnqueueAcquireDX9MediaSurfacesKHR = NULL; dispatch.clEnqueueReleaseDX9MediaSurfacesKHR = NULL; #endif /* cl_khr_egl_image */ dispatch.clCreateFromEGLImageKHR = &clCreateFromEGLImageKHR_wrap; dispatch.clEnqueueAcquireEGLObjectsKHR = &clEnqueueAcquireEGLObjectsKHR_wrap; dispatch.clEnqueueReleaseEGLObjectsKHR = &clEnqueueReleaseEGLObjectsKHR_wrap; /* cl_khr_egl_event */ dispatch.clCreateEventFromEGLSyncKHR = &clCreateEventFromEGLSyncKHR_wrap; /* OpenCL 2.0 */ dispatch.clCreateCommandQueueWithProperties = &clCreateCommandQueueWithProperties_wrap; dispatch.clCreatePipe = &clCreatePipe_wrap; dispatch.clGetPipeInfo = &clGetPipeInfo_wrap; dispatch.clSVMAlloc = &clSVMAlloc_wrap; dispatch.clSVMFree = &clSVMFree_wrap; dispatch.clEnqueueSVMFree = &clEnqueueSVMFree_wrap; dispatch.clEnqueueSVMMemcpy = &clEnqueueSVMMemcpy_wrap; dispatch.clEnqueueSVMMemFill = &clEnqueueSVMMemFill_wrap; dispatch.clEnqueueSVMMap = &clEnqueueSVMMap_wrap; dispatch.clEnqueueSVMUnmap = &clEnqueueSVMUnmap_wrap; dispatch.clCreateSamplerWithProperties = &clCreateSamplerWithProperties_wrap; dispatch.clSetKernelArgSVMPointer = &clSetKernelArgSVMPointer_wrap; dispatch.clSetKernelExecInfo = &clSetKernelExecInfo_wrap; /* cl_khr_sub_groups */ dispatch.clGetKernelSubGroupInfoKHR = &clGetKernelSubGroupInfoKHR_wrap; /* OpenCL 2.1 */ dispatch.clCloneKernel = &clCloneKernel_wrap; dispatch.clCreateProgramWithIL = &clCreateProgramWithIL_wrap; dispatch.clEnqueueSVMMigrateMem = &clEnqueueSVMMigrateMem_wrap; dispatch.clGetDeviceAndHostTimer = &clGetDeviceAndHostTimer_wrap; dispatch.clGetHostTimer = &clGetHostTimer_wrap; dispatch.clGetKernelSubGroupInfo = &clGetKernelSubGroupInfo_wrap; dispatch.clSetDefaultDeviceCommandQueue = &clSetDefaultDeviceCommandQueue_wrap; /* OpenCL 2.2 */ dispatch.clSetProgramReleaseCallback = &clSetProgramReleaseCallback_wrap; dispatch.clSetProgramSpecializationConstant = &clSetProgramSpecializationConstant_wrap; /* OpenCL 3.0 */ dispatch.clCreateBufferWithProperties = &clCreateBufferWithProperties_wrap; dispatch.clCreateImageWithProperties = &clCreateImageWithProperties_wrap; dispatch.clSetContextDestructorCallback = &clSetContextDestructorCallback_wrap; } OpenCL-ICD-Loader-2025.07.22/test/000077500000000000000000000000001503776305700160305ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/CMakeLists.txt000066400000000000000000000033251503776305700205730ustar00rootroot00000000000000include_directories (./inc) add_subdirectory (log) add_subdirectory (driver_stub) add_subdirectory (loader_test) if (ENABLE_OPENCL_LAYERS) add_subdirectory (layer) endif () set_target_properties (IcdLog OpenCLDriverStub OpenCLDriverStubICD2 icd_loader_test PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) add_test ( NAME opencl_icd_loader_test COMMAND icd_loader_test ) add_test ( NAME opencl_icd_loader_icd2_test COMMAND icd_loader_test ) if (ENABLE_OPENCL_LAYERINFO) add_test ( NAME cllayerinfo_test COMMAND cllayerinfo ) endif () get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if (GENERATOR_IS_MULTI_CONFIG) set (TEST_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/$") else () set (TEST_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") endif() set_tests_properties(opencl_icd_loader_test PROPERTIES ENVIRONMENT OCL_ICD_FILENAMES=$ WORKING_DIRECTORY "${TEST_WORKING_DIRECTORY}" ) set_tests_properties(opencl_icd_loader_icd2_test PROPERTIES ENVIRONMENT "OCL_ICD_FILENAMES=$;APP_LOG_FILE=icd_test_app_log_icd2.txt;APP_STUB_FILE=icd_test_stub_log_icd2.txt;APP_PLATFORM=ICD_LOADER_TEST_OPENCL_STUB_ICD2" WORKING_DIRECTORY "${TEST_WORKING_DIRECTORY}" ) if (ENABLE_OPENCL_LAYERINFO) set_tests_properties(cllayerinfo_test PROPERTIES ENVIRONMENT OPENCL_LAYERS=$ WORKING_DIRECTORY "${TEST_WORKING_DIRECTORY}" ) endif() OpenCL-ICD-Loader-2025.07.22/test/driver_stub/000077500000000000000000000000001503776305700203605ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/driver_stub/CMakeLists.txt000066400000000000000000000015141503776305700231210ustar00rootroot00000000000000 set (OPENCL_DRIVER_STUB_SOURCES cl.c cl_ext.c cl_gl.c icd.c) if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") list (APPEND OPENCL_DRIVER_STUB_SOURCES driver_stub.def) endif () add_library (OpenCLDriverStub SHARED ${OPENCL_DRIVER_STUB_SOURCES}) target_link_libraries (OpenCLDriverStub IcdLog OpenCL::Headers) target_compile_definitions (OpenCLDriverStub PRIVATE CL_TARGET_OPENCL_VERSION=300) set (OPENCL_DRIVER_STUB_ICD2_SOURCES cl.c cl_ext.c cl_gl.c icd.c) if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") list (APPEND OPENCL_DRIVER_STUB_ICD2_SOURCES driver_stub.def) endif () add_library (OpenCLDriverStubICD2 SHARED ${OPENCL_DRIVER_STUB_ICD2_SOURCES}) target_link_libraries (OpenCLDriverStubICD2 IcdLog OpenCL::Headers) target_compile_definitions (OpenCLDriverStubICD2 PRIVATE CL_TARGET_OPENCL_VERSION=300 CL_ENABLE_ICD2=1) OpenCL-ICD-Loader-2025.07.22/test/driver_stub/cl.c000066400000000000000000002164761503776305700211420ustar00rootroot00000000000000#include #include #include #ifndef CL_USE_DEPRECATED_OPENCL_1_0_APIS #define CL_USE_DEPRECATED_OPENCL_1_0_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_1_1_APIS #define CL_USE_DEPRECATED_OPENCL_1_1_APIS #endif // Need to rename all CL API functions to prevent ICD loader functions calling // themselves via the dispatch table. Include this before cl headers. #include "rename_api.h" #include #include #include "icd_structs.h" #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 CL_API_ENTRY cl_int CL_API_CALL clIcdGetPlatformIDsKHR(cl_uint, cl_platform_id *, cl_uint *); struct _cl_platform_id { CL_OBJECT_BODY; const char *profile; const char *version; const char *name; const char *vendor; const char *extensions; const char *suffix; }; struct _cl_device_id { CL_OBJECT_BODY; }; struct _cl_context { CL_OBJECT_BODY; }; struct _cl_command_queue { CL_OBJECT_BODY; }; struct _cl_mem { CL_OBJECT_BODY; }; struct _cl_program { CL_OBJECT_BODY; }; struct _cl_kernel { CL_OBJECT_BODY; }; struct _cl_event { CL_OBJECT_BODY; }; struct _cl_sampler { CL_OBJECT_BODY; }; static CLIicdDispatchTable* dispatchTable = NULL; static cl_platform_id platform = NULL; static cl_bool initialized = CL_FALSE; CL_API_ENTRY cl_int CL_API_CALL clGetPlatformIDs(cl_uint num_entries , cl_platform_id * platforms , cl_uint * num_platforms) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetPlatformIDs(%u, %p, %p)\n", num_entries, platforms, num_platforms); return_value = clIcdGetPlatformIDsKHR(num_entries, platforms, num_platforms); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetPlatformInfo(cl_platform_id platform_id, cl_platform_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int ret = CL_SUCCESS; const char *returnString = NULL; size_t returnStringLength = 0; /*test_icd_stub_log("clGetPlatformInfo(%p, %u, %u, %p, %p)\n", platform, param_name, param_value_size, param_value, param_value_size_ret);*/ // validate the arguments if (param_value_size == 0 && param_value != NULL) { ret = CL_INVALID_VALUE; goto done; } // select the string to return switch(param_name) { case CL_PLATFORM_PROFILE: returnString = platform_id->profile; break; case CL_PLATFORM_VERSION: returnString = platform_id->version; break; case CL_PLATFORM_NAME: returnString = platform_id->name; break; case CL_PLATFORM_VENDOR: returnString = platform_id->vendor; break; case CL_PLATFORM_EXTENSIONS: returnString = platform_id->extensions; break; case CL_PLATFORM_ICD_SUFFIX_KHR: returnString = platform_id->suffix; break; default: ret = CL_INVALID_VALUE; goto done; } // make sure the buffer passed in is big enough for the result returnStringLength = strlen(returnString)+1; if (param_value_size && param_value_size < returnStringLength) { ret = CL_INVALID_VALUE; goto done; } // pass the data back to the user if (param_value) { memcpy(param_value, returnString, returnStringLength); } if (param_value_size_ret) { *param_value_size_ret = returnStringLength; } done: /*test_icd_stub_log("Value returned: %d\n", return_value);*/ return ret; } /* Device APIs */ CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDs( cl_platform_id platform_id, cl_device_type device_type, cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_0 { cl_int ret = CL_SUCCESS; if ((num_entries > 1) && devices != NULL) { ret = CL_INVALID_VALUE; goto done; } if (devices != NULL) { cl_device_id obj = (cl_device_id) malloc(sizeof(struct _cl_device_id)); CL_INIT_OBJECT(obj, platform); devices[0] = obj; } if (num_devices) { *num_devices = 1; } done: test_icd_stub_log("clGetDeviceIDs(%p, %x, %u, %p, %p)\n", platform_id, device_type, num_entries, devices, num_devices); test_icd_stub_log("Value returned: %d\n", ret); return ret; } CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfo(cl_device_id device, cl_device_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetDeviceInfo(%p, %u, %u, %p, %p)\n", device, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clCreateSubDevices(cl_device_id in_device, const cl_device_partition_property *properties, cl_uint num_entries, cl_device_id *out_devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clCreateSubDevices(%p, %p, %u, %p, %p)\n", in_device, properties, num_entries, out_devices, num_devices); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clRetainDevice(cl_device_id device) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clRetainDevice(%p)\n", device); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clReleaseDevice(cl_device_id device) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clReleaseDevice(%p)\n", device); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Context APIs */ CL_API_ENTRY cl_context CL_API_CALL clCreateContext(const cl_context_properties * properties, cl_uint num_devices , const cl_device_id * devices, void (CL_CALLBACK * pfn_notify)(const char *, const void *, size_t, void *), void * user_data, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_context obj = (cl_context) malloc(sizeof(struct _cl_context)); CL_INIT_OBJECT(obj, devices[0]); test_icd_stub_log("clCreateContext(%p, %u, %p, %p, %p, %p)\n", properties, num_devices, devices, pfn_notify, user_data, errcode_ret); pfn_notify(NULL, NULL, 0, NULL); test_icd_stub_log("createcontext_callback(%p, %p, %u, %p)\n", NULL, NULL, 0, NULL); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties * properties, cl_device_type device_type, void (CL_CALLBACK * pfn_notify)(const char *, const void *, size_t, void *), void * user_data, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_context obj = (cl_context) malloc(sizeof(struct _cl_context)); cl_platform_id plt = platform; for (const cl_context_properties * property = properties; *property; property += 2) if (*property == (cl_context_properties)CL_CONTEXT_PLATFORM) plt = (cl_platform_id)property[1]; CL_INIT_OBJECT(obj, plt); test_icd_stub_log("clCreateContextFromType(%p, %x, %p, %p, %p)\n", properties, device_type, pfn_notify, user_data, errcode_ret); pfn_notify(NULL, NULL, 0, NULL); test_icd_stub_log ("createcontext_callback(%p, %p, %u, %p)\n", NULL, NULL, 0, NULL); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_int CL_API_CALL clRetainContext(cl_context context) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clRetainContext(%p)\n", context); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clReleaseContext(cl_context context) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clReleaseContext(%p)\n", context); free(context); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetContextInfo(cl_context context, cl_context_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetContextInfo(%p, %u, %u, %p, %p)\n", context, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clSetContextDestructorCallback(cl_context context, void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data), void* user_data) CL_API_SUFFIX__VERSION_3_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clSetContextDestructorCallback(%p, %p, %p)\n", context, pfn_notify, user_data); pfn_notify(context, user_data); test_icd_stub_log("setcontextdestructor_callback(%p, %p)\n", context, user_data); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Command Queue APIs */ CL_API_ENTRY cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_command_queue obj = (cl_command_queue) malloc(sizeof(struct _cl_command_queue)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateCommandQueue(%p, %p, %x, %p)\n", context, device, properties, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_int CL_API_CALL clSetCommandQueueProperty(cl_command_queue command_queue , cl_command_queue_properties properties , cl_bool enable , cl_command_queue_properties * old_properties) CL_API_SUFFIX__VERSION_1_0_DEPRECATED { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clSetCommandQueueProperty(%p, %p, %u, %p)\n", command_queue, properties, enable, old_properties); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clRetainCommandQueue(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clRetainCommandQueue(%p)\n", command_queue); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clReleaseCommandQueue(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clReleaseCommandQueue(%p)\n", command_queue); free(command_queue); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetCommandQueueInfo(cl_command_queue command_queue , cl_command_queue_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetCommandQueueInfo(%p, %u, %u, %p, %p)\n", command_queue, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Memory Object APIs */ CL_API_ENTRY cl_mem CL_API_CALL clCreateBuffer(cl_context context , cl_mem_flags flags , size_t size , void * host_ptr , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_mem obj = (cl_mem) malloc(sizeof(struct _cl_mem)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateBuffer(%p, %x, %u, %p, %p)\n", context, flags, size, host_ptr, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_mem CL_API_CALL clCreateSubBuffer(cl_mem buffer , cl_mem_flags flags , cl_buffer_create_type buffer_create_type , const void * buffer_create_info , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1 { cl_mem obj = (cl_mem) malloc(sizeof(struct _cl_mem)); CL_INIT_OBJECT(obj, buffer); test_icd_stub_log("clCreateSubBuffer(%p, %x, %u, %p, %p)\n", buffer, flags, buffer_create_type, buffer_create_info, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_mem CL_API_CALL clCreateImage(cl_context context, cl_mem_flags flags, const cl_image_format * image_format, const cl_image_desc * image_desc, void * host_ptr, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2 { cl_mem obj = (cl_mem) malloc(sizeof(struct _cl_mem)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateImage(%p, %x, %p, %p, %p, %p)\n", context, flags, image_format, image_desc, host_ptr, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_mem CL_API_CALL clCreateImage2D(cl_context context , cl_mem_flags flags , const cl_image_format * image_format , size_t image_width , size_t image_height , size_t image_row_pitch , void * host_ptr , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_mem obj = (cl_mem) malloc(sizeof(struct _cl_mem)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateImage2D(%p, %x, %p, %u, %u, %u, %p, %p)\n", context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_mem CL_API_CALL clCreateImage3D(cl_context context, cl_mem_flags flags, const cl_image_format * image_format, size_t image_width, size_t image_height , size_t image_depth , size_t image_row_pitch , size_t image_slice_pitch , void * host_ptr , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_mem obj = (cl_mem) malloc(sizeof(struct _cl_mem)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateImage3D(%p, %x, %p, %u, %u, %u, %u, %u, %p, %p)\n", context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_mem CL_API_CALL clCreateBufferWithProperties(cl_context context , const cl_mem_properties * properties, cl_mem_flags flags , size_t size , void * host_ptr , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_3_0 { cl_mem obj = (cl_mem) malloc(sizeof(struct _cl_mem)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateBufferWithProperties(%p, %p, %x, %u, %p, %p)\n", context, properties, flags, size, host_ptr, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_mem CL_API_CALL clCreateImageWithProperties(cl_context context, const cl_mem_properties * properties, cl_mem_flags flags, const cl_image_format * image_format, const cl_image_desc * image_desc, void * host_ptr, cl_int * errcode_ret) CL_API_SUFFIX__VERSION_3_0 { cl_mem obj = (cl_mem) malloc(sizeof(struct _cl_mem)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateImageWithProperties(%p, %p, %x, %p, %p, %p, %p)\n", context, properties, flags, image_format, image_desc, host_ptr, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_int CL_API_CALL clRetainMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clRetainMemObject(%p)\n", memobj); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clReleaseMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clReleaseMemObject(%p)\n", memobj); free(memobj); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetSupportedImageFormats(cl_context context, cl_mem_flags flags, cl_mem_object_type image_type , cl_uint num_entries , cl_image_format * image_formats , cl_uint * num_image_formats) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetSupportedImageFormats(%p, %x, %u, %u, %p, %p)\n", context, flags, image_type, num_entries, image_formats, num_image_formats); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetMemObjectInfo(cl_mem memobj , cl_mem_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetMemObjectInfo(%p, %u, %u, %p, %p)\n", memobj, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetImageInfo(cl_mem image , cl_image_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetImageInfo(%p, %u, %u, %p, %p)\n", image, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clSetMemObjectDestructorCallback(cl_mem memobj , void (CL_CALLBACK * pfn_notify)(cl_mem memobj , void* user_data), void * user_data) CL_API_SUFFIX__VERSION_1_1 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clSetMemObjectDestructorCallback(%p, %p, %p)\n", memobj, pfn_notify, user_data); pfn_notify(memobj, user_data); test_icd_stub_log("setmemobjectdestructor_callback(%p, %p)\n", memobj, user_data); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Sampler APIs */ CL_API_ENTRY cl_sampler CL_API_CALL clCreateSampler(cl_context context , cl_bool normalized_coords , cl_addressing_mode addressing_mode , cl_filter_mode filter_mode , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_sampler obj = (cl_sampler) malloc(sizeof(struct _cl_sampler)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateSampler(%p, %u, %u, %u, %p)\n", context, normalized_coords, addressing_mode, filter_mode, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_int CL_API_CALL clRetainSampler(cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clRetainSampler(%p)\n", sampler); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clReleaseSampler(cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clReleaseSampler(%p)\n", sampler); free(sampler); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetSamplerInfo(cl_sampler sampler , cl_sampler_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetSamplerInfo(%p, %u, %u, %p, %p)\n", sampler, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Program Object APIs */ CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithSource(cl_context context , cl_uint count , const char ** strings , const size_t * lengths , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_program obj = (cl_program) malloc(sizeof(struct _cl_program)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateProgramWithSource(%p, %u, %p, %p, %p)\n", context, count, strings, lengths, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary(cl_context context , cl_uint num_devices , const cl_device_id * device_list , const size_t * lengths , const unsigned char ** binaries , cl_int * binary_status , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_program obj = (cl_program) malloc(sizeof(struct _cl_program)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateProgramWithBinary(%p, %u, %p, %p, %p, %p, %p)\n", context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBuiltInKernels(cl_context context , cl_uint num_devices , const cl_device_id * device_list , const char * kernel_names , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2 { cl_program obj = (cl_program) malloc(sizeof(struct _cl_program)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateProgramWithBuiltInKernels(%p, %u, %p, %p, %p)\n", context, num_devices, device_list, kernel_names, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_int CL_API_CALL clRetainProgram(cl_program program) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clRetainProgram(%p)\n", program); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clReleaseProgram(cl_program program) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clReleaseProgram(%p)\n", program); free(program); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clBuildProgram(cl_program program , cl_uint num_devices , const cl_device_id * device_list , const char * options , void (CL_CALLBACK * pfn_notify)(cl_program program , void * user_data), void * user_data) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clBuildProgram(%p, %u, %p, %p, %p, %p)\n", program, num_devices, device_list, options, pfn_notify, user_data); pfn_notify(program, NULL); test_icd_stub_log("program_callback(%p, %p)\n", program, NULL); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clUnloadCompiler()\n"); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clCompileProgram(cl_program program , cl_uint num_devices , const cl_device_id * device_list , const char * options , cl_uint num_input_headers , const cl_program * input_headers, const char ** header_include_names , void (CL_CALLBACK * pfn_notify)(cl_program program , void * user_data), void * user_data) CL_API_SUFFIX__VERSION_1_2 { (void)input_headers; cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clCompileProgram(%p, %u, %p, %p, %u, %p, %p, %p)\n", program, num_devices, device_list, options, num_input_headers, header_include_names, pfn_notify, user_data); pfn_notify(program, NULL); test_icd_stub_log("program_callback(%p, %p)\n", program, NULL); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_program CL_API_CALL clLinkProgram(cl_context context , cl_uint num_devices , const cl_device_id * device_list , const char * options , cl_uint num_input_programs , const cl_program * input_programs , void (CL_CALLBACK * pfn_notify)(cl_program program , void * user_data), void * user_data , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2 { cl_program obj = (cl_program) malloc(sizeof(struct _cl_program)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clLinkProgram(%p, %u, %p, %p, %u, %p, %p, %p, %p)\n", context, num_devices, device_list, options, num_input_programs, input_programs, pfn_notify, user_data, errcode_ret); pfn_notify(obj, NULL); test_icd_stub_log("program_callback(%p, %p)\n", obj, NULL); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_int CL_API_CALL clUnloadPlatformCompiler(cl_platform_id platform_id) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clUnloadPlatformCompiler(%p)\n", platform_id); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetProgramInfo(cl_program program , cl_program_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetProgramInfo(%p, %u, %u, %p, %p)\n", program, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetProgramBuildInfo(cl_program program , cl_device_id device , cl_program_build_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetProgramBuildInfo(%p, %p, %u, %u, %p, %p)\n", program, device, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Kernel Object APIs */ CL_API_ENTRY cl_kernel CL_API_CALL clCreateKernel(cl_program program , const char * kernel_name , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { cl_kernel obj = (cl_kernel) malloc(sizeof(struct _cl_kernel)); CL_INIT_OBJECT(obj, program); test_icd_stub_log("clCreateKernel(%p, %p, %p)\n", program, kernel_name, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_int CL_API_CALL clCreateKernelsInProgram(cl_program program , cl_uint num_kernels , cl_kernel * kernels , cl_uint * num_kernels_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clCreateKernelsInProgram(%p, %u, %p, %p)\n", program, num_kernels, kernels, num_kernels_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clRetainKernel(cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clRetainKernel(%p)\n", kernel); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clReleaseKernel(cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clReleaseKernel(%p)\n", kernel); free(kernel); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clSetKernelArg(cl_kernel kernel , cl_uint arg_index , size_t arg_size , const void * arg_value) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clSetKernelArg(%p, %u, %u, %p)\n", kernel, arg_index, arg_size, arg_value); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfo(cl_kernel kernel , cl_kernel_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetKernelInfo(%p, %u, %u, %p, %p)\n", kernel, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetKernelArgInfo(cl_kernel kernel , cl_uint arg_indx , cl_kernel_arg_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetKernelArgInfo(%p, %u, %u, %u, %p, %p)\n", kernel, arg_indx, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetKernelWorkGroupInfo(cl_kernel kernel , cl_device_id device , cl_kernel_work_group_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetKernelWorkGroupInfo(%p, %p, %u, %u, %p, %p)\n", kernel, device, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Event Object APIs */ CL_API_ENTRY cl_int CL_API_CALL clWaitForEvents(cl_uint num_events , const cl_event * event_list) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clWaitForEvents(%u, %p)\n", num_events, event_list); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clGetEventInfo(cl_event event , cl_event_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetEventInfo(%p, %u, %u, %p, %p)\n", event, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_event CL_API_CALL clCreateUserEvent(cl_context context , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1 { cl_event obj = (cl_event) malloc(sizeof(struct _cl_event)); CL_INIT_OBJECT(obj, context); test_icd_stub_log("clCreateUserEvent(%p, %p)\n", context, errcode_ret); test_icd_stub_log("Value returned: %p\n", obj); return obj; } CL_API_ENTRY cl_int CL_API_CALL clRetainEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clRetainEvent(%p)\n", event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clReleaseEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clReleaseEvent(%p)\n", event); free(event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clSetUserEventStatus(cl_event event , cl_int execution_status) CL_API_SUFFIX__VERSION_1_1 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clSetUserEventStatus(%p, %d)\n", event, execution_status); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clSetEventCallback(cl_event event , cl_int command_exec_callback_type , void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *), void * user_data) CL_API_SUFFIX__VERSION_1_1 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clSetEventCallback(%p, %d, %p, %p)\n", event, command_exec_callback_type, pfn_notify, user_data); pfn_notify(event, command_exec_callback_type, NULL); test_icd_stub_log("setevent_callback(%p, %d, %p)\n", event, command_exec_callback_type, NULL); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Profiling APIs */ CL_API_ENTRY cl_int CL_API_CALL clGetEventProfilingInfo(cl_event event , cl_profiling_info param_name , size_t param_value_size , void * param_value , size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clGetEventProfilingInfo(%p, %u, %u, %p, %p)\n", event, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Flush and Finish APIs */ CL_API_ENTRY cl_int CL_API_CALL clFlush(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clFlush(%p)\n", command_queue); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clFinish(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clFinish(%p)\n", command_queue); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } /* Enqueued Commands APIs */ CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBuffer(cl_command_queue command_queue , cl_mem buffer , cl_bool blocking_read , size_t offset , size_t cb , void * ptr , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueReadBuffer(%p, %p, %u, %u, %u, %p, %u, %p, %p)\n", command_queue, buffer, blocking_read, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBufferRect(cl_command_queue command_queue , cl_mem buffer , cl_bool blocking_read , const size_t * buffer_origin , const size_t * host_origin , const size_t * region , size_t buffer_row_pitch , size_t buffer_slice_pitch , size_t host_row_pitch , size_t host_slice_pitch , void * ptr , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_1 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueReadBufferRect(%p, %p, %u, %p, %p, %p, %u, %u, %u, %u, %p, %u, %p, %p)\n", command_queue, buffer, blocking_read, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBuffer(cl_command_queue command_queue , cl_mem buffer , cl_bool blocking_write , size_t offset , size_t cb , const void * ptr , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueWriteBuffer(%p, %p, %u, %u, %u, %p, %u, %p, %p)\n", command_queue, buffer, blocking_write, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBufferRect(cl_command_queue command_queue , cl_mem buffer , cl_bool blocking_write , const size_t * buffer_origin , const size_t * host_origin , const size_t * region , size_t buffer_row_pitch , size_t buffer_slice_pitch , size_t host_row_pitch , size_t host_slice_pitch , const void * ptr , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_1 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueWriteBufferRect(%p, %p, %u, %p, %p, %p, %u, %u, %u, %u, %p, %u, %p, %p)\n", command_queue, buffer, blocking_write, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBuffer(cl_command_queue command_queue , cl_mem src_buffer , cl_mem dst_buffer , size_t src_offset , size_t dst_offset , size_t cb , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueCopyBuffer(%p, %p, %p, %u, %u, %u, %u, %p, %p)\n", command_queue, src_buffer, dst_buffer, src_offset, dst_offset, cb, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferRect(cl_command_queue command_queue , cl_mem src_buffer , cl_mem dst_buffer , const size_t * src_origin , const size_t * dst_origin , const size_t * region , size_t src_row_pitch , size_t src_slice_pitch , size_t dst_row_pitch , size_t dst_slice_pitch , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_1 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueCopyBufferRect(%p, %p, %p, %p, %p, %p, %u, %u, %u, %u, %u, %p, %p)\n", command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillBuffer(cl_command_queue command_queue , cl_mem buffer , const void * pattern , size_t pattern_size , size_t offset , size_t cb , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueFillBuffer(%p, %p, %p, %u, %u, %u, %u, %p, %p)\n", command_queue, buffer, pattern, pattern_size, offset, cb, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillImage(cl_command_queue command_queue , cl_mem image , const void * fill_color , const size_t * origin , const size_t * region , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueFillImage(%p, %p, %p, %p, %p, %u, %p, %p)\n", command_queue, image, fill_color, origin, region, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImage(cl_command_queue command_queue , cl_mem image , cl_bool blocking_read , const size_t * origin , const size_t * region , size_t row_pitch , size_t slice_pitch , void * ptr , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueReadImage(%p, %p, %u, %p, %p, %u, %u, %p, %u, %p, %p)\n", command_queue, image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteImage(cl_command_queue command_queue , cl_mem image , cl_bool blocking_write , const size_t * origin , const size_t * region , size_t input_row_pitch , size_t input_slice_pitch , const void * ptr , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueWriteImage(%p, %p, %u, %p, %p, %u, %u, %p, %u, %p, %p)\n", command_queue, image, blocking_write, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImage(cl_command_queue command_queue , cl_mem src_image , cl_mem dst_image , const size_t * src_origin , const size_t * dst_origin , const size_t * region , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueCopyImage(%p, %p, %p, %p, %p, %p, %u, %p, %p)\n", command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_list , event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImageToBuffer(cl_command_queue command_queue , cl_mem src_image , cl_mem dst_buffer , const size_t * src_origin , const size_t * region , size_t dst_offset , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueCopyImageToBuffer(%p, %p, %p, %p, %p, %u, %u, %p, %p)\n", command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferToImage(cl_command_queue command_queue , cl_mem src_buffer , cl_mem dst_image , size_t src_offset , const size_t * dst_origin , const size_t * region , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueCopyBufferToImage(%p, %p, %p, %u, %p, %p, %u, %p, %p)\n", command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY void * CL_API_CALL clEnqueueMapBuffer(cl_command_queue command_queue , cl_mem buffer , cl_bool blocking_map , cl_map_flags map_flags , size_t offset , size_t cb , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { void *return_value = (void *) malloc(sizeof(void *)); test_icd_stub_log("clEnqueueMapBuffer(%p, %p, %u, %x, %u, %u, %u, %p, %p, %p)\n", command_queue, buffer, blocking_map, map_flags, offset, cb, num_events_in_wait_list, event_wait_list, event, errcode_ret); test_icd_stub_log("Value returned: %p\n", return_value); return return_value; } CL_API_ENTRY void * CL_API_CALL clEnqueueMapImage(cl_command_queue command_queue , cl_mem image , cl_bool blocking_map , cl_map_flags map_flags , const size_t * origin , const size_t * region , size_t * image_row_pitch , size_t * image_slice_pitch , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event , cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0 { void *return_value = (void *) malloc(sizeof(void *)); test_icd_stub_log("clEnqueueMapImage(%p, %p, %u, %x, %p, %p, %p, %p, %u, %p, %p, %p)\n", command_queue, image, blocking_map, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event, errcode_ret); test_icd_stub_log("Value returned: %p\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueUnmapMemObject(cl_command_queue command_queue , cl_mem memobj , void * mapped_ptr , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueUnmapMemObject(%p, %p, %p, %u, %p, %p)\n", command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjects(cl_command_queue command_queue , cl_uint num_mem_objects , const cl_mem * mem_objects , cl_mem_migration_flags flags , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueMigrateMemObjects(%p, %u, %p, %x, %u, %p, %p)\n", command_queue, num_mem_objects, mem_objects, flags, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue command_queue , cl_kernel kernel , cl_uint work_dim , const size_t * global_work_offset , const size_t * global_work_size , const size_t * local_work_size , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueNDRangeKernel(%p, %p, %u, %p, %p, %p, %u, %p, %p)\n", command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueTask(cl_command_queue command_queue , cl_kernel kernel , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueTask(%p, %p, %u, %p, %p)\n", command_queue, kernel, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueNativeKernel(cl_command_queue command_queue , void (CL_CALLBACK *user_func)(void *), void * args , size_t cb_args , cl_uint num_mem_objects , const cl_mem * mem_list , const void ** args_mem_loc , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueNativeKernel(%p, %p, %p, %u, %u, %p, %p, %u, %p, %p)\n", command_queue, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } static void extFunc(void) { } CL_API_ENTRY void *CL_API_CALL clGetExtensionFunctionAddressForPlatform( cl_platform_id platform_id, const char *func_name) CL_API_SUFFIX__VERSION_1_2 { void *return_value = (void *)(size_t)&extFunc; test_icd_stub_log("clGetExtensionFunctionAddressForPlatform(%p, %p)\n", platform_id, func_name); test_icd_stub_log("Value returned: %p\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarkerWithWaitList(cl_command_queue command_queue , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueMarkerWithWaitList(%p, %u, %p, %p)\n", command_queue, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrierWithWaitList(cl_command_queue command_queue , cl_uint num_events_in_wait_list , const cl_event * event_wait_list , cl_event * event) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueBarrierWithWaitList(%p, %u, %p, %p)\n", command_queue, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } extern CL_API_ENTRY cl_int CL_API_CALL clSetPrintfCallback(cl_context context , void (CL_CALLBACK * pfn_notify)(cl_context program , cl_uint printf_data_len , char * printf_data_ptr , void * user_data), void * user_data) CL_API_SUFFIX__VERSION_1_2 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clSetPrintfCallback(%p, %p, %p)\n", context, pfn_notify, user_data); pfn_notify(context, 0, NULL, NULL); test_icd_stub_log("setprintf_callback(%p, %u, %p, %p)\n", context, 0, NULL, NULL); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarker(cl_command_queue command_queue , cl_event * event) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueMarker(%p, %p)\n", command_queue, event); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueWaitForEvents(cl_command_queue command_queue , cl_uint num_events , const cl_event * event_list) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueWaitForEvents(%p, %u, %p)\n", command_queue, num_events, event_list); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrier(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { cl_int return_value = CL_OUT_OF_RESOURCES; test_icd_stub_log("clEnqueueBarrier(%p)\n", command_queue); test_icd_stub_log("Value returned: %d\n", return_value); return return_value; } extern cl_int cliIcdDispatchTableCreate(CLIicdDispatchTable **outDispatchTable); CL_API_ENTRY cl_int CL_API_CALL clIcdGetPlatformIDsKHR(cl_uint num_entries, cl_platform_id * platforms, cl_uint * num_platforms) { cl_int result = CL_SUCCESS; if (!initialized) { result = cliIcdDispatchTableCreate(&dispatchTable); platform = (cl_platform_id) malloc(sizeof(struct _cl_platform_id)); memset(platform, 0, sizeof(struct _cl_platform_id)); CL_INIT_PLATFORM(platform, dispatchTable); platform->version = "OpenCL 1.2 Stub"; platform->vendor = "stubvendorxxx"; platform->profile = "stubprofilexxx"; #if defined(CL_ENABLE_ICD2) platform->name = "ICD_LOADER_TEST_OPENCL_STUB_ICD2"; #else platform->name = "ICD_LOADER_TEST_OPENCL_STUB"; #endif platform->extensions = "cl_khr_icd cl_khr_gl cl_khr_d3d10"; platform->suffix = "ilts"; initialized = CL_TRUE; } if ((platforms && num_entries >1) || (platforms && num_entries <= 0) || (!platforms && num_entries >= 1)) { result = CL_INVALID_VALUE; goto Done; } if (platforms && num_entries == 1) { platforms[0] = platform; } Done: if (num_platforms) { *num_platforms = 1; } return result; } OpenCL-ICD-Loader-2025.07.22/test/driver_stub/cl_ext.c000066400000000000000000000020651503776305700220050ustar00rootroot00000000000000#include #define CL_USE_DEPRECATED_OPENCL_1_1_APIS #include "CL/cl.h" #include "CL/cl_ext.h" #include "cl_khr_icd2.h" #if defined(CL_ENABLE_ICD2) CL_API_ENTRY clIcdGetFunctionAddressForPlatformKHR_t clIcdGetFunctionAddressForPlatformKHR; CL_API_ENTRY clIcdSetPlatformDispatchDataKHR_t clIcdSetPlatformDispatchDataKHR; #endif struct driverStubextFunc_st { const char *name; void *func; }; #define EXT_FUNC(name) { #name, (void*)(intptr_t)(name) } static struct driverStubextFunc_st clExtensions[] = { EXT_FUNC(clIcdGetPlatformIDsKHR), #ifdef CL_ENABLE_ICD2 EXT_FUNC(clIcdGetFunctionAddressForPlatformKHR), EXT_FUNC(clIcdSetPlatformDispatchDataKHR), #endif //CL_ENABLE_ICD2 }; static const int clExtensionCount = sizeof(clExtensions) / sizeof(clExtensions[0]); CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddress(const char *name) { int ii; for (ii = 0; ii < clExtensionCount; ii++) { if (!strcmp(name, clExtensions[ii].name)) { return clExtensions[ii].func; } } return NULL; } OpenCL-ICD-Loader-2025.07.22/test/driver_stub/cl_gl.c000066400000000000000000000201201503776305700215770ustar00rootroot00000000000000#include #include // Need to rename all CL API functions to prevent ICD loader functions calling // themselves via the dispatch table. Include this before cl headers. #include "rename_api.h" #define SIZE_T_MAX (size_t) 0xFFFFFFFFFFFFFFFFULL CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLBuffer(cl_context context , cl_mem_flags flags , cl_GLuint bufret_mem , int * errcode_ret ) CL_API_SUFFIX__VERSION_1_0 { cl_mem ret_mem = (cl_mem)(SIZE_T_MAX); test_icd_stub_log("clCreateFromGLBuffer(%p, %x, %u, %p)\n", context, flags, bufret_mem, errcode_ret); test_icd_stub_log("Value returned: %p\n", ret_mem); return ret_mem; } CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture(cl_context context , cl_mem_flags flags , cl_GLenum target , cl_GLint miplevel , cl_GLuint texture , cl_int * errcode_ret ) CL_API_SUFFIX__VERSION_1_2 { cl_mem ret_mem = (cl_mem)(SIZE_T_MAX); test_icd_stub_log("clCreateFromGLTexture(%p, %x, %d, %d, %u, %p)\n", context , flags , target , miplevel , texture , errcode_ret ); test_icd_stub_log("Value returned: %p\n", ret_mem); return ret_mem; } CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture2D(cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int * errcode_ret ) CL_API_SUFFIX__VERSION_1_0 { cl_mem ret_mem = (cl_mem)(SIZE_T_MAX); test_icd_stub_log("clCreateFromGLTexture2D(%p, %x, %d, %d, %u, %p)\n", context, flags, target, miplevel, texture, errcode_ret ); test_icd_stub_log("Value returned: %p\n", ret_mem); return ret_mem; } CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture3D(cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int * errcode_ret ) CL_API_SUFFIX__VERSION_1_0 { cl_mem ret_mem = (cl_mem)(SIZE_T_MAX); test_icd_stub_log("clCreateFromGLTexture3D(%p, %x, %d, %d, %u, %p)\n", context, flags, target, miplevel, texture, errcode_ret ); test_icd_stub_log("Value returned: %p\n", ret_mem); return ret_mem; } CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLRenderbuffer(cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer, cl_int * errcode_ret ) CL_API_SUFFIX__VERSION_1_0 { cl_mem ret_mem = (cl_mem)(SIZE_T_MAX); test_icd_stub_log("clCreateFromGLRenderbuffer(%p, %x, %d, %p)\n", context, flags, renderbuffer, errcode_ret); test_icd_stub_log("Value returned: %p\n", ret_mem); return ret_mem; } CL_API_ENTRY cl_int CL_API_CALL clGetGLObjectInfo(cl_mem memobj, cl_gl_object_type * gl_object_type, cl_GLuint * gl_object_name ) CL_API_SUFFIX__VERSION_1_0 { cl_int ret_val = -5; test_icd_stub_log("clGetGLObjectInfo(%p, %p, %p)\n", memobj, gl_object_type, gl_object_name); test_icd_stub_log("Value returned: %p\n", ret_val); return ret_val; } CL_API_ENTRY cl_int CL_API_CALL clGetGLTextureInfo(cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret ) CL_API_SUFFIX__VERSION_1_0 { cl_int ret_val = -5; test_icd_stub_log("clGetGLTextureInfo(%p, %u, %u, %p, %p)\n", memobj, param_name, param_value_size, param_value, param_value_size_ret ); test_icd_stub_log("Value returned: %p\n", ret_val); return ret_val; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireGLObjects(cl_command_queue command_queue, cl_uint num_objects, const cl_mem * mem_objects, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event ) CL_API_SUFFIX__VERSION_1_0 { cl_int ret_val = -5; test_icd_stub_log("clEnqueueAcquireGLObjects(%p, %u, %p, %u, %p, %p)\n", command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %p\n", ret_val); return ret_val; } CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseGLObjects(cl_command_queue command_queue, cl_uint num_objects, const cl_mem * mem_objects, cl_uint num_events_in_wait_list, const cl_event * event_wait_list, cl_event * event ) CL_API_SUFFIX__VERSION_1_0 { cl_int ret_val = -5; test_icd_stub_log("clEnqueueReleaseGLObjects(%p, %u, %p, %u, %p, %p)\n", command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); test_icd_stub_log("Value returned: %p\n", ret_val); return ret_val; } CL_API_ENTRY cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties * properties, cl_gl_context_info param_name, size_t param_value_size, void * param_value, size_t * param_value_size_ret ) CL_API_SUFFIX__VERSION_1_0 { cl_int ret_val = -5; test_icd_stub_log("clGetGLContextInfoKHR(%p, %u, %u, %p, %p)\n", properties, param_name, param_value_size, param_value, param_value_size_ret); test_icd_stub_log("Value returned: %p\n", ret_val); return ret_val; } CL_API_ENTRY cl_event CL_API_CALL clCreateEventFromGLsyncKHR(cl_context context , cl_GLsync cl_GLsync , cl_int * errcode_ret ) CL_API_SUFFIX__VERSION_1_1 { cl_event ret_event = (cl_event)(SIZE_T_MAX); test_icd_stub_log("clCreateEventFromGLsyncKHR(%p, %p, %p)\n", context, cl_GLsync, errcode_ret); test_icd_stub_log("Value returned: %p\n", ret_event); return ret_event; } OpenCL-ICD-Loader-2025.07.22/test/driver_stub/driver_stub.def000066400000000000000000000000461503776305700233700ustar00rootroot00000000000000EXPORTS clGetExtensionFunctionAddress OpenCL-ICD-Loader-2025.07.22/test/driver_stub/icd.c000066400000000000000000000512601503776305700212670ustar00rootroot00000000000000#include #include #include #include #include "icd_structs.h" #define CL_USE_DEPRECATED_OPENCL_1_0_APIS #define CL_USE_DEPRECATED_OPENCL_1_1_APIS #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS #define CL_USE_DEPRECATED_OPENCL_2_1_APIS #define CL_USE_DEPRECATED_OPENCL_2_2_APIS // Need to rename all CL API functions to prevent ICD loader functions calling // themselves via the dispatch table. Include this before cl headers. #include "rename_api.h" #include "CL/cl.h" #include "CL/cl_gl.h" #if defined(CL_ENABLE_ICD2) #include "cl_khr_icd2.h" CL_API_ENTRY clIcdGetFunctionAddressForPlatformKHR_t clIcdGetFunctionAddressForPlatformKHR; CL_API_ENTRY clIcdSetPlatformDispatchDataKHR_t clIcdSetPlatformDispatchDataKHR; #endif /* * Prototypes for deprecated functions no longer present in cl.h */ extern CL_API_ENTRY cl_int CL_API_CALL clSetCommandQueueProperty(cl_command_queue /* command_queue */, cl_command_queue_properties /* properties */, cl_bool /* enable */, cl_command_queue_properties * /* old_properties */); #define ICD_DISPATCH_TABLE_ENTRY(fn) \ assert(dispatchTable->entryCount < 256); \ dispatchTable->entries[dispatchTable->entryCount++] = (void*)(intptr_t)(fn) cl_int cliIcdDispatchTableCreate(CLIicdDispatchTable **outDispatchTable) { CLIicdDispatchTable *dispatchTable = NULL; cl_int result = CL_SUCCESS; // allocate the public handle dispatchTable = (CLIicdDispatchTable *) malloc(sizeof(*dispatchTable)); if (!dispatchTable) { result = CL_OUT_OF_HOST_MEMORY; goto Error; } memset(dispatchTable, 0, sizeof(*dispatchTable)); // OpenCL 1.0 #ifdef CL_ENABLE_ICD2 ICD_DISPATCH_TABLE_ENTRY ( CL_ICD2_TAG_KHR ); #else ICD_DISPATCH_TABLE_ENTRY ( clGetPlatformIDs ); #endif ICD_DISPATCH_TABLE_ENTRY ( clGetPlatformInfo ); ICD_DISPATCH_TABLE_ENTRY ( clGetDeviceIDs ); ICD_DISPATCH_TABLE_ENTRY ( clGetDeviceInfo ); ICD_DISPATCH_TABLE_ENTRY ( clCreateContext ); ICD_DISPATCH_TABLE_ENTRY ( clCreateContextFromType ); ICD_DISPATCH_TABLE_ENTRY ( clRetainContext ); ICD_DISPATCH_TABLE_ENTRY ( clReleaseContext ); ICD_DISPATCH_TABLE_ENTRY ( clGetContextInfo ); ICD_DISPATCH_TABLE_ENTRY ( clCreateCommandQueue ); ICD_DISPATCH_TABLE_ENTRY ( clRetainCommandQueue ); ICD_DISPATCH_TABLE_ENTRY ( clReleaseCommandQueue ); ICD_DISPATCH_TABLE_ENTRY ( clGetCommandQueueInfo ); ICD_DISPATCH_TABLE_ENTRY ( clSetCommandQueueProperty ); ICD_DISPATCH_TABLE_ENTRY ( clCreateBuffer ); ICD_DISPATCH_TABLE_ENTRY ( clCreateImage2D ); ICD_DISPATCH_TABLE_ENTRY ( clCreateImage3D ); ICD_DISPATCH_TABLE_ENTRY ( clRetainMemObject ); ICD_DISPATCH_TABLE_ENTRY ( clReleaseMemObject ); ICD_DISPATCH_TABLE_ENTRY ( clGetSupportedImageFormats ); ICD_DISPATCH_TABLE_ENTRY ( clGetMemObjectInfo ); ICD_DISPATCH_TABLE_ENTRY ( clGetImageInfo ); ICD_DISPATCH_TABLE_ENTRY ( clCreateSampler ); ICD_DISPATCH_TABLE_ENTRY ( clRetainSampler ); ICD_DISPATCH_TABLE_ENTRY ( clReleaseSampler ); ICD_DISPATCH_TABLE_ENTRY ( clGetSamplerInfo ); ICD_DISPATCH_TABLE_ENTRY ( clCreateProgramWithSource ); ICD_DISPATCH_TABLE_ENTRY ( clCreateProgramWithBinary ); ICD_DISPATCH_TABLE_ENTRY ( clRetainProgram ); ICD_DISPATCH_TABLE_ENTRY ( clReleaseProgram ); ICD_DISPATCH_TABLE_ENTRY ( clBuildProgram ); #ifdef CL_ENABLE_ICD2 ICD_DISPATCH_TABLE_ENTRY ( CL_ICD2_TAG_KHR ); #else ICD_DISPATCH_TABLE_ENTRY ( clUnloadCompiler ); #endif ICD_DISPATCH_TABLE_ENTRY ( clGetProgramInfo ); ICD_DISPATCH_TABLE_ENTRY ( clGetProgramBuildInfo ); ICD_DISPATCH_TABLE_ENTRY ( clCreateKernel ); ICD_DISPATCH_TABLE_ENTRY ( clCreateKernelsInProgram ); ICD_DISPATCH_TABLE_ENTRY ( clRetainKernel ); ICD_DISPATCH_TABLE_ENTRY ( clReleaseKernel ); ICD_DISPATCH_TABLE_ENTRY ( clSetKernelArg ); ICD_DISPATCH_TABLE_ENTRY ( clGetKernelInfo ); ICD_DISPATCH_TABLE_ENTRY ( clGetKernelWorkGroupInfo ); ICD_DISPATCH_TABLE_ENTRY ( clWaitForEvents ); ICD_DISPATCH_TABLE_ENTRY ( clGetEventInfo ); ICD_DISPATCH_TABLE_ENTRY ( clRetainEvent ); ICD_DISPATCH_TABLE_ENTRY ( clReleaseEvent ); ICD_DISPATCH_TABLE_ENTRY ( clGetEventProfilingInfo ); ICD_DISPATCH_TABLE_ENTRY ( clFlush ); ICD_DISPATCH_TABLE_ENTRY ( clFinish ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueReadBuffer ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueWriteBuffer ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueCopyBuffer ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueReadImage ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueWriteImage ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueCopyImage ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueCopyImageToBuffer ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueCopyBufferToImage ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueMapBuffer ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueMapImage ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueUnmapMemObject ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueNDRangeKernel ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueTask ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueNativeKernel ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueMarker ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueWaitForEvents ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueBarrier ); ICD_DISPATCH_TABLE_ENTRY ( clGetExtensionFunctionAddress ); ICD_DISPATCH_TABLE_ENTRY ( clCreateFromGLBuffer ); ICD_DISPATCH_TABLE_ENTRY ( clCreateFromGLTexture2D ); ICD_DISPATCH_TABLE_ENTRY ( clCreateFromGLTexture3D ); ICD_DISPATCH_TABLE_ENTRY ( clCreateFromGLRenderbuffer ); ICD_DISPATCH_TABLE_ENTRY ( clGetGLObjectInfo ); ICD_DISPATCH_TABLE_ENTRY ( clGetGLTextureInfo ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueAcquireGLObjects ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueReleaseGLObjects ); // cl_khr_gl_sharing ICD_DISPATCH_TABLE_ENTRY ( clGetGLContextInfoKHR ); // cl_khr_d3d10_sharing (windows-only) #if 0 && defined(_WIN32) ICD_DISPATCH_TABLE_ENTRY ( clGetDeviceIDsFromD3D10KHR ); ICD_DISPATCH_TABLE_ENTRY ( clCreateFromD3D10BufferKHR ); ICD_DISPATCH_TABLE_ENTRY ( clCreateFromD3D10Texture2DKHR ); ICD_DISPATCH_TABLE_ENTRY ( clCreateFromD3D10Texture3DKHR ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueAcquireD3D10ObjectsKHR ); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueReleaseD3D10ObjectsKHR ); #else ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); #endif // OpenCL 1.1 ICD_DISPATCH_TABLE_ENTRY ( clSetEventCallback); ICD_DISPATCH_TABLE_ENTRY ( clCreateSubBuffer); ICD_DISPATCH_TABLE_ENTRY ( clSetMemObjectDestructorCallback); ICD_DISPATCH_TABLE_ENTRY ( clCreateUserEvent); ICD_DISPATCH_TABLE_ENTRY ( clSetUserEventStatus); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueReadBufferRect); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueWriteBufferRect); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueCopyBufferRect); /* cl_ext_device_fission */ ICD_DISPATCH_TABLE_ENTRY ( /*clCreateSubDevicesEXT*/NULL); ICD_DISPATCH_TABLE_ENTRY ( /*clRetainDeviceEXT*/ NULL); ICD_DISPATCH_TABLE_ENTRY ( /*clReleaseDevice*/NULL); /* cl_khr_gl_event */ ICD_DISPATCH_TABLE_ENTRY ( clCreateEventFromGLsyncKHR); /* OpenCL 1.2 */ ICD_DISPATCH_TABLE_ENTRY ( clCreateSubDevices); ICD_DISPATCH_TABLE_ENTRY ( clRetainDevice); ICD_DISPATCH_TABLE_ENTRY ( clReleaseDevice); ICD_DISPATCH_TABLE_ENTRY ( clCreateImage); ICD_DISPATCH_TABLE_ENTRY ( clCreateProgramWithBuiltInKernels); ICD_DISPATCH_TABLE_ENTRY ( clCompileProgram); ICD_DISPATCH_TABLE_ENTRY ( clLinkProgram); ICD_DISPATCH_TABLE_ENTRY ( clUnloadPlatformCompiler); ICD_DISPATCH_TABLE_ENTRY ( clGetKernelArgInfo); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueFillBuffer); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueFillImage); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueMigrateMemObjects); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueMarkerWithWaitList); ICD_DISPATCH_TABLE_ENTRY ( clEnqueueBarrierWithWaitList); ICD_DISPATCH_TABLE_ENTRY ( clGetExtensionFunctionAddressForPlatform); ICD_DISPATCH_TABLE_ENTRY ( clCreateFromGLTexture); /* cl_khr_d3d11_sharing */ ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); /* cl_khr_dx9_media_sharing */ ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); /* cl_khr_egl_image */ ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); /* cl_khr_egl_event */ ICD_DISPATCH_TABLE_ENTRY( NULL ); /* OpenCL 2.0 */ ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); /* cl_khr_sub_groups */ ICD_DISPATCH_TABLE_ENTRY( NULL ); /* OpenCL 2.1 */ ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); /* OpenCL 2.2 */ ICD_DISPATCH_TABLE_ENTRY( NULL ); ICD_DISPATCH_TABLE_ENTRY( NULL ); /* OpenCL 3.0 */ ICD_DISPATCH_TABLE_ENTRY ( clCreateBufferWithProperties ); ICD_DISPATCH_TABLE_ENTRY ( clCreateImageWithProperties ); ICD_DISPATCH_TABLE_ENTRY ( clSetContextDestructorCallback ); // return success *outDispatchTable = dispatchTable; return CL_SUCCESS; Error: return result; } void cliIcdDispatchTableDestroy(CLIicdDispatchTable *dispatchTable) { free(dispatchTable); } #ifdef CL_ENABLE_ICD2 #define ICD_GET_FUNCTION_ADDRESS(fn) \ do \ { \ if (!strcmp(#fn, func_name)) \ return (void*)(intptr_t)(fn); \ } while (0) void * CL_API_CALL clIcdGetFunctionAddressForPlatformKHR( cl_platform_id platform, const char* func_name) { (void)platform; ICD_GET_FUNCTION_ADDRESS ( clGetPlatformIDs ); ICD_GET_FUNCTION_ADDRESS ( clGetPlatformInfo ); ICD_GET_FUNCTION_ADDRESS ( clGetDeviceIDs ); ICD_GET_FUNCTION_ADDRESS ( clGetDeviceInfo ); ICD_GET_FUNCTION_ADDRESS ( clCreateContext ); ICD_GET_FUNCTION_ADDRESS ( clCreateContextFromType ); ICD_GET_FUNCTION_ADDRESS ( clRetainContext ); ICD_GET_FUNCTION_ADDRESS ( clReleaseContext ); ICD_GET_FUNCTION_ADDRESS ( clGetContextInfo ); ICD_GET_FUNCTION_ADDRESS ( clCreateCommandQueue ); ICD_GET_FUNCTION_ADDRESS ( clRetainCommandQueue ); ICD_GET_FUNCTION_ADDRESS ( clReleaseCommandQueue ); ICD_GET_FUNCTION_ADDRESS ( clGetCommandQueueInfo ); ICD_GET_FUNCTION_ADDRESS ( clSetCommandQueueProperty ); ICD_GET_FUNCTION_ADDRESS ( clCreateBuffer ); ICD_GET_FUNCTION_ADDRESS ( clCreateImage2D ); ICD_GET_FUNCTION_ADDRESS ( clCreateImage3D ); ICD_GET_FUNCTION_ADDRESS ( clRetainMemObject ); ICD_GET_FUNCTION_ADDRESS ( clReleaseMemObject ); ICD_GET_FUNCTION_ADDRESS ( clGetSupportedImageFormats ); ICD_GET_FUNCTION_ADDRESS ( clGetMemObjectInfo ); ICD_GET_FUNCTION_ADDRESS ( clGetImageInfo ); ICD_GET_FUNCTION_ADDRESS ( clCreateSampler ); ICD_GET_FUNCTION_ADDRESS ( clRetainSampler ); ICD_GET_FUNCTION_ADDRESS ( clReleaseSampler ); ICD_GET_FUNCTION_ADDRESS ( clGetSamplerInfo ); ICD_GET_FUNCTION_ADDRESS ( clCreateProgramWithSource ); ICD_GET_FUNCTION_ADDRESS ( clCreateProgramWithBinary ); ICD_GET_FUNCTION_ADDRESS ( clRetainProgram ); ICD_GET_FUNCTION_ADDRESS ( clReleaseProgram ); ICD_GET_FUNCTION_ADDRESS ( clBuildProgram ); ICD_GET_FUNCTION_ADDRESS ( clUnloadCompiler ); ICD_GET_FUNCTION_ADDRESS ( clGetProgramInfo ); ICD_GET_FUNCTION_ADDRESS ( clGetProgramBuildInfo ); ICD_GET_FUNCTION_ADDRESS ( clCreateKernel ); ICD_GET_FUNCTION_ADDRESS ( clCreateKernelsInProgram ); ICD_GET_FUNCTION_ADDRESS ( clRetainKernel ); ICD_GET_FUNCTION_ADDRESS ( clReleaseKernel ); ICD_GET_FUNCTION_ADDRESS ( clSetKernelArg ); ICD_GET_FUNCTION_ADDRESS ( clGetKernelInfo ); ICD_GET_FUNCTION_ADDRESS ( clGetKernelWorkGroupInfo ); ICD_GET_FUNCTION_ADDRESS ( clWaitForEvents ); ICD_GET_FUNCTION_ADDRESS ( clGetEventInfo ); ICD_GET_FUNCTION_ADDRESS ( clRetainEvent ); ICD_GET_FUNCTION_ADDRESS ( clReleaseEvent ); ICD_GET_FUNCTION_ADDRESS ( clGetEventProfilingInfo ); ICD_GET_FUNCTION_ADDRESS ( clFlush ); ICD_GET_FUNCTION_ADDRESS ( clFinish ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueReadBuffer ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueWriteBuffer ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueCopyBuffer ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueReadImage ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueWriteImage ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueCopyImage ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueCopyImageToBuffer ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueCopyBufferToImage ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueMapBuffer ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueMapImage ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueUnmapMemObject ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueNDRangeKernel ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueTask ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueNativeKernel ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueMarker ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueWaitForEvents ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueBarrier ); ICD_GET_FUNCTION_ADDRESS ( clGetExtensionFunctionAddress ); ICD_GET_FUNCTION_ADDRESS ( clCreateFromGLBuffer ); ICD_GET_FUNCTION_ADDRESS ( clCreateFromGLTexture2D ); ICD_GET_FUNCTION_ADDRESS ( clCreateFromGLTexture3D ); ICD_GET_FUNCTION_ADDRESS ( clCreateFromGLRenderbuffer ); ICD_GET_FUNCTION_ADDRESS ( clGetGLObjectInfo ); ICD_GET_FUNCTION_ADDRESS ( clGetGLTextureInfo ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueAcquireGLObjects ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueReleaseGLObjects ); // cl_khr_gl_sharing ICD_GET_FUNCTION_ADDRESS ( clGetGLContextInfoKHR ); #if 0 // cl_khr_d3d10_sharing (windows-only) #if 0 && defined(_WIN32) ICD_GET_FUNCTION_ADDRESS ( clGetDeviceIDsFromD3D10KHR ); ICD_GET_FUNCTION_ADDRESS ( clCreateFromD3D10BufferKHR ); ICD_GET_FUNCTION_ADDRESS ( clCreateFromD3D10Texture2DKHR ); ICD_GET_FUNCTION_ADDRESS ( clCreateFromD3D10Texture3DKHR ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueAcquireD3D10ObjectsKHR ); ICD_GET_FUNCTION_ADDRESS ( clEnqueueReleaseD3D10ObjectsKHR ); #else ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); #endif #endif // OpenCL 1.1 ICD_GET_FUNCTION_ADDRESS ( clSetEventCallback); ICD_GET_FUNCTION_ADDRESS ( clCreateSubBuffer); ICD_GET_FUNCTION_ADDRESS ( clSetMemObjectDestructorCallback); ICD_GET_FUNCTION_ADDRESS ( clCreateUserEvent); ICD_GET_FUNCTION_ADDRESS ( clSetUserEventStatus); ICD_GET_FUNCTION_ADDRESS ( clEnqueueReadBufferRect); ICD_GET_FUNCTION_ADDRESS ( clEnqueueWriteBufferRect); ICD_GET_FUNCTION_ADDRESS ( clEnqueueCopyBufferRect); #if 0 /* cl_ext_device_fission */ ICD_GET_FUNCTION_ADDRESS ( /*clCreateSubDevicesEXT*/NULL); ICD_GET_FUNCTION_ADDRESS ( /*clRetainDeviceEXT*/ NULL); ICD_GET_FUNCTION_ADDRESS ( /*clReleaseDevice*/NULL); #endif /* cl_khr_gl_event */ ICD_GET_FUNCTION_ADDRESS ( clCreateEventFromGLsyncKHR); /* OpenCL 1.2 */ ICD_GET_FUNCTION_ADDRESS ( clCreateSubDevices); ICD_GET_FUNCTION_ADDRESS ( clRetainDevice); ICD_GET_FUNCTION_ADDRESS ( clReleaseDevice); ICD_GET_FUNCTION_ADDRESS ( clCreateImage); ICD_GET_FUNCTION_ADDRESS ( clCreateProgramWithBuiltInKernels); ICD_GET_FUNCTION_ADDRESS ( clCompileProgram); ICD_GET_FUNCTION_ADDRESS ( clLinkProgram); ICD_GET_FUNCTION_ADDRESS ( clUnloadPlatformCompiler); ICD_GET_FUNCTION_ADDRESS ( clGetKernelArgInfo); ICD_GET_FUNCTION_ADDRESS ( clEnqueueFillBuffer); ICD_GET_FUNCTION_ADDRESS ( clEnqueueFillImage); ICD_GET_FUNCTION_ADDRESS ( clEnqueueMigrateMemObjects); ICD_GET_FUNCTION_ADDRESS ( clEnqueueMarkerWithWaitList); ICD_GET_FUNCTION_ADDRESS ( clEnqueueBarrierWithWaitList); ICD_GET_FUNCTION_ADDRESS ( clGetExtensionFunctionAddressForPlatform); ICD_GET_FUNCTION_ADDRESS ( clCreateFromGLTexture); #if 0 /* cl_khr_d3d11_sharing */ ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); /* cl_khr_dx9_media_sharing */ ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); /* cl_khr_egl_image */ ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); /* cl_khr_egl_event */ ICD_GET_FUNCTION_ADDRESS( NULL ); /* OpenCL 2.0 */ ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); /* cl_khr_sub_groups */ ICD_GET_FUNCTION_ADDRESS( NULL ); /* OpenCL 2.1 */ ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); /* OpenCL 2.2 */ ICD_GET_FUNCTION_ADDRESS( NULL ); ICD_GET_FUNCTION_ADDRESS( NULL ); #endif /* OpenCL 3.0 */ ICD_GET_FUNCTION_ADDRESS ( clCreateBufferWithProperties ); ICD_GET_FUNCTION_ADDRESS ( clCreateImageWithProperties ); ICD_GET_FUNCTION_ADDRESS ( clSetContextDestructorCallback ); return NULL; } cl_int CL_API_CALL clIcdSetPlatformDispatchDataKHR( cl_platform_id platform, void *disp_data) { ((struct CLIplatform_st *)platform)->dispData = disp_data; return CL_SUCCESS; } #endif //CL_ENABLE_ICD2 OpenCL-ICD-Loader-2025.07.22/test/driver_stub/icd_driver_exports.map000066400000000000000000000001321503776305700247510ustar00rootroot00000000000000{ global: clGetExtensionFunctionAddress; clGetPlatformInfo; local: *; }; OpenCL-ICD-Loader-2025.07.22/test/driver_stub/icd_structs.h000066400000000000000000000042401503776305700230570ustar00rootroot00000000000000#ifndef _ICD_STRUCTS_H_ #define _ICD_STRUCTS_H_ typedef struct CLIicdDispatchTable_st CLIicdDispatchTable; typedef struct CLIplatform_st CLIplatform; struct CLIicdDispatchTable_st { void *entries[256]; int entryCount; }; #ifdef CL_ENABLE_ICD2 #define CL_OBJECT_BODY \ CLIicdDispatchTable* dispatch; \ void* dispData #define CL_INIT_OBJECT(obj, parent) \ do \ { \ obj->dispatch = parent->dispatch; \ obj->dispData = parent->dispData; \ } while (0) #define CL_INIT_PLATFORM(obj, table) \ do \ { \ obj->dispatch = table; \ obj->dispData = NULL; \ } while (0) #else //defined(CL_ENABLE_ICD2) #define CL_OBJECT_BODY \ CLIicdDispatchTable* dispatch #define CL_INIT_OBJECT(obj, parent) \ do \ { \ obj->dispatch = parent->dispatch; \ } while (0) #define CL_INIT_PLATFORM(obj, table) \ do \ { \ obj->dispatch = table; \ } while (0) #endif //defined(CL_ENABLE_ICD2) struct CLIplatform_st { CL_OBJECT_BODY; }; #endif /* _ICD_STRUCTS_H_ */ OpenCL-ICD-Loader-2025.07.22/test/driver_stub/rename_api.h000066400000000000000000000165521503776305700226420ustar00rootroot00000000000000#ifndef _RENAME_API_H_ #define _RENAME_API_H_ #define clGetPlatformIDs ___clGetPlatformIDs #define clGetPlatformInfo ___clGetPlatformInfo #define clGetDeviceIDs ___clGetDeviceIDs #define clGetDeviceInfo ___clGetDeviceInfo #define clCreateSubDevices ___clCreateSubDevices #define clRetainDevice ___clRetainDevice #define clReleaseDevice ___clReleaseDevice #define clCreateContext ___clCreateContext #define clCreateContextFromType ___clCreateContextFromType #define clRetainContext ___clRetainContext #define clReleaseContext ___clReleaseContext #define clGetContextInfo ___clGetContextInfo #define clCreateCommandQueue ___clCreateCommandQueue #define clSetCommandQueueProperty ___clSetCommandQueueProperty #define clRetainCommandQueue ___clRetainCommandQueue #define clReleaseCommandQueue ___clReleaseCommandQueue #define clGetCommandQueueInfo ___clGetCommandQueueInfo #define clCreateBuffer ___clCreateBuffer #define clCreateSubBuffer ___clCreateSubBuffer #define clCreateImage ___clCreateImage #define clCreateImage2D ___clCreateImage2D #define clCreateImage3D ___clCreateImage3D #define clRetainMemObject ___clRetainMemObject #define clReleaseMemObject ___clReleaseMemObject #define clGetSupportedImageFormats ___clGetSupportedImageFormats #define clGetMemObjectInfo ___clGetMemObjectInfo #define clGetImageInfo ___clGetImageInfo #define clSetMemObjectDestructorCallback ___clSetMemObjectDestructorCallback #define clCreateSampler ___clCreateSampler #define clRetainSampler ___clRetainSampler #define clReleaseSampler ___clReleaseSampler #define clGetSamplerInfo ___clGetSamplerInfo #define clCreateProgramWithSource ___clCreateProgramWithSource #define clCreateProgramWithBinary ___clCreateProgramWithBinary #define clCreateProgramWithBuiltInKernels ___clCreateProgramWithBuiltInKernels #define clRetainProgram ___clRetainProgram #define clReleaseProgram ___clReleaseProgram #define clBuildProgram ___clBuildProgram #define clUnloadCompiler ___clUnloadCompiler #define clCompileProgram ___clCompileProgram #define clLinkProgram ___clLinkProgram #define clUnloadPlatformCompiler ___clUnloadPlatformCompiler #define clGetProgramInfo ___clGetProgramInfo #define clGetProgramBuildInfo ___clGetProgramBuildInfo #define clCreateKernel ___clCreateKernel #define clCreateKernelsInProgram ___clCreateKernelsInProgram #define clRetainKernel ___clRetainKernel #define clReleaseKernel ___clReleaseKernel #define clSetKernelArg ___clSetKernelArg #define clGetKernelInfo ___clGetKernelInfo #define clGetKernelArgInfo ___clGetKernelArgInfo #define clGetKernelWorkGroupInfo ___clGetKernelWorkGroupInfo #define clWaitForEvents ___clWaitForEvents #define clGetEventInfo ___clGetEventInfo #define clCreateUserEvent ___clCreateUserEvent #define clRetainEvent ___clRetainEvent #define clReleaseEvent ___clReleaseEvent #define clSetUserEventStatus ___clSetUserEventStatus #define clSetEventCallback ___clSetEventCallback #define clGetEventProfilingInfo ___clGetEventProfilingInfo #define clFlush ___clFlush #define clFinish ___clFinish #define clEnqueueReadBuffer ___clEnqueueReadBuffer #define clEnqueueReadBufferRect ___clEnqueueReadBufferRect #define clEnqueueWriteBuffer ___clEnqueueWriteBuffer #define clEnqueueWriteBufferRect ___clEnqueueWriteBufferRect #define clEnqueueCopyBuffer ___clEnqueueCopyBuffer #define clEnqueueCopyBufferRect ___clEnqueueCopyBufferRect #define clEnqueueFillBuffer ___clEnqueueFillBuffer #define clEnqueueFillImage ___clEnqueueFillImage #define clEnqueueReadImage ___clEnqueueReadImage #define clEnqueueWriteImage ___clEnqueueWriteImage #define clEnqueueCopyImage ___clEnqueueCopyImage #define clEnqueueCopyImageToBuffer ___clEnqueueCopyImageToBuffer #define clEnqueueCopyBufferToImage ___clEnqueueCopyBufferToImage #define clEnqueueMapBuffer ___clEnqueueMapBuffer #define clEnqueueMapImage ___clEnqueueMapImage #define clEnqueueUnmapMemObject ___clEnqueueUnmapMemObject #define clEnqueueMigrateMemObjects ___clEnqueueMigrateMemObjects #define clEnqueueNDRangeKernel ___clEnqueueNDRangeKernel #define clEnqueueTask ___clEnqueueTask #define clEnqueueNativeKernel ___clEnqueueNativeKernel #define clGetExtensionFunctionAddressForPlatform ___clGetExtensionFunctionAddressForPlatform #define clEnqueueMarkerWithWaitList ___clEnqueueMarkerWithWaitList #define clEnqueueBarrierWithWaitList ___clEnqueueBarrierWithWaitList #define clSetPrintfCallback ___clSetPrintfCallback #define clEnqueueMarker ___clEnqueueMarker #define clEnqueueWaitForEvents ___clEnqueueWaitForEvents #define clEnqueueBarrier ___clEnqueueBarrier #define clCreateFromGLBuffer ___clCreateFromGLBuffer #define clCreateFromGLTexture ___clCreateFromGLTexture #define clCreateFromGLTexture2D ___clCreateFromGLTexture2D #define clCreateFromGLTexture3D ___clCreateFromGLTexture3D #define clCreateFromGLRenderbuffer ___clCreateFromGLRenderbuffer #define clGetGLObjectInfo ___clGetGLObjectInfo #define clGetGLTextureInfo ___clGetGLTextureInfo #define clEnqueueAcquireGLObjects ___clEnqueueAcquireGLObjects #define clEnqueueReleaseGLObjects ___clEnqueueReleaseGLObjects #define clGetGLContextInfoKHR ___clGetGLContextInfoKHR #define clCreateEventFromGLsyncKHR ___clCreateEventFromGLsyncKHR #define clCreateBufferWithProperties ___clCreateBufferWithProperties #define clCreateImageWithProperties ___clCreateImageWithProperties #define clSetContextDestructorCallback ___clSetContextDestructorCallback #endif /* __RENAME_API_H__ */ OpenCL-ICD-Loader-2025.07.22/test/inc/000077500000000000000000000000001503776305700166015ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/inc/platform/000077500000000000000000000000001503776305700204255ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/inc/platform/icd_test_log.h000066400000000000000000000021331503776305700232340ustar00rootroot00000000000000#ifndef _ICD_TEST_LOG_H_ #define _ICD_TEST_LOG_H_ #if defined(_WIN32) #include #else #include #endif #if defined(_WIN32) || defined(__CYGWIN__) #define DllExport __declspec(dllexport) #else #ifndef __has_attribute #define __has_attribute(x) 0 // Compatibility with non-clang compilers. #endif #if (defined(__GNUC__) && (__GNUC__ >= 4)) ||\ (defined(__clang__) && __has_attribute(visibility)) #define DllExport __attribute__((visibility("default"))) #else #define DllExport #endif #endif DllExport const char * log_getenv(const char *name, const char *dflt); DllExport void log_freeenv(const char *var); DllExport int test_icd_initialize_app_log(void); DllExport void test_icd_app_log(const char *format, ...); DllExport void test_icd_close_app_log(void); DllExport char *test_icd_get_stub_log(void); DllExport int test_icd_initialize_stub_log(void); DllExport void test_icd_stub_log(const char *format, ...); DllExport void test_icd_close_stub_log(void); DllExport char *test_icd_get_app_log(void); #endif /* _ICD_TEST_LOG_H_ */ OpenCL-ICD-Loader-2025.07.22/test/layer/000077500000000000000000000000001503776305700171445ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/layer/CMakeLists.txt000066400000000000000000000013501503776305700217030ustar00rootroot00000000000000set (OPENCL_PRINT_LAYER_SOURCES icd_print_layer.c icd_print_layer.h icd_print_layer_generated.c) if (WIN32) list (APPEND OPENCL_PRINT_LAYER_SOURCES icd_print_layer.def) else () if (NOT APPLE) list (APPEND OPENCL_PRINT_LAYER_SOURCES icd_print_layer.map) endif () endif () add_library (PrintLayer SHARED ${OPENCL_PRINT_LAYER_SOURCES}) target_include_directories(PrintLayer PRIVATE ${PARENT_DIR}/include) target_link_libraries(PrintLayer PUBLIC OpenCL::Headers) target_compile_definitions (PrintLayer PRIVATE CL_TARGET_OPENCL_VERSION=300) if (NOT WIN32 AND NOT APPLE) set_target_properties (PrintLayer PROPERTIES LINK_FLAGS "-Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/icd_print_layer.map") endif () OpenCL-ICD-Loader-2025.07.22/test/layer/icd_print_layer.c000066400000000000000000000052031503776305700224570ustar00rootroot00000000000000/* * Copyright (c) 2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd_print_layer.h" #include #include #include struct _cl_icd_dispatch dispatch; const struct _cl_icd_dispatch *tdispatch; static cl_layer_api_version api_version = CL_LAYER_API_VERSION_100; static const char name[] = "print_layer"; static inline cl_int set_param_value( size_t param_value_size, void *param_value, size_t *param_value_size_ret, size_t src_size, const void *src) { if (param_value && param_value_size < src_size) return CL_INVALID_VALUE; if (param_value) memcpy(param_value, src, src_size); if (param_value_size_ret) *param_value_size_ret = src_size; return CL_SUCCESS; } CL_API_ENTRY cl_int CL_API_CALL clGetLayerInfo( cl_layer_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret) { size_t sz = 0; const void *src = NULL; if (param_value_size && !param_value) return CL_INVALID_VALUE; if (!param_value && !param_value_size_ret) return CL_INVALID_VALUE; switch (param_name) { case CL_LAYER_API_VERSION: sz = sizeof(api_version); src = &api_version; break; case CL_LAYER_NAME: sz = sizeof(name); src = name; break; default: return CL_INVALID_VALUE; } return set_param_value(param_value_size, param_value, param_value_size_ret, sz, src); } CL_API_ENTRY cl_int CL_API_CALL clInitLayer( cl_uint num_entries, const struct _cl_icd_dispatch *target_dispatch, cl_uint *num_entries_out, const struct _cl_icd_dispatch **layer_dispatch_ret) { if (!target_dispatch || !layer_dispatch_ret || !num_entries_out || num_entries < sizeof(dispatch)/sizeof(dispatch.clGetPlatformIDs)) return CL_INVALID_VALUE; _init_dispatch(); tdispatch = target_dispatch; *layer_dispatch_ret = &dispatch; *num_entries_out = sizeof(dispatch)/sizeof(dispatch.clGetPlatformIDs); return CL_SUCCESS; } OpenCL-ICD-Loader-2025.07.22/test/layer/icd_print_layer.def000066400000000000000000000000431503776305700227700ustar00rootroot00000000000000EXPORTS clGetLayerInfo clInitLayer OpenCL-ICD-Loader-2025.07.22/test/layer/icd_print_layer.h000066400000000000000000000030371503776305700224670ustar00rootroot00000000000000/* * Copyright (c) 2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #ifndef __ICD_PRINT_LAYER_H #define __ICD_PRINT_LAYER_H #ifndef CL_USE_DEPRECATED_OPENCL_1_0_APIS #define CL_USE_DEPRECATED_OPENCL_1_0_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_1_1_APIS #define CL_USE_DEPRECATED_OPENCL_1_1_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_0_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_1_APIS #define CL_USE_DEPRECATED_OPENCL_2_1_APIS #endif #ifndef CL_USE_DEPRECATED_OPENCL_2_2_APIS #define CL_USE_DEPRECATED_OPENCL_2_2_APIS #endif #include #include #ifdef __cplusplus extern "C" { #endif extern struct _cl_icd_dispatch dispatch; extern const struct _cl_icd_dispatch *tdispatch; extern void _init_dispatch(void); #ifdef __cplusplus } #endif #endif /* __ICD_PRINT_LAYER_H */ OpenCL-ICD-Loader-2025.07.22/test/layer/icd_print_layer.map000066400000000000000000000001051503776305700230060ustar00rootroot00000000000000{ global: clGetLayerInfo; clInitLayer; local: *; }; OpenCL-ICD-Loader-2025.07.22/test/layer/icd_print_layer_generated.c000066400000000000000000002515071503776305700245070ustar00rootroot00000000000000/* * Copyright (c) 2020 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * OpenCL is a trademark of Apple Inc. used under license by Khronos. */ #include "icd_print_layer.h" /////////////////////////////////////////////////////////////////////////////// // Core APIs: static cl_int CL_API_CALL clGetPlatformIDs_wrap( cl_uint num_entries, cl_platform_id* platforms, cl_uint* num_platforms) CL_API_SUFFIX__VERSION_1_0 { printf("clGetPlatformIDs\n"); return tdispatch->clGetPlatformIDs( num_entries, platforms, num_platforms); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetPlatformInfo_wrap( cl_platform_id platform, cl_platform_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetPlatformInfo\n"); return tdispatch->clGetPlatformInfo( platform, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetDeviceIDs_wrap( cl_platform_id platform, cl_device_type device_type, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_0 { printf("clGetDeviceIDs\n"); return tdispatch->clGetDeviceIDs( platform, device_type, num_entries, devices, num_devices); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetDeviceInfo_wrap( cl_device_id device, cl_device_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetDeviceInfo\n"); return tdispatch->clGetDeviceInfo( device, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_context CL_API_CALL clCreateContext_wrap( const cl_context_properties* properties, cl_uint num_devices, const cl_device_id* devices, void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data), void* user_data, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateContext\n"); return tdispatch->clCreateContext( properties, num_devices, devices, pfn_notify, user_data, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_context CL_API_CALL clCreateContextFromType_wrap( const cl_context_properties* properties, cl_device_type device_type, void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data), void* user_data, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateContextFromType\n"); return tdispatch->clCreateContextFromType( properties, device_type, pfn_notify, user_data, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clRetainContext_wrap( cl_context context) CL_API_SUFFIX__VERSION_1_0 { printf("clRetainContext\n"); return tdispatch->clRetainContext( context); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clReleaseContext_wrap( cl_context context) CL_API_SUFFIX__VERSION_1_0 { printf("clReleaseContext\n"); return tdispatch->clReleaseContext( context); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetContextInfo_wrap( cl_context context, cl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetContextInfo\n"); return tdispatch->clGetContextInfo( context, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clRetainCommandQueue_wrap( cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { printf("clRetainCommandQueue\n"); return tdispatch->clRetainCommandQueue( command_queue); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clReleaseCommandQueue_wrap( cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { printf("clReleaseCommandQueue\n"); return tdispatch->clReleaseCommandQueue( command_queue); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetCommandQueueInfo_wrap( cl_command_queue command_queue, cl_command_queue_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetCommandQueueInfo\n"); return tdispatch->clGetCommandQueueInfo( command_queue, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_mem CL_API_CALL clCreateBuffer_wrap( cl_context context, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateBuffer\n"); return tdispatch->clCreateBuffer( context, flags, size, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clRetainMemObject_wrap( cl_mem memobj) CL_API_SUFFIX__VERSION_1_0 { printf("clRetainMemObject\n"); return tdispatch->clRetainMemObject( memobj); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clReleaseMemObject_wrap( cl_mem memobj) CL_API_SUFFIX__VERSION_1_0 { printf("clReleaseMemObject\n"); return tdispatch->clReleaseMemObject( memobj); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetSupportedImageFormats_wrap( cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, cl_uint num_entries, cl_image_format* image_formats, cl_uint* num_image_formats) CL_API_SUFFIX__VERSION_1_0 { printf("clGetSupportedImageFormats\n"); return tdispatch->clGetSupportedImageFormats( context, flags, image_type, num_entries, image_formats, num_image_formats); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetMemObjectInfo_wrap( cl_mem memobj, cl_mem_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetMemObjectInfo\n"); return tdispatch->clGetMemObjectInfo( memobj, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetImageInfo_wrap( cl_mem image, cl_image_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetImageInfo\n"); return tdispatch->clGetImageInfo( image, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clRetainSampler_wrap( cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0 { printf("clRetainSampler\n"); return tdispatch->clRetainSampler( sampler); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clReleaseSampler_wrap( cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0 { printf("clReleaseSampler\n"); return tdispatch->clReleaseSampler( sampler); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetSamplerInfo_wrap( cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetSamplerInfo\n"); return tdispatch->clGetSamplerInfo( sampler, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_program CL_API_CALL clCreateProgramWithSource_wrap( cl_context context, cl_uint count, const char** strings, const size_t* lengths, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateProgramWithSource\n"); return tdispatch->clCreateProgramWithSource( context, count, strings, lengths, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_program CL_API_CALL clCreateProgramWithBinary_wrap( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const size_t* lengths, const unsigned char** binaries, cl_int* binary_status, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateProgramWithBinary\n"); return tdispatch->clCreateProgramWithBinary( context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clRetainProgram_wrap( cl_program program) CL_API_SUFFIX__VERSION_1_0 { printf("clRetainProgram\n"); return tdispatch->clRetainProgram( program); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clReleaseProgram_wrap( cl_program program) CL_API_SUFFIX__VERSION_1_0 { printf("clReleaseProgram\n"); return tdispatch->clReleaseProgram( program); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clBuildProgram_wrap( cl_program program, cl_uint num_devices, const cl_device_id* device_list, const char* options, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) CL_API_SUFFIX__VERSION_1_0 { printf("clBuildProgram\n"); return tdispatch->clBuildProgram( program, num_devices, device_list, options, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetProgramInfo_wrap( cl_program program, cl_program_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetProgramInfo\n"); return tdispatch->clGetProgramInfo( program, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetProgramBuildInfo_wrap( cl_program program, cl_device_id device, cl_program_build_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetProgramBuildInfo\n"); return tdispatch->clGetProgramBuildInfo( program, device, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_kernel CL_API_CALL clCreateKernel_wrap( cl_program program, const char* kernel_name, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateKernel\n"); return tdispatch->clCreateKernel( program, kernel_name, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clCreateKernelsInProgram_wrap( cl_program program, cl_uint num_kernels, cl_kernel* kernels, cl_uint* num_kernels_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateKernelsInProgram\n"); return tdispatch->clCreateKernelsInProgram( program, num_kernels, kernels, num_kernels_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clRetainKernel_wrap( cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0 { printf("clRetainKernel\n"); return tdispatch->clRetainKernel( kernel); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clReleaseKernel_wrap( cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0 { printf("clReleaseKernel\n"); return tdispatch->clReleaseKernel( kernel); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetKernelArg_wrap( cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void* arg_value) CL_API_SUFFIX__VERSION_1_0 { printf("clSetKernelArg\n"); return tdispatch->clSetKernelArg( kernel, arg_index, arg_size, arg_value); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetKernelInfo_wrap( cl_kernel kernel, cl_kernel_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetKernelInfo\n"); return tdispatch->clGetKernelInfo( kernel, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetKernelWorkGroupInfo_wrap( cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetKernelWorkGroupInfo\n"); return tdispatch->clGetKernelWorkGroupInfo( kernel, device, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clWaitForEvents_wrap( cl_uint num_events, const cl_event* event_list) CL_API_SUFFIX__VERSION_1_0 { printf("clWaitForEvents\n"); return tdispatch->clWaitForEvents( num_events, event_list); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetEventInfo_wrap( cl_event event, cl_event_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetEventInfo\n"); return tdispatch->clGetEventInfo( event, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clRetainEvent_wrap( cl_event event) CL_API_SUFFIX__VERSION_1_0 { printf("clRetainEvent\n"); return tdispatch->clRetainEvent( event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clReleaseEvent_wrap( cl_event event) CL_API_SUFFIX__VERSION_1_0 { printf("clReleaseEvent\n"); return tdispatch->clReleaseEvent( event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetEventProfilingInfo_wrap( cl_event event, cl_profiling_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetEventProfilingInfo\n"); return tdispatch->clGetEventProfilingInfo( event, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clFlush_wrap( cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { printf("clFlush\n"); return tdispatch->clFlush( command_queue); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clFinish_wrap( cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0 { printf("clFinish\n"); return tdispatch->clFinish( command_queue); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueReadBuffer_wrap( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, size_t offset, size_t size, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueReadBuffer\n"); return tdispatch->clEnqueueReadBuffer( command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueWriteBuffer_wrap( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, size_t offset, size_t size, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueWriteBuffer\n"); return tdispatch->clEnqueueWriteBuffer( command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueCopyBuffer_wrap( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueCopyBuffer\n"); return tdispatch->clEnqueueCopyBuffer( command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueReadImage_wrap( cl_command_queue command_queue, cl_mem image, cl_bool blocking_read, const size_t* origin, const size_t* region, size_t row_pitch, size_t slice_pitch, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueReadImage\n"); return tdispatch->clEnqueueReadImage( command_queue, image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueWriteImage_wrap( cl_command_queue command_queue, cl_mem image, cl_bool blocking_write, const size_t* origin, const size_t* region, size_t input_row_pitch, size_t input_slice_pitch, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueWriteImage\n"); return tdispatch->clEnqueueWriteImage( command_queue, image, blocking_write, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueCopyImage_wrap( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image, const size_t* src_origin, const size_t* dst_origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueCopyImage\n"); return tdispatch->clEnqueueCopyImage( command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueCopyImageToBuffer_wrap( cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer, const size_t* src_origin, const size_t* region, size_t dst_offset, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueCopyImageToBuffer\n"); return tdispatch->clEnqueueCopyImageToBuffer( command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueCopyBufferToImage_wrap( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image, size_t src_offset, const size_t* dst_origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueCopyBufferToImage\n"); return tdispatch->clEnqueueCopyBufferToImage( command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static void* CL_API_CALL clEnqueueMapBuffer_wrap( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueMapBuffer\n"); return tdispatch->clEnqueueMapBuffer( command_queue, buffer, blocking_map, map_flags, offset, size, num_events_in_wait_list, event_wait_list, event, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static void* CL_API_CALL clEnqueueMapImage_wrap( cl_command_queue command_queue, cl_mem image, cl_bool blocking_map, cl_map_flags map_flags, const size_t* origin, const size_t* region, size_t* image_row_pitch, size_t* image_slice_pitch, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueMapImage\n"); return tdispatch->clEnqueueMapImage( command_queue, image, blocking_map, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueUnmapMemObject_wrap( cl_command_queue command_queue, cl_mem memobj, void* mapped_ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueUnmapMemObject\n"); return tdispatch->clEnqueueUnmapMemObject( command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueNDRangeKernel_wrap( cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t* global_work_offset, const size_t* global_work_size, const size_t* local_work_size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueNDRangeKernel\n"); return tdispatch->clEnqueueNDRangeKernel( command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueNativeKernel_wrap( cl_command_queue command_queue, void (CL_CALLBACK* user_func)(void*), void* args, size_t cb_args, cl_uint num_mem_objects, const cl_mem* mem_list, const void** args_mem_loc, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueNativeKernel\n"); return tdispatch->clEnqueueNativeKernel( command_queue, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetCommandQueueProperty_wrap( cl_command_queue command_queue, cl_command_queue_properties properties, cl_bool enable, cl_command_queue_properties* old_properties) CL_API_SUFFIX__VERSION_1_0_DEPRECATED { printf("clSetCommandQueueProperty\n"); return tdispatch->clSetCommandQueueProperty( command_queue, properties, enable, old_properties); } /////////////////////////////////////////////////////////////////////////////// static cl_mem CL_API_CALL clCreateImage2D_wrap( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_row_pitch, void* host_ptr, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clCreateImage2D\n"); return tdispatch->clCreateImage2D( context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_mem CL_API_CALL clCreateImage3D_wrap( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, size_t image_width, size_t image_height, size_t image_depth, size_t image_row_pitch, size_t image_slice_pitch, void* host_ptr, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clCreateImage3D\n"); return tdispatch->clCreateImage3D( context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueMarker_wrap( cl_command_queue command_queue, cl_event* event) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clEnqueueMarker\n"); return tdispatch->clEnqueueMarker( command_queue, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueWaitForEvents_wrap( cl_command_queue command_queue, cl_uint num_events, const cl_event* event_list) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clEnqueueWaitForEvents\n"); return tdispatch->clEnqueueWaitForEvents( command_queue, num_events, event_list); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueBarrier_wrap( cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clEnqueueBarrier\n"); return tdispatch->clEnqueueBarrier( command_queue); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clUnloadCompiler_wrap( void ) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clUnloadCompiler\n"); return tdispatch->clUnloadCompiler( ); } /////////////////////////////////////////////////////////////////////////////// static void* CL_API_CALL clGetExtensionFunctionAddress_wrap( const char* func_name) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clGetExtensionFunctionAddress\n"); return tdispatch->clGetExtensionFunctionAddress( func_name); } /////////////////////////////////////////////////////////////////////////////// static cl_command_queue CL_API_CALL clCreateCommandQueue_wrap( cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2_DEPRECATED { printf("clCreateCommandQueue\n"); return tdispatch->clCreateCommandQueue( context, device, properties, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_sampler CL_API_CALL clCreateSampler_wrap( cl_context context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2_DEPRECATED { printf("clCreateSampler\n"); return tdispatch->clCreateSampler( context, normalized_coords, addressing_mode, filter_mode, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueTask_wrap( cl_command_queue command_queue, cl_kernel kernel, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2_DEPRECATED { printf("clEnqueueTask\n"); return tdispatch->clEnqueueTask( command_queue, kernel, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_mem CL_API_CALL clCreateSubBuffer_wrap( cl_mem buffer, cl_mem_flags flags, cl_buffer_create_type buffer_create_type, const void* buffer_create_info, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1 { printf("clCreateSubBuffer\n"); return tdispatch->clCreateSubBuffer( buffer, flags, buffer_create_type, buffer_create_info, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetMemObjectDestructorCallback_wrap( cl_mem memobj, void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data), void* user_data) CL_API_SUFFIX__VERSION_1_1 { printf("clSetMemObjectDestructorCallback\n"); return tdispatch->clSetMemObjectDestructorCallback( memobj, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// static cl_event CL_API_CALL clCreateUserEvent_wrap( cl_context context, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1 { printf("clCreateUserEvent\n"); return tdispatch->clCreateUserEvent( context, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetUserEventStatus_wrap( cl_event event, cl_int execution_status) CL_API_SUFFIX__VERSION_1_1 { printf("clSetUserEventStatus\n"); return tdispatch->clSetUserEventStatus( event, execution_status); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetEventCallback_wrap( cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK* pfn_notify)(cl_event event, cl_int event_command_status, void *user_data), void* user_data) CL_API_SUFFIX__VERSION_1_1 { printf("clSetEventCallback\n"); return tdispatch->clSetEventCallback( event, command_exec_callback_type, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueReadBufferRect_wrap( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read, const size_t* buffer_origin, const size_t* host_origin, const size_t* region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_1 { printf("clEnqueueReadBufferRect\n"); return tdispatch->clEnqueueReadBufferRect( command_queue, buffer, blocking_read, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueWriteBufferRect_wrap( cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write, const size_t* buffer_origin, const size_t* host_origin, const size_t* region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, const void* ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_1 { printf("clEnqueueWriteBufferRect\n"); return tdispatch->clEnqueueWriteBufferRect( command_queue, buffer, blocking_write, buffer_origin, host_origin, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueCopyBufferRect_wrap( cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, const size_t* src_origin, const size_t* dst_origin, const size_t* region, size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch, size_t dst_slice_pitch, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_1 { printf("clEnqueueCopyBufferRect\n"); return tdispatch->clEnqueueCopyBufferRect( command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clCreateSubDevices_wrap( cl_device_id in_device, const cl_device_partition_property* properties, cl_uint num_devices, cl_device_id* out_devices, cl_uint* num_devices_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clCreateSubDevices\n"); return tdispatch->clCreateSubDevices( in_device, properties, num_devices, out_devices, num_devices_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clRetainDevice_wrap( cl_device_id device) CL_API_SUFFIX__VERSION_1_2 { printf("clRetainDevice\n"); return tdispatch->clRetainDevice( device); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clReleaseDevice_wrap( cl_device_id device) CL_API_SUFFIX__VERSION_1_2 { printf("clReleaseDevice\n"); return tdispatch->clReleaseDevice( device); } /////////////////////////////////////////////////////////////////////////////// static cl_mem CL_API_CALL clCreateImage_wrap( cl_context context, cl_mem_flags flags, const cl_image_format* image_format, const cl_image_desc* image_desc, void* host_ptr, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clCreateImage\n"); return tdispatch->clCreateImage( context, flags, image_format, image_desc, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_program CL_API_CALL clCreateProgramWithBuiltInKernels_wrap( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const char* kernel_names, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clCreateProgramWithBuiltInKernels\n"); return tdispatch->clCreateProgramWithBuiltInKernels( context, num_devices, device_list, kernel_names, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clCompileProgram_wrap( cl_program program, cl_uint num_devices, const cl_device_id* device_list, const char* options, cl_uint num_input_headers, const cl_program* input_headers, const char** header_include_names, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) CL_API_SUFFIX__VERSION_1_2 { printf("clCompileProgram\n"); return tdispatch->clCompileProgram( program, num_devices, device_list, options, num_input_headers, input_headers, header_include_names, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// static cl_program CL_API_CALL clLinkProgram_wrap( cl_context context, cl_uint num_devices, const cl_device_id* device_list, const char* options, cl_uint num_input_programs, const cl_program* input_programs, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clLinkProgram\n"); return tdispatch->clLinkProgram( context, num_devices, device_list, options, num_input_programs, input_programs, pfn_notify, user_data, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clUnloadPlatformCompiler_wrap( cl_platform_id platform) CL_API_SUFFIX__VERSION_1_2 { printf("clUnloadPlatformCompiler\n"); return tdispatch->clUnloadPlatformCompiler( platform); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetKernelArgInfo_wrap( cl_kernel kernel, cl_uint arg_index, cl_kernel_arg_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clGetKernelArgInfo\n"); return tdispatch->clGetKernelArgInfo( kernel, arg_index, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueFillBuffer_wrap( cl_command_queue command_queue, cl_mem buffer, const void* pattern, size_t pattern_size, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueFillBuffer\n"); return tdispatch->clEnqueueFillBuffer( command_queue, buffer, pattern, pattern_size, offset, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueFillImage_wrap( cl_command_queue command_queue, cl_mem image, const void* fill_color, const size_t* origin, const size_t* region, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueFillImage\n"); return tdispatch->clEnqueueFillImage( command_queue, image, fill_color, origin, region, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueMigrateMemObjects_wrap( cl_command_queue command_queue, cl_uint num_mem_objects, const cl_mem* mem_objects, cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueMigrateMemObjects\n"); return tdispatch->clEnqueueMigrateMemObjects( command_queue, num_mem_objects, mem_objects, flags, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueMarkerWithWaitList_wrap( cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueMarkerWithWaitList\n"); return tdispatch->clEnqueueMarkerWithWaitList( command_queue, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueBarrierWithWaitList_wrap( cl_command_queue command_queue, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueBarrierWithWaitList\n"); return tdispatch->clEnqueueBarrierWithWaitList( command_queue, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static void* CL_API_CALL clGetExtensionFunctionAddressForPlatform_wrap( cl_platform_id platform, const char* func_name) CL_API_SUFFIX__VERSION_1_2 { printf("clGetExtensionFunctionAddressForPlatform\n"); return tdispatch->clGetExtensionFunctionAddressForPlatform( platform, func_name); } /////////////////////////////////////////////////////////////////////////////// static cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties_wrap( cl_context context, cl_device_id device, const cl_queue_properties* properties, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_0 { printf("clCreateCommandQueueWithProperties\n"); return tdispatch->clCreateCommandQueueWithProperties( context, device, properties, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_mem CL_API_CALL clCreatePipe_wrap( cl_context context, cl_mem_flags flags, cl_uint pipe_packet_size, cl_uint pipe_max_packets, const cl_pipe_properties* properties, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_0 { printf("clCreatePipe\n"); return tdispatch->clCreatePipe( context, flags, pipe_packet_size, pipe_max_packets, properties, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetPipeInfo_wrap( cl_mem pipe, cl_pipe_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_2_0 { printf("clGetPipeInfo\n"); return tdispatch->clGetPipeInfo( pipe, param_name, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static void* CL_API_CALL clSVMAlloc_wrap( cl_context context, cl_svm_mem_flags flags, size_t size, cl_uint alignment) CL_API_SUFFIX__VERSION_2_0 { printf("clSVMAlloc\n"); return tdispatch->clSVMAlloc( context, flags, size, alignment); } /////////////////////////////////////////////////////////////////////////////// static void CL_API_CALL clSVMFree_wrap( cl_context context, void* svm_pointer) CL_API_SUFFIX__VERSION_2_0 { printf("clSVMFree\n"); tdispatch->clSVMFree( context, svm_pointer); } /////////////////////////////////////////////////////////////////////////////// static cl_sampler CL_API_CALL clCreateSamplerWithProperties_wrap( cl_context context, const cl_sampler_properties* sampler_properties, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_0 { printf("clCreateSamplerWithProperties\n"); return tdispatch->clCreateSamplerWithProperties( context, sampler_properties, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetKernelArgSVMPointer_wrap( cl_kernel kernel, cl_uint arg_index, const void* arg_value) CL_API_SUFFIX__VERSION_2_0 { printf("clSetKernelArgSVMPointer\n"); return tdispatch->clSetKernelArgSVMPointer( kernel, arg_index, arg_value); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetKernelExecInfo_wrap( cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value) CL_API_SUFFIX__VERSION_2_0 { printf("clSetKernelExecInfo\n"); return tdispatch->clSetKernelExecInfo( kernel, param_name, param_value_size, param_value); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueSVMFree_wrap( cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[], void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_2_0 { printf("clEnqueueSVMFree\n"); return tdispatch->clEnqueueSVMFree( command_queue, num_svm_pointers, svm_pointers, pfn_free_func, user_data, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueSVMMemcpy_wrap( cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_2_0 { printf("clEnqueueSVMMemcpy\n"); return tdispatch->clEnqueueSVMMemcpy( command_queue, blocking_copy, dst_ptr, src_ptr, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueSVMMemFill_wrap( cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_2_0 { printf("clEnqueueSVMMemFill\n"); return tdispatch->clEnqueueSVMMemFill( command_queue, svm_ptr, pattern, pattern_size, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueSVMMap_wrap( cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags flags, void* svm_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_2_0 { printf("clEnqueueSVMMap\n"); return tdispatch->clEnqueueSVMMap( command_queue, blocking_map, flags, svm_ptr, size, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueSVMUnmap_wrap( cl_command_queue command_queue, void* svm_ptr, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_2_0 { printf("clEnqueueSVMUnmap\n"); return tdispatch->clEnqueueSVMUnmap( command_queue, svm_ptr, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetDefaultDeviceCommandQueue_wrap( cl_context context, cl_device_id device, cl_command_queue command_queue) CL_API_SUFFIX__VERSION_2_1 { printf("clSetDefaultDeviceCommandQueue\n"); return tdispatch->clSetDefaultDeviceCommandQueue( context, device, command_queue); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetDeviceAndHostTimer_wrap( cl_device_id device, cl_ulong* device_timestamp, cl_ulong* host_timestamp) CL_API_SUFFIX__VERSION_2_1 { printf("clGetDeviceAndHostTimer\n"); return tdispatch->clGetDeviceAndHostTimer( device, device_timestamp, host_timestamp); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetHostTimer_wrap( cl_device_id device, cl_ulong* host_timestamp) CL_API_SUFFIX__VERSION_2_1 { printf("clGetHostTimer\n"); return tdispatch->clGetHostTimer( device, host_timestamp); } /////////////////////////////////////////////////////////////////////////////// static cl_program CL_API_CALL clCreateProgramWithIL_wrap( cl_context context, const void* il, size_t length, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_1 { printf("clCreateProgramWithIL\n"); return tdispatch->clCreateProgramWithIL( context, il, length, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_kernel CL_API_CALL clCloneKernel_wrap( cl_kernel source_kernel, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_1 { printf("clCloneKernel\n"); return tdispatch->clCloneKernel( source_kernel, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clGetKernelSubGroupInfo_wrap( cl_kernel kernel, cl_device_id device, cl_kernel_sub_group_info param_name, size_t input_value_size, const void* input_value, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_2_1 { printf("clGetKernelSubGroupInfo\n"); return tdispatch->clGetKernelSubGroupInfo( kernel, device, param_name, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clEnqueueSVMMigrateMem_wrap( cl_command_queue command_queue, cl_uint num_svm_pointers, const void** svm_pointers, const size_t* sizes, cl_mem_migration_flags flags, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_2_1 { printf("clEnqueueSVMMigrateMem\n"); return tdispatch->clEnqueueSVMMigrateMem( command_queue, num_svm_pointers, svm_pointers, sizes, flags, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetProgramSpecializationConstant_wrap( cl_program program, cl_uint spec_id, size_t spec_size, const void* spec_value) CL_API_SUFFIX__VERSION_2_2 { printf("clSetProgramSpecializationConstant\n"); return tdispatch->clSetProgramSpecializationConstant( program, spec_id, spec_size, spec_value); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetProgramReleaseCallback_wrap( cl_program program, void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data), void* user_data) CL_API_SUFFIX__VERSION_2_2_DEPRECATED { printf("clSetProgramReleaseCallback\n"); return tdispatch->clSetProgramReleaseCallback( program, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// static cl_int CL_API_CALL clSetContextDestructorCallback_wrap( cl_context context, void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data), void* user_data) CL_API_SUFFIX__VERSION_3_0 { printf("clSetContextDestructorCallback\n"); return tdispatch->clSetContextDestructorCallback( context, pfn_notify, user_data); } /////////////////////////////////////////////////////////////////////////////// static cl_mem CL_API_CALL clCreateBufferWithProperties_wrap( cl_context context, const cl_mem_properties* properties, cl_mem_flags flags, size_t size, void* host_ptr, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_3_0 { printf("clCreateBufferWithProperties\n"); return tdispatch->clCreateBufferWithProperties( context, properties, flags, size, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// static cl_mem CL_API_CALL clCreateImageWithProperties_wrap( cl_context context, const cl_mem_properties* properties, cl_mem_flags flags, const cl_image_format* image_format, const cl_image_desc* image_desc, void* host_ptr, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_3_0 { printf("clCreateImageWithProperties\n"); return tdispatch->clCreateImageWithProperties( context, properties, flags, image_format, image_desc, host_ptr, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// // cl_ext_device_fission static cl_int CL_API_CALL clReleaseDeviceEXT_wrap( cl_device_id device) CL_API_SUFFIX__VERSION_1_1 { printf("clReleaseDeviceEXT\n"); return tdispatch->clReleaseDeviceEXT( device); } static cl_int CL_API_CALL clRetainDeviceEXT_wrap( cl_device_id device) CL_API_SUFFIX__VERSION_1_1 { printf("clRetainDeviceEXT\n"); return tdispatch->clRetainDeviceEXT( device); } static cl_int CL_API_CALL clCreateSubDevicesEXT_wrap( cl_device_id in_device, const cl_device_partition_property_ext* properties, cl_uint num_entries, cl_device_id* out_devices, cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1 { printf("clCreateSubDevicesEXT\n"); return tdispatch->clCreateSubDevicesEXT( in_device, properties, num_entries, out_devices, num_devices); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_d3d10_sharing #if defined(_WIN32) static cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR_wrap( cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source, void* d3d_object, cl_d3d10_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_0 { printf("clGetDeviceIDsFromD3D10KHR\n"); return tdispatch->clGetDeviceIDsFromD3D10KHR( platform, d3d_device_source, d3d_object, d3d_device_set, num_entries, devices, num_devices); } static cl_mem CL_API_CALL clCreateFromD3D10BufferKHR_wrap( cl_context context, cl_mem_flags flags, ID3D10Buffer* resource, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateFromD3D10BufferKHR\n"); return tdispatch->clCreateFromD3D10BufferKHR( context, flags, resource, errcode_ret); } static cl_mem CL_API_CALL clCreateFromD3D10Texture2DKHR_wrap( cl_context context, cl_mem_flags flags, ID3D10Texture2D* resource, UINT subresource, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateFromD3D10Texture2DKHR\n"); return tdispatch->clCreateFromD3D10Texture2DKHR( context, flags, resource, subresource, errcode_ret); } static cl_mem CL_API_CALL clCreateFromD3D10Texture3DKHR_wrap( cl_context context, cl_mem_flags flags, ID3D10Texture3D* resource, UINT subresource, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateFromD3D10Texture3DKHR\n"); return tdispatch->clCreateFromD3D10Texture3DKHR( context, flags, resource, subresource, errcode_ret); } static cl_int CL_API_CALL clEnqueueAcquireD3D10ObjectsKHR_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueAcquireD3D10ObjectsKHR\n"); return tdispatch->clEnqueueAcquireD3D10ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } static cl_int CL_API_CALL clEnqueueReleaseD3D10ObjectsKHR_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueReleaseD3D10ObjectsKHR\n"); return tdispatch->clEnqueueReleaseD3D10ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_d3d11_sharing #if defined(_WIN32) static cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR_wrap( cl_platform_id platform, cl_d3d11_device_source_khr d3d_device_source, void* d3d_object, cl_d3d11_device_set_khr d3d_device_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2 { printf("clGetDeviceIDsFromD3D11KHR\n"); return tdispatch->clGetDeviceIDsFromD3D11KHR( platform, d3d_device_source, d3d_object, d3d_device_set, num_entries, devices, num_devices); } static cl_mem CL_API_CALL clCreateFromD3D11BufferKHR_wrap( cl_context context, cl_mem_flags flags, ID3D11Buffer* resource, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clCreateFromD3D11BufferKHR\n"); return tdispatch->clCreateFromD3D11BufferKHR( context, flags, resource, errcode_ret); } static cl_mem CL_API_CALL clCreateFromD3D11Texture2DKHR_wrap( cl_context context, cl_mem_flags flags, ID3D11Texture2D* resource, UINT subresource, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clCreateFromD3D11Texture2DKHR\n"); return tdispatch->clCreateFromD3D11Texture2DKHR( context, flags, resource, subresource, errcode_ret); } static cl_mem CL_API_CALL clCreateFromD3D11Texture3DKHR_wrap( cl_context context, cl_mem_flags flags, ID3D11Texture3D* resource, UINT subresource, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clCreateFromD3D11Texture3DKHR\n"); return tdispatch->clCreateFromD3D11Texture3DKHR( context, flags, resource, subresource, errcode_ret); } static cl_int CL_API_CALL clEnqueueAcquireD3D11ObjectsKHR_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueAcquireD3D11ObjectsKHR\n"); return tdispatch->clEnqueueAcquireD3D11ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } static cl_int CL_API_CALL clEnqueueReleaseD3D11ObjectsKHR_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueReleaseD3D11ObjectsKHR\n"); return tdispatch->clEnqueueReleaseD3D11ObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_dx9_media_sharing #if defined(_WIN32) static cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR_wrap( cl_platform_id platform, cl_uint num_media_adapters, cl_dx9_media_adapter_type_khr* media_adapter_type, void* media_adapters, cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries, cl_device_id* devices, cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2 { printf("clGetDeviceIDsFromDX9MediaAdapterKHR\n"); return tdispatch->clGetDeviceIDsFromDX9MediaAdapterKHR( platform, num_media_adapters, media_adapter_type, media_adapters, media_adapter_set, num_entries, devices, num_devices); } static cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceKHR_wrap( cl_context context, cl_mem_flags flags, cl_dx9_media_adapter_type_khr adapter_type, void* surface_info, cl_uint plane, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clCreateFromDX9MediaSurfaceKHR\n"); return tdispatch->clCreateFromDX9MediaSurfaceKHR( context, flags, adapter_type, surface_info, plane, errcode_ret); } static cl_int CL_API_CALL clEnqueueAcquireDX9MediaSurfacesKHR_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueAcquireDX9MediaSurfacesKHR\n"); return tdispatch->clEnqueueAcquireDX9MediaSurfacesKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } static cl_int CL_API_CALL clEnqueueReleaseDX9MediaSurfacesKHR_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_2 { printf("clEnqueueReleaseDX9MediaSurfacesKHR\n"); return tdispatch->clEnqueueReleaseDX9MediaSurfacesKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } #endif // defined(_WIN32) /////////////////////////////////////////////////////////////////////////////// // cl_khr_egl_event static cl_event CL_API_CALL clCreateEventFromEGLSyncKHR_wrap( cl_context context, CLeglSyncKHR sync, CLeglDisplayKHR display, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateEventFromEGLSyncKHR\n"); return tdispatch->clCreateEventFromEGLSyncKHR( context, sync, display, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_egl_image static cl_mem CL_API_CALL clCreateFromEGLImageKHR_wrap( cl_context context, CLeglDisplayKHR egldisplay, CLeglImageKHR eglimage, cl_mem_flags flags, const cl_egl_image_properties_khr* properties, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateFromEGLImageKHR\n"); return tdispatch->clCreateFromEGLImageKHR( context, egldisplay, eglimage, flags, properties, errcode_ret); } static cl_int CL_API_CALL clEnqueueAcquireEGLObjectsKHR_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueAcquireEGLObjectsKHR\n"); return tdispatch->clEnqueueAcquireEGLObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } static cl_int CL_API_CALL clEnqueueReleaseEGLObjectsKHR_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueReleaseEGLObjectsKHR\n"); return tdispatch->clEnqueueReleaseEGLObjectsKHR( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_gl_event static cl_event CL_API_CALL clCreateEventFromGLsyncKHR_wrap( cl_context context, cl_GLsync sync, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1 { printf("clCreateEventFromGLsyncKHR\n"); return tdispatch->clCreateEventFromGLsyncKHR( context, sync, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_gl_sharing static cl_int CL_API_CALL clGetGLContextInfoKHR_wrap( const cl_context_properties* properties, cl_gl_context_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetGLContextInfoKHR\n"); return tdispatch->clGetGLContextInfoKHR( properties, param_name, param_value_size, param_value, param_value_size_ret); } static cl_mem CL_API_CALL clCreateFromGLBuffer_wrap( cl_context context, cl_mem_flags flags, cl_GLuint bufobj, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateFromGLBuffer\n"); return tdispatch->clCreateFromGLBuffer( context, flags, bufobj, errcode_ret); } static cl_mem CL_API_CALL clCreateFromGLTexture_wrap( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2 { printf("clCreateFromGLTexture\n"); return tdispatch->clCreateFromGLTexture( context, flags, target, miplevel, texture, errcode_ret); } static cl_mem CL_API_CALL clCreateFromGLRenderbuffer_wrap( cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clCreateFromGLRenderbuffer\n"); return tdispatch->clCreateFromGLRenderbuffer( context, flags, renderbuffer, errcode_ret); } static cl_int CL_API_CALL clGetGLObjectInfo_wrap( cl_mem memobj, cl_gl_object_type* gl_object_type, cl_GLuint* gl_object_name) CL_API_SUFFIX__VERSION_1_0 { printf("clGetGLObjectInfo\n"); return tdispatch->clGetGLObjectInfo( memobj, gl_object_type, gl_object_name); } static cl_int CL_API_CALL clGetGLTextureInfo_wrap( cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0 { printf("clGetGLTextureInfo\n"); return tdispatch->clGetGLTextureInfo( memobj, param_name, param_value_size, param_value, param_value_size_ret); } static cl_int CL_API_CALL clEnqueueAcquireGLObjects_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueAcquireGLObjects\n"); return tdispatch->clEnqueueAcquireGLObjects( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } static cl_int CL_API_CALL clEnqueueReleaseGLObjects_wrap( cl_command_queue command_queue, cl_uint num_objects, const cl_mem* mem_objects, cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event) CL_API_SUFFIX__VERSION_1_0 { printf("clEnqueueReleaseGLObjects\n"); return tdispatch->clEnqueueReleaseGLObjects( command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } static cl_mem CL_API_CALL clCreateFromGLTexture2D_wrap( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clCreateFromGLTexture2D\n"); return tdispatch->clCreateFromGLTexture2D( context, flags, target, miplevel, texture, errcode_ret); } static cl_mem CL_API_CALL clCreateFromGLTexture3D_wrap( cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture, cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED { printf("clCreateFromGLTexture3D\n"); return tdispatch->clCreateFromGLTexture3D( context, flags, target, miplevel, texture, errcode_ret); } /////////////////////////////////////////////////////////////////////////////// // cl_khr_subgroups static cl_int CL_API_CALL clGetKernelSubGroupInfoKHR_wrap( cl_kernel in_kernel, cl_device_id in_device, cl_kernel_sub_group_info param_name, size_t input_value_size, const void* input_value, size_t param_value_size, void* param_value, size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_2_0_DEPRECATED { printf("clGetKernelSubGroupInfoKHR\n"); return tdispatch->clGetKernelSubGroupInfoKHR( in_kernel, in_device, param_name, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); } /////////////////////////////////////////////////////////////////////////////// void _init_dispatch(void) { dispatch.clGetPlatformIDs = &clGetPlatformIDs_wrap; dispatch.clGetPlatformInfo = &clGetPlatformInfo_wrap; dispatch.clGetDeviceIDs = &clGetDeviceIDs_wrap; dispatch.clGetDeviceInfo = &clGetDeviceInfo_wrap; dispatch.clCreateContext = &clCreateContext_wrap; dispatch.clCreateContextFromType = &clCreateContextFromType_wrap; dispatch.clRetainContext = &clRetainContext_wrap; dispatch.clReleaseContext = &clReleaseContext_wrap; dispatch.clGetContextInfo = &clGetContextInfo_wrap; dispatch.clCreateCommandQueue = &clCreateCommandQueue_wrap; dispatch.clRetainCommandQueue = &clRetainCommandQueue_wrap; dispatch.clReleaseCommandQueue = &clReleaseCommandQueue_wrap; dispatch.clGetCommandQueueInfo = &clGetCommandQueueInfo_wrap; dispatch.clSetCommandQueueProperty = &clSetCommandQueueProperty_wrap; dispatch.clCreateBuffer = &clCreateBuffer_wrap; dispatch.clCreateImage2D = &clCreateImage2D_wrap; dispatch.clCreateImage3D = &clCreateImage3D_wrap; dispatch.clRetainMemObject = &clRetainMemObject_wrap; dispatch.clReleaseMemObject = &clReleaseMemObject_wrap; dispatch.clGetSupportedImageFormats = &clGetSupportedImageFormats_wrap; dispatch.clGetMemObjectInfo = &clGetMemObjectInfo_wrap; dispatch.clGetImageInfo = &clGetImageInfo_wrap; dispatch.clCreateSampler = &clCreateSampler_wrap; dispatch.clRetainSampler = &clRetainSampler_wrap; dispatch.clReleaseSampler = &clReleaseSampler_wrap; dispatch.clGetSamplerInfo = &clGetSamplerInfo_wrap; dispatch.clCreateProgramWithSource = &clCreateProgramWithSource_wrap; dispatch.clCreateProgramWithBinary = &clCreateProgramWithBinary_wrap; dispatch.clRetainProgram = &clRetainProgram_wrap; dispatch.clReleaseProgram = &clReleaseProgram_wrap; dispatch.clBuildProgram = &clBuildProgram_wrap; dispatch.clUnloadCompiler = &clUnloadCompiler_wrap; dispatch.clGetProgramInfo = &clGetProgramInfo_wrap; dispatch.clGetProgramBuildInfo = &clGetProgramBuildInfo_wrap; dispatch.clCreateKernel = &clCreateKernel_wrap; dispatch.clCreateKernelsInProgram = &clCreateKernelsInProgram_wrap; dispatch.clRetainKernel = &clRetainKernel_wrap; dispatch.clReleaseKernel = &clReleaseKernel_wrap; dispatch.clSetKernelArg = &clSetKernelArg_wrap; dispatch.clGetKernelInfo = &clGetKernelInfo_wrap; dispatch.clGetKernelWorkGroupInfo = &clGetKernelWorkGroupInfo_wrap; dispatch.clWaitForEvents = &clWaitForEvents_wrap; dispatch.clGetEventInfo = &clGetEventInfo_wrap; dispatch.clRetainEvent = &clRetainEvent_wrap; dispatch.clReleaseEvent = &clReleaseEvent_wrap; dispatch.clGetEventProfilingInfo = &clGetEventProfilingInfo_wrap; dispatch.clFlush = &clFlush_wrap; dispatch.clFinish = &clFinish_wrap; dispatch.clEnqueueReadBuffer = &clEnqueueReadBuffer_wrap; dispatch.clEnqueueWriteBuffer = &clEnqueueWriteBuffer_wrap; dispatch.clEnqueueCopyBuffer = &clEnqueueCopyBuffer_wrap; dispatch.clEnqueueReadImage = &clEnqueueReadImage_wrap; dispatch.clEnqueueWriteImage = &clEnqueueWriteImage_wrap; dispatch.clEnqueueCopyImage = &clEnqueueCopyImage_wrap; dispatch.clEnqueueCopyImageToBuffer = &clEnqueueCopyImageToBuffer_wrap; dispatch.clEnqueueCopyBufferToImage = &clEnqueueCopyBufferToImage_wrap; dispatch.clEnqueueMapBuffer = &clEnqueueMapBuffer_wrap; dispatch.clEnqueueMapImage = &clEnqueueMapImage_wrap; dispatch.clEnqueueUnmapMemObject = &clEnqueueUnmapMemObject_wrap; dispatch.clEnqueueNDRangeKernel = &clEnqueueNDRangeKernel_wrap; dispatch.clEnqueueTask = &clEnqueueTask_wrap; dispatch.clEnqueueNativeKernel = &clEnqueueNativeKernel_wrap; dispatch.clEnqueueMarker = &clEnqueueMarker_wrap; dispatch.clEnqueueWaitForEvents = &clEnqueueWaitForEvents_wrap; dispatch.clEnqueueBarrier = &clEnqueueBarrier_wrap; dispatch.clGetExtensionFunctionAddress = &clGetExtensionFunctionAddress_wrap; dispatch.clCreateFromGLBuffer = &clCreateFromGLBuffer_wrap; dispatch.clCreateFromGLTexture2D = &clCreateFromGLTexture2D_wrap; dispatch.clCreateFromGLTexture3D = &clCreateFromGLTexture3D_wrap; dispatch.clCreateFromGLRenderbuffer = &clCreateFromGLRenderbuffer_wrap; dispatch.clGetGLObjectInfo = &clGetGLObjectInfo_wrap; dispatch.clGetGLTextureInfo = &clGetGLTextureInfo_wrap; dispatch.clEnqueueAcquireGLObjects = &clEnqueueAcquireGLObjects_wrap; dispatch.clEnqueueReleaseGLObjects = &clEnqueueReleaseGLObjects_wrap; dispatch.clGetGLContextInfoKHR = &clGetGLContextInfoKHR_wrap; /* cl_khr_d3d10_sharing */ #if defined(_WIN32) dispatch.clGetDeviceIDsFromD3D10KHR = &clGetDeviceIDsFromD3D10KHR_wrap; dispatch.clCreateFromD3D10BufferKHR = &clCreateFromD3D10BufferKHR_wrap; dispatch.clCreateFromD3D10Texture2DKHR = &clCreateFromD3D10Texture2DKHR_wrap; dispatch.clCreateFromD3D10Texture3DKHR = &clCreateFromD3D10Texture3DKHR_wrap; dispatch.clEnqueueAcquireD3D10ObjectsKHR = &clEnqueueAcquireD3D10ObjectsKHR_wrap; dispatch.clEnqueueReleaseD3D10ObjectsKHR = &clEnqueueReleaseD3D10ObjectsKHR_wrap; #else dispatch.clGetDeviceIDsFromD3D10KHR = NULL; dispatch.clCreateFromD3D10BufferKHR = NULL; dispatch.clCreateFromD3D10Texture2DKHR = NULL; dispatch.clCreateFromD3D10Texture3DKHR = NULL; dispatch.clEnqueueAcquireD3D10ObjectsKHR = NULL; dispatch.clEnqueueReleaseD3D10ObjectsKHR = NULL; #endif /* OpenCL 1.1 */ dispatch.clSetEventCallback = &clSetEventCallback_wrap; dispatch.clCreateSubBuffer = &clCreateSubBuffer_wrap; dispatch.clSetMemObjectDestructorCallback = &clSetMemObjectDestructorCallback_wrap; dispatch.clCreateUserEvent = &clCreateUserEvent_wrap; dispatch.clSetUserEventStatus = &clSetUserEventStatus_wrap; dispatch.clEnqueueReadBufferRect = &clEnqueueReadBufferRect_wrap; dispatch.clEnqueueWriteBufferRect = &clEnqueueWriteBufferRect_wrap; dispatch.clEnqueueCopyBufferRect = &clEnqueueCopyBufferRect_wrap; /* cl_ext_device_fission */ dispatch.clCreateSubDevicesEXT = &clCreateSubDevicesEXT_wrap; dispatch.clRetainDeviceEXT = &clRetainDeviceEXT_wrap; dispatch.clReleaseDeviceEXT = &clReleaseDeviceEXT_wrap; /* cl_khr_gl_event */ dispatch.clCreateEventFromGLsyncKHR = &clCreateEventFromGLsyncKHR_wrap; /* OpenCL 1.2 */ dispatch.clCreateSubDevices = &clCreateSubDevices_wrap; dispatch.clRetainDevice = &clRetainDevice_wrap; dispatch.clReleaseDevice = &clReleaseDevice_wrap; dispatch.clCreateImage = &clCreateImage_wrap; dispatch.clCreateProgramWithBuiltInKernels = &clCreateProgramWithBuiltInKernels_wrap; dispatch.clCompileProgram = &clCompileProgram_wrap; dispatch.clLinkProgram = &clLinkProgram_wrap; dispatch.clUnloadPlatformCompiler = &clUnloadPlatformCompiler_wrap; dispatch.clGetKernelArgInfo = &clGetKernelArgInfo_wrap; dispatch.clEnqueueFillBuffer = &clEnqueueFillBuffer_wrap; dispatch.clEnqueueFillImage = &clEnqueueFillImage_wrap; dispatch.clEnqueueMigrateMemObjects = &clEnqueueMigrateMemObjects_wrap; dispatch.clEnqueueMarkerWithWaitList = &clEnqueueMarkerWithWaitList_wrap; dispatch.clEnqueueBarrierWithWaitList = &clEnqueueBarrierWithWaitList_wrap; dispatch.clGetExtensionFunctionAddressForPlatform = &clGetExtensionFunctionAddressForPlatform_wrap; dispatch.clCreateFromGLTexture = &clCreateFromGLTexture_wrap; /* cl_khr_d3d11_sharing */ #if defined(_WIN32) dispatch.clGetDeviceIDsFromD3D11KHR = &clGetDeviceIDsFromD3D11KHR_wrap; dispatch.clCreateFromD3D11BufferKHR = &clCreateFromD3D11BufferKHR_wrap; dispatch.clCreateFromD3D11Texture2DKHR = &clCreateFromD3D11Texture2DKHR_wrap; dispatch.clCreateFromD3D11Texture3DKHR = &clCreateFromD3D11Texture3DKHR_wrap; dispatch.clCreateFromDX9MediaSurfaceKHR = &clCreateFromDX9MediaSurfaceKHR_wrap; dispatch.clEnqueueAcquireD3D11ObjectsKHR = &clEnqueueAcquireD3D11ObjectsKHR_wrap; dispatch.clEnqueueReleaseD3D11ObjectsKHR = &clEnqueueReleaseD3D11ObjectsKHR_wrap; #else dispatch.clGetDeviceIDsFromD3D11KHR = NULL; dispatch.clCreateFromD3D11BufferKHR = NULL; dispatch.clCreateFromD3D11Texture2DKHR = NULL; dispatch.clCreateFromD3D11Texture3DKHR = NULL; dispatch.clCreateFromDX9MediaSurfaceKHR = NULL; dispatch.clEnqueueAcquireD3D11ObjectsKHR = NULL; dispatch.clEnqueueReleaseD3D11ObjectsKHR = NULL; #endif /* cl_khr_dx9_media_sharing */ #if defined(_WIN32) dispatch.clGetDeviceIDsFromDX9MediaAdapterKHR = &clGetDeviceIDsFromDX9MediaAdapterKHR_wrap; dispatch.clEnqueueAcquireDX9MediaSurfacesKHR = &clEnqueueAcquireDX9MediaSurfacesKHR_wrap; dispatch.clEnqueueReleaseDX9MediaSurfacesKHR = &clEnqueueReleaseDX9MediaSurfacesKHR_wrap; #else dispatch.clGetDeviceIDsFromDX9MediaAdapterKHR = NULL; dispatch.clEnqueueAcquireDX9MediaSurfacesKHR = NULL; dispatch.clEnqueueReleaseDX9MediaSurfacesKHR = NULL; #endif /* cl_khr_egl_image */ dispatch.clCreateFromEGLImageKHR = &clCreateFromEGLImageKHR_wrap; dispatch.clEnqueueAcquireEGLObjectsKHR = &clEnqueueAcquireEGLObjectsKHR_wrap; dispatch.clEnqueueReleaseEGLObjectsKHR = &clEnqueueReleaseEGLObjectsKHR_wrap; /* cl_khr_egl_event */ dispatch.clCreateEventFromEGLSyncKHR = &clCreateEventFromEGLSyncKHR_wrap; /* OpenCL 2.0 */ dispatch.clCreateCommandQueueWithProperties = &clCreateCommandQueueWithProperties_wrap; dispatch.clCreatePipe = &clCreatePipe_wrap; dispatch.clGetPipeInfo = &clGetPipeInfo_wrap; dispatch.clSVMAlloc = &clSVMAlloc_wrap; dispatch.clSVMFree = &clSVMFree_wrap; dispatch.clEnqueueSVMFree = &clEnqueueSVMFree_wrap; dispatch.clEnqueueSVMMemcpy = &clEnqueueSVMMemcpy_wrap; dispatch.clEnqueueSVMMemFill = &clEnqueueSVMMemFill_wrap; dispatch.clEnqueueSVMMap = &clEnqueueSVMMap_wrap; dispatch.clEnqueueSVMUnmap = &clEnqueueSVMUnmap_wrap; dispatch.clCreateSamplerWithProperties = &clCreateSamplerWithProperties_wrap; dispatch.clSetKernelArgSVMPointer = &clSetKernelArgSVMPointer_wrap; dispatch.clSetKernelExecInfo = &clSetKernelExecInfo_wrap; /* cl_khr_sub_groups */ dispatch.clGetKernelSubGroupInfoKHR = &clGetKernelSubGroupInfoKHR_wrap; /* OpenCL 2.1 */ dispatch.clCloneKernel = &clCloneKernel_wrap; dispatch.clCreateProgramWithIL = &clCreateProgramWithIL_wrap; dispatch.clEnqueueSVMMigrateMem = &clEnqueueSVMMigrateMem_wrap; dispatch.clGetDeviceAndHostTimer = &clGetDeviceAndHostTimer_wrap; dispatch.clGetHostTimer = &clGetHostTimer_wrap; dispatch.clGetKernelSubGroupInfo = &clGetKernelSubGroupInfo_wrap; dispatch.clSetDefaultDeviceCommandQueue = &clSetDefaultDeviceCommandQueue_wrap; /* OpenCL 2.2 */ dispatch.clSetProgramReleaseCallback = &clSetProgramReleaseCallback_wrap; dispatch.clSetProgramSpecializationConstant = &clSetProgramSpecializationConstant_wrap; /* OpenCL 3.0 */ dispatch.clCreateBufferWithProperties = &clCreateBufferWithProperties_wrap; dispatch.clCreateImageWithProperties = &clCreateImageWithProperties_wrap; dispatch.clSetContextDestructorCallback = &clSetContextDestructorCallback_wrap; } OpenCL-ICD-Loader-2025.07.22/test/loader_test/000077500000000000000000000000001503776305700203355ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/loader_test/CMakeLists.txt000066400000000000000000000007051503776305700230770ustar00rootroot00000000000000add_executable (icd_loader_test test_kernel.c main.c test_platforms.c icd_test_match.c test_program_objects.c test_sampler_objects.c test_buffer_object.c test_cl_runtime.c callbacks.c test_create_calls.c test_clgl.c test_image_objects.c ) target_compile_definitions(icd_loader_test PRIVATE CL_TARGET_OPENCL_VERSION=300 ) target_link_libraries (icd_loader_test OpenCL IcdLog OpenCL::Headers) OpenCL-ICD-Loader-2025.07.22/test/loader_test/callbacks.c000066400000000000000000000024261503776305700224240ustar00rootroot00000000000000#include #include #include void CL_CALLBACK createcontext_callback(const char* _a, const void* _b, size_t _c, void* _d) { test_icd_app_log("createcontext_callback(%p, %p, %u, %p)\n", _a, _b, _c, _d); } void CL_CALLBACK setcontextdestructor_callback(cl_context _a, void* _b) { test_icd_app_log("setcontextdestructor_callback(%p, %p)\n", _a, _b); } void CL_CALLBACK setmemobjectdestructor_callback(cl_mem _a, void* _b) { test_icd_app_log("setmemobjectdestructor_callback(%p, %p)\n", _a, _b); } void CL_CALLBACK program_callback(cl_program _a, void* _b) { test_icd_app_log("program_callback(%p, %p)\n", _a, _b); } void CL_CALLBACK setevent_callback(cl_event _a, cl_int _b, void* _c) { test_icd_app_log("setevent_callback(%p, %d, %p)\n", _a, _b, _c); } void CL_CALLBACK setprintf_callback(cl_context _a, cl_uint _b, char* _c, void* _d ) { test_icd_app_log("setprintf_callback(%p, %u, %p, %p)\n", _a, _b, _c, _d); } OpenCL-ICD-Loader-2025.07.22/test/loader_test/icd_test_match.c000066400000000000000000000015131503776305700234530ustar00rootroot00000000000000#include #include #include #ifndef __APPLE__ #include #endif #include int test_icd_match(void) { int error = 0; char *app_log = NULL, *stub_log = NULL; app_log = test_icd_get_app_log(); if (!app_log) { printf("ERROR: Could not retrieve app log\n"); error = 1; goto End; } stub_log = test_icd_get_stub_log(); if (!stub_log) { printf("ERROR: Could not retrieve stub log\n"); error = 1; goto End; } if (strcmp(app_log, stub_log)) { printf("ERROR: App log and stub log differ.\n\n"); printf("APPLOG:\n%s\n\n", app_log); printf("STUBLOG:\n%s\n\n", stub_log); error = 1; goto End; } End: free(app_log); free(stub_log); return error; } OpenCL-ICD-Loader-2025.07.22/test/loader_test/main.c000066400000000000000000000021331503776305700214240ustar00rootroot00000000000000#include #include #include #include "param_struct.h" extern int test_create_calls(void); extern int test_platforms(void); extern int test_cl_runtime(void); extern int test_kernel(void); extern int test_buffer_object(void); extern int test_program_objects(void); extern int test_image_objects(void); extern int test_sampler_objects(void); extern int test_OpenGL_share(void); extern int test_release_calls(void); extern int test_icd_match(void); int main(int argc, char **argv) { (void)argc; (void)argv; test_icd_initialize_app_log(); test_icd_initialize_stub_log(); test_create_calls(); test_platforms(); test_cl_runtime(); test_kernel(); test_buffer_object(); test_program_objects(); test_image_objects(); test_sampler_objects(); test_OpenGL_share(); test_release_calls(); test_icd_close_app_log(); test_icd_close_stub_log(); if (test_icd_match()) { printf("ICD Loader Test FAILED\n"); return 1; } else { printf("ICD Loader Test PASSED\n"); return 0; } } OpenCL-ICD-Loader-2025.07.22/test/loader_test/param_struct.h000066400000000000000000000607651503776305700232300ustar00rootroot00000000000000#ifndef _PARAM_STRUCT_H_ #define _PARAM_STRUCT_H_ #include #include struct clCreateCommandQueue_st { cl_context context; cl_device_id device; cl_command_queue_properties properties; cl_int *errcode_ret; }; struct clSetCommandQueueProperty_st { cl_command_queue command_queue; cl_command_queue_properties properties; cl_bool enable; cl_command_queue_properties *old_properties; }; struct clGetCommandQueueInfo_st { cl_command_queue command_queue; cl_command_queue_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; struct clCreateContext_st { const cl_context_properties *properties; cl_uint num_devices; const cl_device_id *devices; void (CL_CALLBACK*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data); void *user_data; cl_int *errcode_ret; }; struct clCreateContextFromType_st { const cl_context_properties *properties; cl_device_type device_type; void (CL_CALLBACK *pfn_notify)(const char *errinfo, const void *private_info, size_t cb,void *user_data); void *user_data; cl_int *errcode_ret; }; struct clRetainContext_st { cl_context context; }; struct clReleaseContext_st { cl_context context; }; struct clGetContextInfo_st { cl_context context; cl_context_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; struct clSetContextDestructorCallback_st { cl_context context; void (CL_CALLBACK *pfn_notify)(cl_context context, void *user_data); void *user_data; }; struct clGetPlatformIDs_st { cl_uint num_entries; cl_platform_id *platforms; cl_uint *num_platforms; }; struct clGetPlatformInfo_st { cl_platform_id platform; cl_platform_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; struct clGetDeviceIDs_st { cl_platform_id platform; cl_device_type device_type; cl_uint num_entries; cl_device_id *devices; cl_uint *num_devices; }; struct clRetainCommandQueue_st { cl_command_queue command_queue; }; struct clReleaseCommandQueue_st { cl_command_queue command_queue; }; #define NUM_ITEMS_clCreateCommandQueue 1 #define NUM_ITEMS_clRetainCommandQueue 1 #define NUM_ITEMS_clReleaseCommandQueue 1 #define NUM_ITEMS_clGetCommandQueueInfo 1 #define NUM_ITEMS_clSetCommandQueueProperty 1 #define NUM_ITEMS_clCreateContext 1 #define NUM_ITEMS_clCreateContextFromType 1 #define NUM_ITEMS_clRetainContext 1 #define NUM_ITEMS_clReleaseContext 1 #define NUM_ITEMS_clGetContextInfo 1 #define NUM_ITEMS_clSetContextDestructorCallback 1 #define NUM_ITEMS_clGetPlatformIDs 1 #define NUM_ITEMS_clGetPlatformInfo 1 #define NUM_ITEMS_clGetDeviceIDs 1 #define NUM_ITEMS_clGetDeviceInfo 1 #define NUM_ITEMS_clCreateSubDevices 1 #define NUM_ITEMS_clRetainDevice 1 #define NUM_ITEMS_clReleaseDevice 1 struct clGetDeviceInfo_st { cl_device_id device; cl_device_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; struct clCreateSubDevices_st { cl_device_id in_device; cl_device_partition_property *properties; cl_uint num_entries; cl_device_id *out_devices; cl_uint *num_devices; }; struct clRetainDevice_st { cl_device_id device; }; struct clReleaseDevice_st { cl_device_id device; }; #define NUM_ITEMS_clCreateBuffer 1 #define NUM_ITEMS_clCreateBufferWithProperties 1 #define NUM_ITEMS_clCreateSubBuffer 1 #define NUM_ITEMS_clEnqueueReadBuffer 1 #define NUM_ITEMS_clEnqueueWriteBuffer 1 #define NUM_ITEMS_clEnqueueReadBufferRect 1 #define NUM_ITEMS_clEnqueueWriteBufferRect 1 #define NUM_ITEMS_clEnqueueFillBuffer 1 #define NUM_ITEMS_clEnqueueCopyBuffer 1 #define NUM_ITEMS_clEnqueueCopyBufferRect 1 #define NUM_ITEMS_clEnqueueMapBuffer 1 #define NUM_ITEMS_clRetainMemObject 1 #define NUM_ITEMS_clReleaseMemObject 1 #define NUM_ITEMS_clSetMemObjectDestructorCallback 1 #define NUM_ITEMS_clEnqueueUnmapMemObject 1 #define NUM_ITEMS_clGetMemObjectInfo 1 struct clCreateBuffer_st { cl_context context; cl_mem_flags flags; size_t size; void *host_ptr; cl_int *errcode_ret; }; struct clCreateBufferWithProperties_st { cl_context context; const cl_mem_properties * properties; cl_mem_flags flags; size_t size; void *host_ptr; cl_int *errcode_ret; }; struct clCreateSubBuffer_st { cl_mem buffer; cl_mem_flags flags; cl_buffer_create_type buffer_create_type; const void *buffer_create_info; cl_int *errcode_ret; }; struct clEnqueueReadBuffer_st { cl_command_queue command_queue; cl_mem buffer; cl_bool blocking_read; size_t offset; size_t cb; void *ptr; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueWriteBuffer_st { cl_command_queue command_queue; cl_mem buffer; cl_bool blocking_write; size_t offset; size_t cb; const void *ptr; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueReadBufferRect_st { cl_command_queue command_queue; cl_mem buffer; cl_bool blocking_read; const size_t * buffer_offset; const size_t * host_offset; const size_t * region; size_t buffer_row_pitch; size_t buffer_slice_pitch; size_t host_row_pitch; size_t host_slice_pitch; void *ptr; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueWriteBufferRect_st { cl_command_queue command_queue; cl_mem buffer; cl_bool blocking_write; const size_t *buffer_offset; const size_t *host_offset; const size_t *region; size_t buffer_row_pitch; size_t buffer_slice_pitch; size_t host_row_pitch; size_t host_slice_pitch; void *ptr; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueFillBuffer_st { cl_command_queue command_queue; cl_mem buffer; const void *pattern; size_t pattern_size; size_t offset; size_t cb; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueCopyBuffer_st { cl_command_queue command_queue; cl_mem src_buffer; cl_mem dst_buffer; size_t src_offset; size_t dst_offset; size_t cb; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueCopyBufferRect_st { cl_command_queue command_queue; cl_mem src_buffer; cl_mem dst_buffer; const size_t *src_origin; const size_t *dst_origin; const size_t *region; size_t src_row_pitch; size_t src_slice_pitch; size_t dst_row_pitch; size_t dst_slice_pitch; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueMapBuffer_st { cl_command_queue command_queue; cl_mem buffer; cl_bool blocking_map; cl_map_flags map_flags; size_t offset; size_t cb; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; cl_int *errcode_ret; }; struct clRetainMemObject_st { cl_mem memobj; }; struct clReleaseMemObject_st { cl_mem memobj; }; struct clSetMemObjectDestructorCallback_st { cl_mem memobj; void (CL_CALLBACK *pfn_notify)(cl_mem memobj, void *user_data); void *user_data; }; struct clEnqueueUnmapMemObject_st { cl_command_queue command_queue; cl_mem memobj; void *mapped_ptr; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clGetMemObjectInfo_st { cl_mem memobj; cl_mem_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; #define NUM_ITEMS_clCreateProgramWithSource 1 #define NUM_ITEMS_clCreateProgramWithBinary 1 #define NUM_ITEMS_clCreateProgramWithBuiltInKernels 1 #define NUM_ITEMS_clRetainProgram 1 #define NUM_ITEMS_clReleaseProgram 1 #define NUM_ITEMS_clBuildProgram 1 #define NUM_ITEMS_clCompileProgram 1 #define NUM_ITEMS_clLinkProgram 1 #define NUM_ITEMS_clUnloadPlatformCompiler 1 #define NUM_ITEMS_clGetProgramInfo 1 #define NUM_ITEMS_clGetProgramBuildInfo 1 #define NUM_ITEMS_clUnloadCompiler 1 #define NUM_ITEMS_clGetExtensionFunctionAddress 1 #define NUM_ITEMS_clGetExtensionFunctionAddressForPlatform 1 struct clCreateProgramWithSource_st { cl_context context; cl_uint count; const char **strings; const size_t *lengths; cl_int *errcode_ret; }; struct clCreateProgramWithBinary_st { cl_context context; cl_uint num_devices; const cl_device_id *device_list; const size_t *lengths; const unsigned char **binaries; cl_int *binary_status; cl_int *errcode_ret; }; struct clCreateProgramWithBuiltInKernels_st { cl_context context; cl_uint num_devices; const cl_device_id *device_list; const char *kernel_names; cl_int *errcode_ret; }; struct clRetainProgram_st { cl_program program; }; struct clReleaseProgram_st { cl_program program; }; struct clBuildProgram_st { cl_program program; cl_uint num_devices; const cl_device_id *device_list; const char *options; void (CL_CALLBACK*pfn_notify)(cl_program program, void *user_data); void *user_data; }; struct clCompileProgram_st { cl_program program; cl_uint num_devices; const cl_device_id *device_list; const char *options; cl_uint num_input_headers; const cl_program *headers; const char **header_include_names; void (CL_CALLBACK *pfn_notify)(cl_program program, void * user_data); void *user_data; }; struct clLinkProgram_st { cl_context context; cl_uint num_devices; const cl_device_id *device_list; const char *options; cl_uint num_input_programs; const cl_program *input_programs; void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data); void *user_data; cl_int *errcode_ret; }; struct clUnloadPlatformCompiler_st { cl_platform_id platform; }; #if 0 struct clUnloadCompiler_st { void ; }; #endif struct clGetExtensionFunctionAddress_st { const char *func_name; }; struct clGetExtensionFunctionAddressForPlatform_st { cl_platform_id platform; const char *func_name; }; struct clGetProgramInfo_st { cl_program program; cl_program_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; struct clGetProgramBuildInfo_st { cl_program program; cl_device_id device; cl_program_build_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; #define NUM_ITEMS_clCreateImage2D 1 #define NUM_ITEMS_clCreateImage3D 1 #define NUM_ITEMS_clCreateImage 1 #define NUM_ITEMS_clCreateImageWithProperties 1 #define NUM_ITEMS_clGetSupportedImageFormats 1 #define NUM_ITEMS_clEnqueueCopyImageToBuffer 1 #define NUM_ITEMS_clEnqueueCopyBufferToImage 1 #define NUM_ITEMS_clEnqueueMapImage 1 #define NUM_ITEMS_clEnqueueReadImage 1 #define NUM_ITEMS_clEnqueueWriteImage 1 #define NUM_ITEMS_clEnqueueFillImage 1 #define NUM_ITEMS_clEnqueueCopyImage 1 #define NUM_ITEMS_clGetMemObjectInfo 1 #define NUM_ITEMS_clGetImageInfo 1 struct clCreateImage_st { cl_context context; cl_mem_flags flags; const cl_image_format *image_format; const cl_image_desc *image_desc; void *host_ptr; cl_int *errcode_ret; }; struct clCreateImageWithProperties_st { cl_context context; const cl_mem_properties * properties; cl_mem_flags flags; const cl_image_format *image_format; const cl_image_desc *image_desc; void *host_ptr; cl_int *errcode_ret; }; struct clCreateImage2D_st { cl_context context; cl_mem_flags flags; const cl_image_format *image_format; size_t image_width; size_t image_height; size_t image_row_pitch; void *host_ptr; cl_int *errcode_ret; }; struct clCreateImage3D_st { cl_context context; cl_mem_flags flags; const cl_image_format *image_format; size_t image_width; size_t image_height; size_t image_depth; size_t image_row_pitch; size_t image_slice_pitch; void *host_ptr; cl_int *errcode_ret; }; struct clGetSupportedImageFormats_st { cl_context context; cl_mem_flags flags; cl_mem_object_type image_type; cl_uint num_entries; cl_image_format *image_formats; cl_uint *num_image_formats; }; struct clEnqueueCopyImageToBuffer_st { cl_command_queue command_queue; cl_mem src_image; cl_mem dst_buffer; const size_t *src_origin; const size_t *region; size_t dst_offset; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueCopyBufferToImage_st { cl_command_queue command_queue; cl_mem src_buffer; cl_mem dst_image; size_t src_offset; const size_t *dst_origin; const size_t *region; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueMapImage_st { cl_command_queue command_queue; cl_mem image; cl_bool blocking_map; cl_map_flags map_flags; const size_t *origin; const size_t *region; size_t *image_row_pitch; size_t *image_slice_pitch; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; cl_int *errcode_ret; }; struct clEnqueueReadImage_st { cl_command_queue command_queue; cl_mem image; cl_bool blocking_read; const size_t *origin; const size_t *region; size_t row_pitch; size_t slice_pitch; void *ptr; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueWriteImage_st { cl_command_queue command_queue; cl_mem image; cl_bool blocking_write; const size_t *origin; const size_t *region; size_t input_row_pitch; size_t input_slice_pitch; const void *ptr; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueFillImage_st { cl_command_queue command_queue; cl_mem image; const void *fill_color; const size_t *origin; const size_t *region; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueCopyImage_st { cl_command_queue command_queue; cl_mem src_image; cl_mem dst_image; const size_t *src_origin; const size_t *dst_origin; const size_t *region; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; #if 0 struct clGetMemObjectInfo_st { cl_mem memobj; cl_mem_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; #endif struct clGetImageInfo_st { cl_mem image; cl_image_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; #define NUM_ITEMS_clCreateSampler 1 #define NUM_ITEMS_clRetainSampler 1 #define NUM_ITEMS_clReleaseSampler 1 #define NUM_ITEMS_clGetSamplerInfo 1 struct clCreateSampler_st { cl_context context; cl_bool normalized_coords; cl_addressing_mode addressing_mode; cl_filter_mode filter_mode; cl_int *errcode_ret; }; struct clRetainSampler_st { cl_sampler sampler; }; struct clReleaseSampler_st { cl_sampler sampler; }; struct clGetSamplerInfo_st { cl_sampler sampler; cl_sampler_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; #define NUM_ITEMS_clCreateKernel 1 #define NUM_ITEMS_clCreateKernelsInProgram 1 #define NUM_ITEMS_clRetainKernel 1 #define NUM_ITEMS_clReleaseKernel 1 struct clCreateKernel_st { cl_program program; const char *kernel_name; cl_int *errcode_ret; }; struct clCreateKernelsInProgram_st { cl_program program; cl_uint num_kernels; cl_kernel *kernels; cl_uint *num_kernels_ret; }; struct clRetainKernel_st { cl_kernel kernel; }; struct clReleaseKernel_st { cl_kernel kernel; }; #define NUM_ITEMS_clSetKernelArg 1 #define NUM_ITEMS_clGetKernelInfo 1 #define NUM_ITEMS_clGetKernelArgInfo 1 #define NUM_ITEMS_clGetKernelWorkGroupInfo 1 struct clSetKernelArg_st { cl_kernel kernel; cl_uint arg_index; size_t arg_size; const void *arg_value; }; struct clGetKernelInfo_st { cl_kernel kernel; cl_kernel_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; struct clGetKernelArgInfo_st { cl_kernel kernel; cl_uint arg_indx; cl_kernel_arg_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; struct clGetKernelWorkGroupInfo_st { cl_kernel kernel; cl_device_id device; cl_kernel_work_group_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; #define NUM_ITEMS_clEnqueueMigrateMemObjects 1 #define NUM_ITEMS_clEnqueueNDRangeKernel 1 #define NUM_ITEMS_clEnqueueTask 1 #define NUM_ITEMS_clEnqueueNativeKernel 1 struct clEnqueueMigrateMemObjects_st { cl_command_queue command_queue; cl_uint num_mem_objects; const cl_mem *mem_objects; cl_mem_migration_flags flags; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueNDRangeKernel_st { cl_command_queue command_queue; cl_kernel kernel; cl_uint work_dim; const size_t *global_work_offset; const size_t *global_work_size; const size_t *local_work_size; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueTask_st { cl_command_queue command_queue; cl_kernel kernel; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueNativeKernel_st { cl_command_queue command_queue; void (CL_CALLBACK *user_func)(void *); void *args; size_t cb_args; cl_uint num_mem_objects; const cl_mem *mem_list; const void **args_mem_loc; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; #define NUM_ITEMS_clCreateUserEvent 1 #define NUM_ITEMS_clSetUserEventStatus 1 #define NUM_ITEMS_clWaitForEvents 1 #define NUM_ITEMS_clGetEventInfo 1 #define NUM_ITEMS_clSetEventCallback 1 #define NUM_ITEMS_clRetainEvent 1 #define NUM_ITEMS_clReleaseEvent 1 struct clCreateUserEvent_st { cl_context context; cl_int *errcode_ret; }; struct clSetUserEventStatus_st { cl_event event; cl_int execution_status; }; struct clWaitForEvents_st { cl_uint num_events; const cl_event *event_list; }; struct clGetEventInfo_st { cl_event event; cl_event_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; struct clSetEventCallback_st { cl_event event; cl_int command_exec_callback_type; void (CL_CALLBACK *pfn_event_notify)(cl_event event, cl_int event_command_exec_status,void *user_data); void *user_data; }; struct clRetainEvent_st { cl_event event; }; struct clReleaseEvent_st { cl_event event; }; #define NUM_ITEMS_clEnqueueMarker 1 #define NUM_ITEMS_clEnqueueWaitForEvents 1 #define NUM_ITEMS_clEnqueueBarrier 1 #define NUM_ITEMS_clEnqueueMarkerWithWaitList 1 #define NUM_ITEMS_clEnqueueBarrierWithWaitList 1 struct clEnqueueMarker_st { cl_command_queue command_queue; cl_event *event; }; struct clEnqueueWaitForEvents_st { cl_command_queue command_queue; cl_uint num_events; const cl_event *event_list; }; struct clEnqueueBarrier_st { cl_command_queue command_queue; }; struct clEnqueueMarkerWithWaitList_st { cl_command_queue command_queue; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueBarrierWithWaitList_st { cl_command_queue command_queue; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; #define NUM_ITEMS_clGetEventProfilingInfo 1 struct clGetEventProfilingInfo_st { cl_event event; cl_profiling_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; #define NUM_ITEMS_clFlush 1 #define NUM_ITEMS_clFinish 1 struct clFlush_st { cl_command_queue command_queue; }; struct clFinish_st { cl_command_queue command_queue; }; #define NUM_ITEMS_clCreateFromGLBuffer 1 struct clCreateFromGLBuffer_st { cl_context context; cl_mem_flags flags; cl_GLuint bufobj; int *errcode_ret; }; #define NUM_ITEMS_clCreateFromGLTexture 1 #define NUM_ITEMS_clCreateFromGLTexture2D 1 #define NUM_ITEMS_clCreateFromGLTexture3D 1 struct clCreateFromGLTexture_st { cl_context context; cl_mem_flags flags; cl_GLenum texture_target; cl_GLint miplevel; cl_GLuint texture; cl_int *errcode_ret; }; struct clCreateFromGLTexture2D_st { cl_context context; cl_mem_flags flags; cl_GLenum texture_target; cl_GLint miplevel; cl_GLuint texture; cl_int *errcode_ret; }; struct clCreateFromGLTexture3D_st { cl_context context; cl_mem_flags flags; cl_GLenum texture_target; cl_GLint miplevel; cl_GLuint texture; cl_int *errcode_ret; }; #define NUM_ITEMS_clCreateFromGLRenderbuffer 1 struct clCreateFromGLRenderbuffer_st { cl_context context; cl_mem_flags flags; cl_GLuint renderbuffer; cl_int *errcode_ret; }; // Query Information [9.8.5] #define NUM_ITEMS_clGetGLObjectInfo 1 #define NUM_ITEMS_clGetGLTextureInfo 1 struct clGetGLObjectInfo_st { cl_mem memobj; cl_gl_object_type *gl_object_type; cl_GLuint *gl_object_name; }; struct clGetGLTextureInfo_st { cl_mem memobj; cl_gl_texture_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; // Share Objects [9.8.6] #define NUM_ITEMS_clEnqueueAcquireGLObjects 1 #define NUM_ITEMS_clEnqueueReleaseGLObjects 1 struct clEnqueueAcquireGLObjects_st { cl_command_queue command_queue; cl_uint num_objects; const cl_mem *mem_objects; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; struct clEnqueueReleaseGLObjects_st { cl_command_queue command_queue; cl_uint num_objects; const cl_mem *mem_objects; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; // CL Event Objects > GL Sync Objects [9.9] #define NUM_ITEMS_clCreateEventFromGLsyncKHR 1 struct clCreateEventFromGLsyncKHR_st { cl_context context; cl_GLsync sync; cl_int *errcode_ret; }; // CL Context > GL Context; Sharegroup [9.7] #define NUM_ITEMS_clGetGLContextInfoKHR 1 struct clGetGLContextInfoKHR_st { const cl_context_properties *properties; cl_gl_context_info param_name; size_t param_value_size; void *param_value; size_t *param_value_size_ret; }; #if 0 // OpenCL/Direct3D 10 Sharing APIs [9.10] #define NUM_ITEMS_clGetDeviceIDsFromD3D10KHR 1 #define NUM_ITEMS_clCreateFromD3D10BufferKHR 1 #define NUM_ITEMS_clCreateFromD3D10Texture2DKHR 1 #define NUM_ITEMS_clCreateFromD3D10Texture3DKHR 1 #define NUM_ITEMS_clEnqueueAcquireD3D10ObjectsKHR 1 #define NUM_ITEMS_clEnqueueReleaseD3D10ObjectsKHR 1 struct clGetDeviceIDsFromD3D10KHR_st { cl_platform_id platform; cl_d3d10_device_source_khr d3d_device_source; void *d3d_object; cl_d3d10_device_set_khr d3d_device_set; cl_uint num_entries; cl_device_id *devices; cl_uint *num_devices; }; struct clCreateFromD3D10BufferKHR_st { cl_context context; cl_mem_flags flags; ID3D10Buffer *resource; cl_int *errcode_ret; }; struct clCreateFromD3D10Texture2DKHR_st { cl_context context; cl_mem_flags flags; ID3D10Texture2D *resource; UINT subresource; cl_int *errcode_ret; }; struct clCreateFromD3D10Texture3DKHR_st { cl_context context; cl_mem_flags flags; ID3D10Texture3D *resource; UINT subresource; cl_int *errcode_ret; }; struct clEnqueueAcquireD3D10ObjectsKHR_st { cl_command_queue command_queue; cl_uint num_objects; const cl_mem *mem_objects; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event;}; struct clEnqueueReleaseD3D10ObjectsKHR_st { cl_command_queue command_queue; cl_uint num_objects; const cl_mem *mem_objects; cl_uint num_events_in_wait_list; const cl_event *event_wait_list; cl_event *event; }; #endif #endif /* _PARAM_STRUCT_H_ */ OpenCL-ICD-Loader-2025.07.22/test/loader_test/test_buffer_object.c000066400000000000000000000367651503776305700243600ustar00rootroot00000000000000#include #include #include "param_struct.h" #include extern cl_mem buffer; extern cl_command_queue command_queue; extern cl_event event; static int ret_val; extern void CL_CALLBACK setmemobjectdestructor_callback(cl_mem _a, void* _b); const struct clEnqueueReadBuffer_st clEnqueueReadBufferData[NUM_ITEMS_clEnqueueReadBuffer] = { {NULL, NULL, 0, 0, 0, NULL, 0, NULL, NULL} }; const struct clEnqueueWriteBuffer_st clEnqueueWriteBufferData[NUM_ITEMS_clEnqueueWriteBuffer] = { {NULL, NULL, 0, 0, 0, NULL, 0, NULL, NULL} }; const struct clEnqueueReadBufferRect_st clEnqueueReadBufferRectData[NUM_ITEMS_clEnqueueReadBufferRect] = { {NULL, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL} }; const struct clEnqueueWriteBufferRect_st clEnqueueWriteBufferRectData[NUM_ITEMS_clEnqueueWriteBufferRect] = { {NULL, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0, NULL, NULL} }; const struct clEnqueueFillBuffer_st clEnqueueFillBufferData[NUM_ITEMS_clEnqueueFillBuffer] = { {NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL} }; const struct clEnqueueCopyBuffer_st clEnqueueCopyBufferData[NUM_ITEMS_clEnqueueCopyBuffer] = { {NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL} }; const struct clEnqueueCopyBufferRect_st clEnqueueCopyBufferRectData[NUM_ITEMS_clEnqueueCopyBufferRect] = { {NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL} }; const struct clEnqueueMapBuffer_st clEnqueueMapBufferData[NUM_ITEMS_clEnqueueMapBuffer] = { {NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL} }; const struct clRetainMemObject_st clRetainMemObjectData[NUM_ITEMS_clRetainMemObject] = { {NULL} }; const struct clSetMemObjectDestructorCallback_st clSetMemObjectDestructorCallbackData[NUM_ITEMS_clSetMemObjectDestructorCallback] = { {NULL, setmemobjectdestructor_callback, NULL} }; const struct clEnqueueUnmapMemObject_st clEnqueueUnmapMemObjectData[NUM_ITEMS_clEnqueueUnmapMemObject] = { {NULL, NULL, NULL, 0, NULL, NULL} }; const struct clGetMemObjectInfo_st clGetMemObjectInfoData[NUM_ITEMS_clGetMemObjectInfo] = { {NULL, 0, 0, NULL, NULL} }; int test_clEnqueueReadBuffer(const struct clEnqueueReadBuffer_st *data) { test_icd_app_log("clEnqueueReadBuffer(%p, %p, %u, %u, %u, %p, %u, %p, %p)\n", command_queue, buffer, data->blocking_read, data->offset, data->cb, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueReadBuffer(command_queue, buffer, data->blocking_read, data->offset, data->cb, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueWriteBuffer(const struct clEnqueueWriteBuffer_st *data) { test_icd_app_log("clEnqueueWriteBuffer(%p, %p, %u, %u, %u, %p, %u, %p, %p)\n", command_queue, buffer, data->blocking_write, data->offset, data->cb, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueWriteBuffer(command_queue, buffer, data->blocking_write, data->offset, data->cb, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueReadBufferRect(const struct clEnqueueReadBufferRect_st *data) { test_icd_app_log("clEnqueueReadBufferRect(%p, %p, %u, %p, %p, %p, %u, %u, %u, %u, %p, %u, %p, %p)\n", command_queue, buffer, data->blocking_read, data->buffer_offset, data->host_offset, data->region, data->buffer_row_pitch, data->buffer_slice_pitch, data->host_row_pitch, data->host_slice_pitch, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueReadBufferRect(command_queue, buffer, data->blocking_read, data->buffer_offset, data->host_offset, data->region, data->buffer_row_pitch, data->buffer_slice_pitch, data->host_row_pitch, data->host_slice_pitch, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueWriteBufferRect(const struct clEnqueueWriteBufferRect_st *data) { test_icd_app_log("clEnqueueWriteBufferRect(%p, %p, %u, %p, %p, %p, %u, %u, %u, %u, %p, %u, %p, %p)\n", command_queue, buffer, data->blocking_write, data->buffer_offset, data->host_offset, data->region, data->buffer_row_pitch, data->buffer_slice_pitch, data->host_row_pitch, data->host_slice_pitch, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueWriteBufferRect(command_queue, buffer, data->blocking_write, data->buffer_offset, data->host_offset, data->region, data->buffer_row_pitch, data->buffer_slice_pitch, data->host_row_pitch, data->host_slice_pitch, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueFillBuffer(const struct clEnqueueFillBuffer_st *data) { test_icd_app_log("clEnqueueFillBuffer(%p, %p, %p, %u, %u, %u, %u, %p, %p)\n", command_queue, buffer, data->pattern, data->pattern_size, data->offset, data->cb, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueFillBuffer(command_queue, buffer, data->pattern, data->pattern_size, data->offset, data->cb, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueCopyBuffer(const struct clEnqueueCopyBuffer_st *data) { test_icd_app_log("clEnqueueCopyBuffer(%p, %p, %p, %u, %u, %u, %u, %p, %p)\n", command_queue, data->src_buffer, buffer, data->src_offset, data->dst_offset, data->cb, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueCopyBuffer(command_queue, data->src_buffer, buffer, data->src_offset, data->dst_offset, data->cb, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueCopyBufferRect(const struct clEnqueueCopyBufferRect_st *data) { test_icd_app_log("clEnqueueCopyBufferRect(%p, %p, %p, %p, %p, %p, %u, %u, %u, %u, %u, %p, %p)\n", command_queue, buffer, buffer, data->src_origin, data->dst_origin, data->region, data->src_row_pitch, data->src_slice_pitch, data->dst_row_pitch, data->dst_slice_pitch, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueCopyBufferRect(command_queue, buffer, buffer, data->src_origin, data->dst_origin, data->region, data->src_row_pitch, data->src_slice_pitch, data->dst_row_pitch, data->dst_slice_pitch, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueMapBuffer(const struct clEnqueueMapBuffer_st *data) { void * return_value; test_icd_app_log("clEnqueueMapBuffer(%p, %p, %u, %x, %u, %u, %u, %p, %p, %p)\n", command_queue, buffer, data->blocking_map, data->map_flags, data->offset, data->cb, data->num_events_in_wait_list, data->event_wait_list, &event, data->errcode_ret); return_value=clEnqueueMapBuffer(command_queue, buffer, data->blocking_map, data->map_flags, data->offset, data->cb, data->num_events_in_wait_list, data->event_wait_list, &event, data->errcode_ret); test_icd_app_log("Value returned: %p\n", return_value); free(return_value); return 0; } int test_clRetainMemObject(const struct clRetainMemObject_st *data) { (void)data; test_icd_app_log("clRetainMemObject(%p)\n", buffer); ret_val=clRetainMemObject(buffer); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clSetMemObjectDestructorCallback(const struct clSetMemObjectDestructorCallback_st *data) { test_icd_app_log("clSetMemObjectDestructorCallback(%p, %p, %p)\n", buffer, data->pfn_notify, data->user_data); ret_val=clSetMemObjectDestructorCallback(buffer, data->pfn_notify, data->user_data); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueUnmapMemObject(const struct clEnqueueUnmapMemObject_st *data) { test_icd_app_log("clEnqueueUnmapMemObject(%p, %p, %p, %u, %p, %p)\n", command_queue, buffer, data->mapped_ptr, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueUnmapMemObject(command_queue, buffer, data->mapped_ptr, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetMemObjectInfo (const struct clGetMemObjectInfo_st *data) { test_icd_app_log("clGetMemObjectInfo(%p, %u, %u, %p, %p)\n", buffer, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetMemObjectInfo(buffer, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n",ret_val); return 0; } int test_buffer_object(void) { int i; for (i=0; i #include "param_struct.h" #include extern cl_command_queue command_queue; const struct clRetainCommandQueue_st clRetainCommandQueueData[NUM_ITEMS_clRetainCommandQueue] = { {NULL} }; const struct clGetCommandQueueInfo_st clGetCommandQueueInfoData[NUM_ITEMS_clGetCommandQueueInfo] = { {NULL, 0, 0, NULL, NULL} }; int test_clRetainCommandQueue(const struct clRetainCommandQueue_st *data) { (void)data; cl_int ret_val; test_icd_app_log("clRetainCommandQueue(%p)\n", command_queue); ret_val = clRetainCommandQueue(command_queue); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetCommandQueueInfo(const struct clGetCommandQueueInfo_st *data) { cl_int ret_val; test_icd_app_log("clGetCommandQueueInfo(%p, %u, %u, %p, %p)\n", command_queue, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val = clGetCommandQueueInfo(command_queue, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_cl_runtime(void) { int i; for (i=0; i #include #include "param_struct.h" #include extern cl_context context; extern cl_mem buffer; extern cl_command_queue command_queue; extern cl_event event; extern cl_context_properties context_properties[3]; struct clCreateFromGLBuffer_st clCreateFromGLBufferData[NUM_ITEMS_clCreateFromGLBuffer] = { {NULL, 0x0, 0, NULL} }; int test_clCreateFromGLBuffer(const struct clCreateFromGLBuffer_st* data) { cl_mem ret_mem; test_icd_app_log("clCreateFromGLBuffer(%p, %x, %u, %p)\n", context, data->flags, data->bufobj, data->errcode_ret); ret_mem = clCreateFromGLBuffer(context, data->flags, data->bufobj, data->errcode_ret); test_icd_app_log("Value returned: %p\n", ret_mem); return 0; } struct clCreateFromGLTexture_st clCreateFromGLTextureData[NUM_ITEMS_clCreateFromGLTexture] = { {NULL, 0x0, 0, 0, 0, NULL} }; int test_clCreateFromGLTexture(const struct clCreateFromGLTexture_st* data) { cl_mem ret_mem; test_icd_app_log("clCreateFromGLTexture(%p, %x, %d, %d, %u, %p)\n", context, data->flags, data->texture_target, data->miplevel, data->texture, data->errcode_ret); ret_mem = clCreateFromGLTexture(context, data->flags, data->texture_target, data->miplevel, data->texture, data->errcode_ret); test_icd_app_log("Value returned: %p\n", ret_mem); return 0; } struct clCreateFromGLTexture2D_st clCreateFromGLTexture2DData[NUM_ITEMS_clCreateFromGLTexture2D] = { {NULL, 0x0, 0, 0, 0, NULL} }; int test_clCreateFromGLTexture2D(const struct clCreateFromGLTexture2D_st* data) { cl_mem ret_mem; test_icd_app_log("clCreateFromGLTexture2D(%p, %x, %d, %d, %u, %p)\n", context, data->flags, data->texture_target, data->miplevel, data->texture, data->errcode_ret); ret_mem = clCreateFromGLTexture2D(context, data->flags, data->texture_target, data->miplevel, data->texture, data->errcode_ret); test_icd_app_log("Value returned: %p\n", ret_mem); return 0; } struct clCreateFromGLTexture3D_st clCreateFromGLTexture3DData[NUM_ITEMS_clCreateFromGLTexture3D] = { {NULL, 0, 0, 0, 0, NULL} }; int test_clCreateFromGLTexture3D(const struct clCreateFromGLTexture3D_st* data) { cl_mem ret_mem; test_icd_app_log("clCreateFromGLTexture3D(%p, %x, %d, %d, %u, %p)\n", context, data->flags, data->texture_target, data->miplevel, data->texture, data->errcode_ret); ret_mem = clCreateFromGLTexture3D(context, data->flags, data->texture_target, data->miplevel, data->texture, data->errcode_ret); test_icd_app_log("Value returned: %p\n", ret_mem); return 0; } struct clCreateFromGLRenderbuffer_st clCreateFromGLRenderbufferData[NUM_ITEMS_clCreateFromGLRenderbuffer] = { {NULL, 0x0, 0, NULL} }; int test_clCreateFromGLRenderbuffer(const struct clCreateFromGLRenderbuffer_st* data) { cl_mem ret_mem; test_icd_app_log("clCreateFromGLRenderbuffer(%p, %x, %d, %p)\n", context, data->flags, data->renderbuffer, data->errcode_ret); ret_mem = clCreateFromGLRenderbuffer(context, data->flags, data->renderbuffer, data->errcode_ret); test_icd_app_log("Value returned: %p\n", ret_mem); return 0; } struct clGetGLObjectInfo_st clGetGLObjectInfoData[NUM_ITEMS_clGetGLObjectInfo] = { {NULL, NULL, NULL} }; int test_clGetGLObjectInfo(const struct clGetGLObjectInfo_st* data) { cl_int ret_val; test_icd_app_log("clGetGLObjectInfo(%p, %p, %p)\n", buffer, data->gl_object_type, data->gl_object_name); ret_val = clGetGLObjectInfo(buffer, data->gl_object_type, data->gl_object_name); test_icd_app_log("Value returned: %p\n", ret_val); return ret_val; } struct clGetGLTextureInfo_st clGetGLTextureInfoData[NUM_ITEMS_clGetGLTextureInfo] = { {NULL, 0, 0, NULL, NULL} }; int test_clGetGLTextureInfo(const struct clGetGLTextureInfo_st* data) { cl_int ret_val; test_icd_app_log("clGetGLTextureInfo(%p, %u, %u, %p, %p)\n", buffer, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val = clGetGLTextureInfo (buffer, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %p\n", ret_val); return 0; } struct clEnqueueAcquireGLObjects_st clEnqueueAcquireGLObjectsData[NUM_ITEMS_clEnqueueAcquireGLObjects] = { {NULL, 0, NULL, 0, NULL, NULL} }; int test_clEnqueueAcquireGLObjects(const struct clEnqueueAcquireGLObjects_st* data) { cl_int ret_val; test_icd_app_log("clEnqueueAcquireGLObjects(%p, %u, %p, %u, %p, %p)\n", command_queue, data->num_objects, data->mem_objects, data->num_events_in_wait_list, &event, &event); ret_val = clEnqueueAcquireGLObjects (command_queue, data->num_objects, data->mem_objects, data->num_events_in_wait_list, &event, &event); test_icd_app_log("Value returned: %p\n", ret_val); return 0; } struct clEnqueueReleaseGLObjects_st clEnqueueReleaseGLObjectsData[NUM_ITEMS_clEnqueueReleaseGLObjects] = { {NULL, 0, NULL, 0, NULL, NULL} }; int test_clEnqueueReleaseGLObjects(const struct clEnqueueReleaseGLObjects_st* data) { cl_int ret_val; test_icd_app_log("clEnqueueReleaseGLObjects(%p, %u, %p, %u, %p, %p)\n", command_queue, data->num_objects, data->mem_objects, data->num_events_in_wait_list, &event, &event); ret_val = clEnqueueReleaseGLObjects (command_queue, data->num_objects, data->mem_objects, data->num_events_in_wait_list, &event, &event); test_icd_app_log("Value returned: %p\n", ret_val); return 0; } struct clCreateEventFromGLsyncKHR_st clCreateEventFromGLsyncKHRData[NUM_ITEMS_clCreateEventFromGLsyncKHR] = { {NULL, NULL, NULL} }; typedef cl_event (CL_API_CALL *PFN_clCreateEventFromGLsyncKHR)(cl_context /* context */, cl_GLsync /* cl_GLsync */, cl_int * /* errcode_ret */); int test_clCreateEventFromGLsyncKHR(const struct clCreateEventFromGLsyncKHR_st* data) { cl_event ret_event; PFN_clCreateEventFromGLsyncKHR pfn_clCreateEventFromGLsyncKHR = NULL; test_icd_app_log("clCreateEventFromGLsyncKHR(%p, %p, %p)\n", context, data->sync, data->errcode_ret); pfn_clCreateEventFromGLsyncKHR = (PFN_clCreateEventFromGLsyncKHR) (intptr_t)clGetExtensionFunctionAddress("clCreateEventFromGLsyncKHR"); if (!pfn_clCreateEventFromGLsyncKHR) { test_icd_app_log("clGetExtensionFunctionAddress failed!\n"); return 1; } ret_event = pfn_clCreateEventFromGLsyncKHR (context, data->sync, data->errcode_ret); test_icd_app_log("Value returned: %p\n", ret_event); return 0; } struct clGetGLContextInfoKHR_st clGetGLContextInfoKHRData[NUM_ITEMS_clGetGLContextInfoKHR] = { {NULL, 0, 0, NULL, NULL} }; typedef cl_int (CL_API_CALL *PFN_clGetGLContextInfoKHR)(const cl_context_properties * /* properties */, cl_gl_context_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */); int test_clGetGLContextInfoKHR(const struct clGetGLContextInfoKHR_st* data) { cl_int ret_val; PFN_clGetGLContextInfoKHR pfn_clGetGLContextInfoKHR = NULL; test_icd_app_log("clGetGLContextInfoKHR(%p, %u, %u, %p, %p)\n", context_properties, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); pfn_clGetGLContextInfoKHR = (PFN_clGetGLContextInfoKHR) (intptr_t)clGetExtensionFunctionAddress("clGetGLContextInfoKHR"); if (!pfn_clGetGLContextInfoKHR) { test_icd_app_log("clGetExtensionFunctionAddress failed!\n"); return 1; } ret_val = pfn_clGetGLContextInfoKHR(context_properties, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %p\n", ret_val); return 0; } int test_OpenGL_share(void) { int i; for(i=0;i #include #define CL_USE_DEPRECATED_OPENCL_1_0_APIS #define CL_USE_DEPRECATED_OPENCL_1_1_APIS #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #include #include "param_struct.h" #include extern void CL_CALLBACK createcontext_callback(const char* a, const void* b, size_t c, void* d); cl_platform_id platform; cl_uint num_platforms; cl_context context; cl_command_queue command_queue; cl_mem buffer; cl_mem subBuffer; cl_mem image; cl_sampler sampler; cl_program program; cl_kernel kernel; cl_event event; cl_device_id devices; cl_context_properties context_properties[3] = { (cl_context_properties)CL_CONTEXT_PLATFORM, 0, 0, }; const struct clGetDeviceIDs_st clGetDeviceIDsData[NUM_ITEMS_clGetDeviceIDs] = { {NULL, 0, 1, NULL, NULL} }; const struct clCreateSampler_st clCreateSamplerData[NUM_ITEMS_clCreateSampler] = { {NULL, 0x0, 0, 0, NULL}, }; const struct clCreateCommandQueue_st clCreateCommandQueueData[NUM_ITEMS_clCreateCommandQueue] = { {NULL, NULL, 0, NULL} }; const struct clCreateContext_st clCreateContextData[NUM_ITEMS_clCreateContext] = { {NULL, 1, NULL, NULL, NULL, NULL} }; const struct clCreateContextFromType_st clCreateContextFromTypeData[NUM_ITEMS_clCreateContextFromType] = { {NULL, 0, createcontext_callback, NULL, NULL} }; const struct clCreateBuffer_st clCreateBufferData[NUM_ITEMS_clCreateBuffer] = { {NULL, 0, 0, NULL, NULL} }; const struct clCreateBufferWithProperties_st clCreateBufferWithPropertiesData[NUM_ITEMS_clCreateBufferWithProperties] = { {NULL, NULL, 0, 0, NULL, NULL} }; const struct clCreateSubBuffer_st clCreateSubBufferData[NUM_ITEMS_clCreateSubBuffer] = { {NULL, 0, 0, NULL, NULL} }; const struct clCreateImage_st clCreateImageData[NUM_ITEMS_clCreateImage] = { { NULL, 0x0, NULL, NULL, NULL, NULL} }; const struct clCreateImageWithProperties_st clCreateImageWithPropertiesData[NUM_ITEMS_clCreateImageWithProperties] = { { NULL, NULL, 0x0, NULL, NULL, NULL, NULL} }; const struct clCreateImage2D_st clCreateImage2DData[NUM_ITEMS_clCreateImage2D] = { { NULL, 0x0, NULL, 0, 0, 0, NULL, NULL} }; const struct clCreateImage3D_st clCreateImage3DData[NUM_ITEMS_clCreateImage3D] = { { NULL, 0x0, NULL, 0, 0, 0, 0, 0, NULL, NULL } }; struct clReleaseMemObject_st clReleaseMemObjectData[NUM_ITEMS_clReleaseMemObject] = { {NULL} }; struct clReleaseMemObject_st clReleaseMemObjectDataSubBuffer[NUM_ITEMS_clReleaseMemObject] = { {NULL} }; struct clReleaseMemObject_st clReleaseMemObjectDataImage[NUM_ITEMS_clReleaseMemObject] = { {NULL} }; const struct clCreateProgramWithSource_st clCreateProgramWithSourceData[NUM_ITEMS_clCreateProgramWithSource] = { {NULL, 0, NULL, NULL, NULL} }; const struct clCreateProgramWithBinary_st clCreateProgramWithBinaryData[NUM_ITEMS_clCreateProgramWithBinary] = { {NULL, 0, NULL, NULL, NULL, NULL, NULL} }; const struct clCreateProgramWithBuiltInKernels_st clCreateProgramWithBuiltInKernelsData[NUM_ITEMS_clCreateProgramWithBuiltInKernels] = { {NULL, 0, NULL, NULL, NULL} }; const struct clCreateKernel_st clCreateKernelData[NUM_ITEMS_clCreateKernel] = { {NULL, NULL, NULL} }; const struct clCreateKernelsInProgram_st clCreateKernelsInProgramData[NUM_ITEMS_clCreateKernelsInProgram] = { {NULL, 0, NULL, NULL} }; const struct clCreateUserEvent_st clCreateUserEventData[NUM_ITEMS_clCreateUserEvent] = { {NULL, NULL} }; const struct clGetPlatformIDs_st clGetPlatformIDsData[NUM_ITEMS_clGetPlatformIDs] = { {0, NULL, 0} }; /* * Some log messages cause log mismatches when ICD loader calls a driver * function while initializing platforms. The functions clGetPlatform* are most * likely to be called at that time. But nothing stops an ICD loader from * calling a ICD driver function anytime. * * FIXME: Figure out a good way to handle this. */ #define ENABLE_MISMATCHING_PRINTS 0 const char *default_platform_to_find = "ICD_LOADER_TEST_OPENCL_STUB"; int test_clGetPlatformIDs(const struct clGetPlatformIDs_st* data) { const char *platform_to_find = NULL; cl_int ret_val; size_t param_val_ret_size; #define PLATFORM_NAME_SIZE 80 char platform_name[PLATFORM_NAME_SIZE]; cl_uint i; cl_platform_id *all_platforms; #if ENABLE_MISMATCHING_PRINTS test_icd_app_log("clGetPlatformIDs(%u, %p, %p)\n", data->num_entries, &platforms, &num_platforms); #else (void)data; #endif ret_val = clGetPlatformIDs(0, NULL, &num_platforms); if (ret_val != CL_SUCCESS){ return -1; } all_platforms = (cl_platform_id *) malloc (num_platforms * sizeof(cl_platform_id)); ret_val = clGetPlatformIDs(num_platforms, all_platforms, NULL); if (ret_val != CL_SUCCESS){ return -1; } platform_to_find = log_getenv("APP_PLATFORM", "ICD_LOADER_TEST_OPENCL_STUB"); for (i = 0; i < num_platforms; i++) { ret_val = clGetPlatformInfo(all_platforms[i], CL_PLATFORM_NAME, PLATFORM_NAME_SIZE, (void*)platform_name, ¶m_val_ret_size ); if (ret_val == CL_SUCCESS ){ if(!strcmp(platform_name, platform_to_find)) { platform = all_platforms[i]; } } } log_freeenv(platform_to_find); free(all_platforms); #if ENABLE_MISMATCHING_PRINTS test_icd_app_log("Value returned: %d\n", ret_val); #endif return 0; } int test_clGetDeviceIDs(const struct clGetDeviceIDs_st* data) { int ret_val; test_icd_app_log("clGetDeviceIDs(%p, %x, %u, %p, %p)\n", platform, data->device_type, data->num_entries, &devices, data->num_devices); ret_val = clGetDeviceIDs(platform, data->device_type, data->num_entries, &devices, data->num_devices); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clCreateContext(const struct clCreateContext_st* data) { test_icd_app_log("clCreateContext(%p, %u, %p, %p, %p, %p)\n", data->properties, data->num_devices, &devices, &createcontext_callback, data->user_data, data->errcode_ret); context = clCreateContext(data->properties, data->num_devices, &devices, &createcontext_callback, data->user_data, data->errcode_ret); test_icd_app_log("Value returned: %p\n", context); return 0; } int test_clCreateContextFromType(const struct clCreateContextFromType_st* data) { test_icd_app_log("clCreateContextFromType(%p, %x, %p, %p, %p)\n", context_properties, data->device_type, data->pfn_notify, data->user_data, data->errcode_ret); context = clCreateContextFromType(context_properties, data->device_type, data->pfn_notify, data->user_data, data->errcode_ret); test_icd_app_log("Value returned: %p\n", context); return 0; } int test_clCreateCommandQueue(const struct clCreateCommandQueue_st *data) { test_icd_app_log("clCreateCommandQueue(%p, %p, %x, %p)\n", context, devices, data->properties, data->errcode_ret); command_queue = clCreateCommandQueue(context, devices, data->properties, data->errcode_ret); test_icd_app_log("Value returned: %p\n", command_queue); return 0; } int test_clCreateBuffer(const struct clCreateBuffer_st *data) { test_icd_app_log("clCreateBuffer(%p, %x, %u, %p, %p)\n", context, data->flags, data->size, data->host_ptr, data->errcode_ret); buffer = clCreateBuffer(context, data->flags, data->size, data->host_ptr, data->errcode_ret); clReleaseMemObjectData->memobj = buffer; test_icd_app_log("Value returned: %p\n", buffer); return 0; } int test_clCreateBufferWithProperties(const struct clCreateBufferWithProperties_st *data) { test_icd_app_log("clCreateBufferWithProperties(%p, %p, %x, %u, %p, %p)\n", context, data->properties, data->flags, data->size, data->host_ptr, data->errcode_ret); buffer = clCreateBufferWithProperties(context, data->properties, data->flags, data->size, data->host_ptr, data->errcode_ret); clReleaseMemObjectData->memobj = buffer; test_icd_app_log("Value returned: %p\n", buffer); return 0; } int test_clCreateSubBuffer(const struct clCreateSubBuffer_st *data) { test_icd_app_log("clCreateSubBuffer(%p, %x, %u, %p, %p)\n", buffer, data->flags, data->buffer_create_type, data->buffer_create_info, data->errcode_ret); subBuffer = clCreateSubBuffer(buffer, data->flags, data->buffer_create_type, data->buffer_create_info, data->errcode_ret); clReleaseMemObjectDataSubBuffer->memobj = subBuffer; test_icd_app_log("Value returned: %p\n", subBuffer); return 0; } int test_clCreateImage(const struct clCreateImage_st *data) { test_icd_app_log("clCreateImage(%p, %x, %p, %p, %p, %p)\n", context, data->flags, data->image_format, data->image_desc, data->host_ptr, data->errcode_ret); image = clCreateImage(context, data->flags, data->image_format, data->image_desc, data->host_ptr, data->errcode_ret); clReleaseMemObjectDataImage[0].memobj = image; test_icd_app_log("Value returned: %p\n", image); return 0; } int test_clCreateImageWithProperties(const struct clCreateImageWithProperties_st *data) { test_icd_app_log("clCreateImageWithProperties(%p, %p, %x, %p, %p, %p, %p)\n", context, data->properties, data->flags, data->image_format, data->image_desc, data->host_ptr, data->errcode_ret); image = clCreateImageWithProperties(context, data->properties, data->flags, data->image_format, data->image_desc, data->host_ptr, data->errcode_ret); clReleaseMemObjectDataImage[0].memobj = image; test_icd_app_log("Value returned: %p\n", image); return 0; } int test_clCreateImage2D(const struct clCreateImage2D_st *data) { test_icd_app_log("clCreateImage2D(%p, %x, %p, %u, %u, %u, %p, %p)\n", context, data->flags, data->image_format, data->image_width, data->image_height, data->image_row_pitch, data->host_ptr, data->errcode_ret); image = clCreateImage2D(context, data->flags, data->image_format, data->image_width, data->image_height, data->image_row_pitch, data->host_ptr, data->errcode_ret); clReleaseMemObjectDataImage[0].memobj = image; test_icd_app_log("Value returned: %p\n", image); return 0; } int test_clCreateImage3D(const struct clCreateImage3D_st *data) { test_icd_app_log("clCreateImage3D(%p, %x, %p, %u, %u, %u, %u, %u, %p, %p)\n", context, data->flags, data->image_format, data->image_width, data->image_height, data->image_depth, data->image_row_pitch, data->image_slice_pitch, data->host_ptr, data->errcode_ret); image = clCreateImage3D(context, data->flags, data->image_format, data->image_width, data->image_height, data->image_depth, data->image_row_pitch, data->image_slice_pitch, data->host_ptr, data->errcode_ret); clReleaseMemObjectDataImage[0].memobj = image; test_icd_app_log("Value returned: %p\n", image); return 0; } int test_clCreateSampler(const struct clCreateSampler_st *data) { test_icd_app_log("clCreateSampler(%p, %u, %u, %u, %p)\n", context, data->normalized_coords, data->addressing_mode, data->filter_mode, data->errcode_ret); sampler = clCreateSampler(context, data->normalized_coords, data->addressing_mode, data->filter_mode, data->errcode_ret); test_icd_app_log("Value returned: %p\n", sampler); return 0; } int test_clCreateProgramWithSource(const struct clCreateProgramWithSource_st *data) { test_icd_app_log("clCreateProgramWithSource(%p, %u, %p, %p, %p)\n", context, data->count, data->strings, data->lengths, data->errcode_ret); program = clCreateProgramWithSource(context, data->count, data->strings, data->lengths, data->errcode_ret); test_icd_app_log("Value returned: %p\n", program); return 0; } int test_clCreateProgramWithBinary(const struct clCreateProgramWithBinary_st *data) { test_icd_app_log("clCreateProgramWithBinary(%p, %u, %p, %p, %p, %p, %p)\n", context, data->num_devices, &devices, data->lengths, data->binaries, data->binary_status, data->errcode_ret); program = clCreateProgramWithBinary(context, data->num_devices, &devices, data->lengths, data->binaries, data->binary_status, data->errcode_ret); test_icd_app_log("Value returned: %p\n", program); return 0; } int test_clCreateProgramWithBuiltInKernels(const struct clCreateProgramWithBuiltInKernels_st *data) { test_icd_app_log("clCreateProgramWithBuiltInKernels(%p, %u, %p, %p, %p)\n", context, data->num_devices, &devices, data->kernel_names, data->errcode_ret); program = clCreateProgramWithBuiltInKernels(context, data->num_devices, &devices, data->kernel_names, data->errcode_ret); test_icd_app_log("Value returned: %p\n", program); return 0; } int test_clCreateKernel(const struct clCreateKernel_st* data) { test_icd_app_log("clCreateKernel(%p, %p, %p)\n", program, data->kernel_name, data->errcode_ret); kernel = clCreateKernel(program, data->kernel_name, data->errcode_ret); test_icd_app_log("Value returned: %p\n", kernel); return 0; } int test_clCreateKernelsInProgram(const struct clCreateKernelsInProgram_st* data) { int ret_val; test_icd_app_log("clCreateKernelsInProgram(%p, %u, %p, %p)\n", program, data->num_kernels, &kernel, data->num_kernels_ret); ret_val = clCreateKernelsInProgram(program, data->num_kernels, &kernel, data->num_kernels_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clCreateUserEvent(const struct clCreateUserEvent_st* data) { test_icd_app_log("clCreateUserEvent(%p, %p)\n", context, data->errcode_ret); event = clCreateUserEvent(context, data->errcode_ret); test_icd_app_log("Value returned: %p\n", event); return 0; } const struct clReleaseSampler_st clReleaseSamplerData[NUM_ITEMS_clReleaseSampler] = { { NULL } }; int test_clReleaseSampler(const struct clReleaseSampler_st *data) { (void)data; int ret_val = CL_OUT_OF_RESOURCES; test_icd_app_log("clReleaseSampler(%p)\n", sampler); ret_val = clReleaseSampler(sampler); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clReleaseMemObject(const struct clReleaseMemObject_st *data) { int ret_val = -15; test_icd_app_log("clReleaseMemObject(%p)\n", data->memobj); ret_val = clReleaseMemObject(data->memobj); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } const struct clReleaseEvent_st clReleaseEventData[NUM_ITEMS_clReleaseEvent] = { {NULL} }; int test_clReleaseEvent(const struct clReleaseEvent_st* data) { (void)data; int ret_val = CL_OUT_OF_RESOURCES; test_icd_app_log("clReleaseEvent(%p)\n", event); ret_val = clReleaseEvent(event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } const struct clReleaseKernel_st clReleaseKernelData[NUM_ITEMS_clReleaseKernel] = { {NULL} }; int test_clReleaseKernel(const struct clReleaseKernel_st* data) { (void)data; int ret_val = CL_OUT_OF_RESOURCES; test_icd_app_log("clReleaseKernel(%p)\n", kernel); ret_val = clReleaseKernel(kernel); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } const struct clReleaseProgram_st clReleaseProgramData[NUM_ITEMS_clReleaseProgram] = { {NULL} }; int test_clReleaseProgram(const struct clReleaseProgram_st *data) { (void)data; int ret_val = CL_OUT_OF_RESOURCES; test_icd_app_log("clReleaseProgram(%p)\n", program); ret_val = clReleaseProgram(program); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } const struct clReleaseCommandQueue_st clReleaseCommandQueueData[NUM_ITEMS_clReleaseCommandQueue] = { {NULL} }; int test_clReleaseCommandQueue(const struct clReleaseCommandQueue_st *data) { (void)data; int ret_val = CL_OUT_OF_RESOURCES; test_icd_app_log("clReleaseCommandQueue(%p)\n", command_queue); ret_val = clReleaseCommandQueue(command_queue); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } const struct clReleaseContext_st clReleaseContextData[NUM_ITEMS_clReleaseContext] = { {NULL} }; int test_clReleaseContext(const struct clReleaseContext_st* data) { (void)data; int ret_val = CL_OUT_OF_RESOURCES; test_icd_app_log("clReleaseContext(%p)\n", context); ret_val = clReleaseContext(context); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } const struct clReleaseDevice_st clReleaseDeviceData[NUM_ITEMS_clReleaseDevice] = { {NULL} }; int test_clReleaseDevice(const struct clReleaseDevice_st* data) { (void)data; int ret_val = CL_OUT_OF_RESOURCES; test_icd_app_log("clReleaseDevice(%p)\n", devices); ret_val = clReleaseDevice(devices); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_create_calls(void) { test_clGetPlatformIDs(clGetPlatformIDsData); context_properties[1] = (cl_context_properties) platform; test_clGetDeviceIDs(clGetDeviceIDsData); test_clCreateContext(clCreateContextData); test_clReleaseContext(clReleaseContextData); test_clCreateContextFromType(clCreateContextFromTypeData); test_clCreateCommandQueue(clCreateCommandQueueData); test_clCreateBuffer(clCreateBufferData); test_clReleaseMemObject(clReleaseMemObjectData); test_clCreateBufferWithProperties(clCreateBufferWithPropertiesData); test_clCreateSubBuffer(clCreateSubBufferData); test_clCreateImage(clCreateImageData); test_clReleaseMemObject(clReleaseMemObjectDataImage); test_clCreateImageWithProperties(clCreateImageWithPropertiesData); test_clReleaseMemObject(clReleaseMemObjectDataImage); test_clCreateImage2D(clCreateImage2DData); test_clReleaseMemObject(clReleaseMemObjectDataImage); test_clCreateImage3D(clCreateImage3DData); test_clCreateSampler(clCreateSamplerData); test_clCreateProgramWithSource(clCreateProgramWithSourceData); test_clReleaseProgram(clReleaseProgramData); test_clCreateProgramWithBinary(clCreateProgramWithBinaryData); test_clReleaseProgram(clReleaseProgramData); test_clCreateProgramWithBuiltInKernels(clCreateProgramWithBuiltInKernelsData); test_clCreateKernel(clCreateKernelData); test_clCreateKernelsInProgram(clCreateKernelsInProgramData); test_clCreateUserEvent(clCreateUserEventData); return 0; } int test_release_calls(void) { test_clReleaseSampler(clReleaseSamplerData); test_clReleaseMemObject(clReleaseMemObjectData); test_clReleaseMemObject(clReleaseMemObjectDataSubBuffer); test_clReleaseMemObject(clReleaseMemObjectDataImage); test_clReleaseEvent(clReleaseEventData); test_clReleaseKernel(clReleaseKernelData); test_clReleaseProgram(clReleaseProgramData); test_clReleaseCommandQueue(clReleaseCommandQueueData); test_clReleaseContext(clReleaseContextData); test_clReleaseDevice(clReleaseDeviceData); return 0; } OpenCL-ICD-Loader-2025.07.22/test/loader_test/test_image_objects.c000066400000000000000000000275531503776305700243470ustar00rootroot00000000000000#include #include #include "param_struct.h" #include extern cl_mem image; extern cl_context context; extern cl_command_queue command_queue; extern cl_event event; extern cl_mem buffer; const struct clGetSupportedImageFormats_st clGetSupportedImageFormatsData[NUM_ITEMS_clGetSupportedImageFormats] = { { NULL, 0x0, 0, 0, NULL, NULL } }; const struct clEnqueueCopyImageToBuffer_st clEnqueueCopyImageToBufferData[NUM_ITEMS_clEnqueueCopyImageToBuffer] = { { NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL } }; const struct clEnqueueCopyBufferToImage_st clEnqueueCopyBufferToImageData[NUM_ITEMS_clEnqueueCopyBufferToImage] = { { NULL, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL } }; const struct clEnqueueMapImage_st clEnqueueMapImageData[NUM_ITEMS_clEnqueueMapImage] = { { NULL, NULL, 0, 0x0, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL} }; const struct clEnqueueReadImage_st clEnqueueReadImageData[NUM_ITEMS_clEnqueueReadImage] = { { NULL, NULL, 0, NULL, NULL, 0, 0, NULL, 0, NULL, NULL } }; const struct clEnqueueWriteImage_st clEnqueueWriteImageData[NUM_ITEMS_clEnqueueWriteImage] = { { NULL, NULL, 0, NULL, NULL, 0, 0, NULL, 0, NULL, NULL } }; const struct clEnqueueFillImage_st clEnqueueFillImageData[NUM_ITEMS_clEnqueueFillImage] = { { NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL } }; const struct clEnqueueCopyImage_st clEnqueueCopyImageData[NUM_ITEMS_clEnqueueCopyImage] = { { NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL } }; const struct clGetImageInfo_st clGetImageInfoData[NUM_ITEMS_clGetImageInfo] = { { NULL, 0, 0, NULL, NULL} }; int test_clGetSupportedImageFormats(const struct clGetSupportedImageFormats_st *data) { cl_int ret_val; test_icd_app_log("clGetSupportedImageFormats(%p, %x, %u, %u, %p, %p)\n", context, data->flags, data->image_type, data->num_entries, data->image_formats, data->num_image_formats); ret_val = clGetSupportedImageFormats(context, data->flags, data->image_type, data->num_entries, data->image_formats, data->num_image_formats); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueCopyImageToBuffer(const struct clEnqueueCopyImageToBuffer_st *data) { cl_int ret_val; test_icd_app_log("clEnqueueCopyImageToBuffer(%p, %p, %p, %p, %p, %u, %u, %p, %p)\n", command_queue, image, buffer, data->src_origin, data->region, data->dst_offset, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val = clEnqueueCopyImageToBuffer(command_queue, image, buffer, data->src_origin, data->region, data->dst_offset, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueCopyBufferToImage(const struct clEnqueueCopyBufferToImage_st *data) { cl_int ret_val; test_icd_app_log("clEnqueueCopyBufferToImage(%p, %p, %p, %u, %p, %p, %u, %p, %p)\n", command_queue, buffer, image, data->src_offset, data->dst_origin, data->region, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val = clEnqueueCopyBufferToImage(command_queue, buffer, image, data->src_offset, data->dst_origin, data->region, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueMapImage(const struct clEnqueueMapImage_st *data) { void *return_value; test_icd_app_log("clEnqueueMapImage(%p, %p, %u, %x, %p, %p, %p, %p, %u, %p, %p, %p)\n", command_queue, image, data->blocking_map, data->map_flags, data->origin, data->region, data->image_row_pitch, data->image_slice_pitch, data->num_events_in_wait_list, data->event_wait_list, &event, data->errcode_ret); return_value = clEnqueueMapImage(command_queue, image, data->blocking_map, data->map_flags, data->origin, data->region, data->image_row_pitch, data->image_slice_pitch, data->num_events_in_wait_list, data->event_wait_list, &event, data->errcode_ret); test_icd_app_log("Value returned: %p\n", return_value); free(return_value); return 0; } int test_clEnqueueReadImage(const struct clEnqueueReadImage_st *data) { cl_int ret_val; test_icd_app_log("clEnqueueReadImage(%p, %p, %u, %p, %p, %u, %u, %p, %u, %p, %p)\n", command_queue, image, data->blocking_read, data->origin, data->region, data->row_pitch, data->slice_pitch, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val = clEnqueueReadImage(command_queue, image, data->blocking_read, data->origin, data->region, data->row_pitch, data->slice_pitch, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueWriteImage(const struct clEnqueueWriteImage_st *data) { cl_int ret_val; test_icd_app_log("clEnqueueWriteImage(%p, %p, %u, %p, %p, %u, %u, %p, %u, %p, %p)\n", command_queue, image, data->blocking_write, data->origin, data->region, data->input_row_pitch, data->input_slice_pitch, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val = clEnqueueWriteImage(command_queue, image, data->blocking_write, data->origin, data->region, data->input_row_pitch, data->input_slice_pitch, data->ptr, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueFillImage(const struct clEnqueueFillImage_st *data) { cl_int ret_val; test_icd_app_log("clEnqueueFillImage(%p, %p, %p, %p, %p, %u, %p, %p)\n", command_queue, image, data->fill_color, data->origin, data->region, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val = clEnqueueFillImage(command_queue, image, data->fill_color, data->origin, data->region, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clEnqueueCopyImage(const struct clEnqueueCopyImage_st *data) { cl_int ret_val; test_icd_app_log("clEnqueueCopyImage(%p, %p, %p, %p, %p, %p, %u, %p, %p)\n", command_queue, image, image, data->src_origin, data->dst_origin, data->region, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val = clEnqueueCopyImage(command_queue, image, image, data->src_origin, data->dst_origin, data->region, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetImageInfo(const struct clGetImageInfo_st *data) { cl_int ret_val; test_icd_app_log("clGetImageInfo(%p, %u, %u, %p, %p)\n", image, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val = clGetImageInfo(image, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_image_objects(void) { int i; for (i = 0; i #include "param_struct.h" #include extern cl_kernel kernel; extern cl_event event; extern cl_context context; extern cl_command_queue command_queue; extern cl_device_id devices; static int ret_val; extern void CL_CALLBACK setevent_callback(cl_event _a, cl_int _b, void* _c); extern void CL_CALLBACK setprintf_callback(cl_context _a, cl_uint _b, char* _c, void* _d ); struct clRetainKernel_st clRetainKernelData[NUM_ITEMS_clRetainKernel] = { {NULL} }; int test_clRetainKernel(const struct clRetainKernel_st* data) { (void)data; test_icd_app_log("clRetainKernel(%p)\n", kernel); ret_val=clRetainKernel(kernel); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clSetKernelArg_st clSetKernelArgData[NUM_ITEMS_clSetKernelArg] = { {NULL, 0, 0, NULL} }; int test_clSetKernelArg(const struct clSetKernelArg_st* data) { test_icd_app_log("clSetKernelArg(%p, %u, %u, %p)\n", kernel, data->arg_index, data->arg_size, data->arg_value); ret_val=clSetKernelArg(kernel, data->arg_index, data->arg_size, data->arg_value); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clGetKernelInfo_st clGetKernelInfoData[NUM_ITEMS_clGetKernelInfo] = { {NULL, 0, 0, NULL, NULL} }; int test_clGetKernelInfo(const struct clGetKernelInfo_st* data) { test_icd_app_log("clGetKernelInfo(%p, %u, %u, %p, %p)\n", kernel, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetKernelInfo(kernel, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clGetKernelArgInfo_st clGetKernelArgInfoData[NUM_ITEMS_clGetKernelArgInfo] = { {NULL, 0, 0, 0, NULL, NULL} }; int test_clGetKernelArgInfo(const struct clGetKernelArgInfo_st* data) { test_icd_app_log("clGetKernelArgInfo(%p, %u, %u, %u, %p, %p)\n", kernel, data->arg_indx, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetKernelArgInfo(kernel, data->arg_indx, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clGetKernelWorkGroupInfo_st clGetKernelWorkGroupInfoData[NUM_ITEMS_clGetKernelWorkGroupInfo] = { {NULL, NULL, 0, 0, NULL, NULL} }; int test_clGetKernelWorkGroupInfo(const struct clGetKernelWorkGroupInfo_st* data) { test_icd_app_log("clGetKernelWorkGroupInfo(%p, %p, %u, %u, %p, %p)\n", kernel, devices, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetKernelWorkGroupInfo(kernel, devices, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueMigrateMemObjects_st clEnqueueMigrateMemObjectsData[NUM_ITEMS_clEnqueueMigrateMemObjects] = { {NULL, 0, NULL, 0x0, 0, NULL, NULL} }; int test_clEnqueueMigrateMemObjects(const struct clEnqueueMigrateMemObjects_st* data) { test_icd_app_log("clEnqueueMigrateMemObjects(%p, %u, %p, %x, %u, %p, %p)\n", command_queue, data->num_mem_objects, data->mem_objects, data->flags, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueMigrateMemObjects(command_queue, data->num_mem_objects, data->mem_objects, data->flags, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueNDRangeKernel_st clEnqueueNDRangeKernelData[NUM_ITEMS_clEnqueueNDRangeKernel] = { {NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, NULL} }; int test_clEnqueueNDRangeKernel(const struct clEnqueueNDRangeKernel_st* data) { test_icd_app_log("clEnqueueNDRangeKernel(%p, %p, %u, %p, %p, %p, %u, %p, %p)\n", command_queue, kernel, data->work_dim, data->global_work_offset, data->global_work_size, data->local_work_size, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueNDRangeKernel(command_queue, kernel, data->work_dim, data->global_work_offset, data->global_work_size, data->local_work_size, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueTask_st clEnqueueTaskData[NUM_ITEMS_clEnqueueTask] = { {NULL, NULL, 0, NULL, NULL} }; int test_clEnqueueTask(const struct clEnqueueTask_st* data) { test_icd_app_log("clEnqueueTask(%p, %p, %u, %p, %p)\n", command_queue, kernel, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueTask(command_queue, kernel, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueNativeKernel_st clEnqueueNativeKernelData[NUM_ITEMS_clEnqueueNativeKernel] = { {NULL, NULL, NULL, 0, 0, NULL, NULL, 0, NULL, NULL} }; int test_clEnqueueNativeKernel(const struct clEnqueueNativeKernel_st* data) { test_icd_app_log("clEnqueueNativeKernel(%p, %p, %p, %u, %u, %p, %p, %u, %p, %p)\n", command_queue, data->user_func, data->args, data->cb_args, data->num_mem_objects, data->mem_list, data->args_mem_loc, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueNativeKernel(command_queue, data->user_func, data->args, data->cb_args, data->num_mem_objects, data->mem_list, data->args_mem_loc, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clSetUserEventStatus_st clSetUserEventStatusData[NUM_ITEMS_clSetUserEventStatus] = { {NULL, 0} }; int test_clSetUserEventStatus(const struct clSetUserEventStatus_st* data) { test_icd_app_log("clSetUserEventStatus(%p, %d)\n", event, data->execution_status); ret_val=clSetUserEventStatus(event, data->execution_status); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clWaitForEvents_st clWaitForEventsData[NUM_ITEMS_clWaitForEvents] = { {1, NULL} }; int test_clWaitForEvents(const struct clWaitForEvents_st* data) { test_icd_app_log("clWaitForEvents(%u, %p)\n", data->num_events, &event); ret_val=clWaitForEvents(data->num_events, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clGetEventInfo_st clGetEventInfoData[NUM_ITEMS_clGetEventInfo] = { {NULL, 0, 0, NULL, NULL} }; int test_clGetEventInfo(const struct clGetEventInfo_st* data){ test_icd_app_log("clGetEventInfo(%p, %u, %u, %p, %p)\n", event, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetEventInfo(event, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clSetEventCallback_st clSetEventCallbackData[NUM_ITEMS_clSetEventCallback] = { {NULL, 0, setevent_callback, NULL} }; int test_clSetEventCallback(const struct clSetEventCallback_st* data) { test_icd_app_log("clSetEventCallback(%p, %d, %p, %p)\n", event, data->command_exec_callback_type, data->pfn_event_notify, data->user_data); ret_val=clSetEventCallback(event, data->command_exec_callback_type, data->pfn_event_notify, data->user_data); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clRetainEvent_st clRetainEventData[NUM_ITEMS_clRetainEvent] = { {NULL} }; int test_clRetainEvent(const struct clRetainEvent_st* data) { (void)data; test_icd_app_log("clRetainEvent(%p)\n", event); ret_val=clRetainEvent(event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueMarker_st clEnqueueMarkerData[NUM_ITEMS_clEnqueueMarker] = { {NULL, NULL} }; int test_clEnqueueMarker(const struct clEnqueueMarker_st* data) { (void)data; test_icd_app_log("clEnqueueMarker(%p, %p)\n", command_queue, &event); ret_val = clEnqueueMarker(command_queue, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueMarkerWithWaitList_st clEnqueueMarkerWithWaitListData[NUM_ITEMS_clEnqueueMarkerWithWaitList] = { {NULL, 0, NULL, NULL} }; int test_clEnqueueMarkerWithWaitList(const struct clEnqueueMarkerWithWaitList_st* data) { test_icd_app_log("clEnqueueMarkerWithWaitList(%p, %u, %p, %p)\n", command_queue, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueMarkerWithWaitList(command_queue, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueBarrierWithWaitList_st clEnqueueBarrierWithWaitListData[NUM_ITEMS_clEnqueueBarrierWithWaitList] = { {NULL, 0, NULL, NULL} }; int test_clEnqueueBarrierWithWaitList(const struct clEnqueueBarrierWithWaitList_st* data) { test_icd_app_log("clEnqueueBarrierWithWaitList(%p, %u, %p, %p)\n", command_queue, data->num_events_in_wait_list, data->event_wait_list, &event); ret_val=clEnqueueBarrierWithWaitList(command_queue, data->num_events_in_wait_list, data->event_wait_list, &event); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueWaitForEvents_st clEnqueueWaitForEventsData[NUM_ITEMS_clEnqueueWaitForEvents] = { {NULL, 0, NULL} }; int test_clEnqueueWaitForEvents(const struct clEnqueueWaitForEvents_st* data) { test_icd_app_log("clEnqueueWaitForEvents(%p, %u, %p)\n", command_queue, data->num_events, data->event_list); ret_val = clEnqueueWaitForEvents(command_queue, data->num_events, data->event_list); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clEnqueueBarrier_st clEnqueueBarrierData[NUM_ITEMS_clEnqueueBarrier] = { {NULL} }; int test_clEnqueueBarrier(const struct clEnqueueBarrier_st* data) { (void)data; test_icd_app_log("clEnqueueBarrier(%p)\n", command_queue); ret_val = clEnqueueBarrier(command_queue); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clGetEventProfilingInfo_st clGetEventProfilingInfoData[NUM_ITEMS_clGetEventProfilingInfo] = { {NULL, 0, 0, NULL, NULL} }; int test_clGetEventProfilingInfo(const struct clGetEventProfilingInfo_st* data) { test_icd_app_log("clGetEventProfilingInfo(%p, %u, %u, %p, %p)\n", event, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetEventProfilingInfo(event, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clFlush_st clFlushData[NUM_ITEMS_clFlush] = { {NULL} }; int test_clFlush(const struct clFlush_st* data) { (void)data; test_icd_app_log("clFlush(%p)\n", command_queue); ret_val=clFlush(command_queue); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } struct clFinish_st clFinishData[NUM_ITEMS_clFinish] = { {NULL} }; int test_clFinish(const struct clFinish_st* data) { (void)data; test_icd_app_log("clFinish(%p)\n", command_queue); ret_val=clFinish(command_queue); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_kernel(void) { int i; for (i=0; i #include "param_struct.h" #include extern cl_context context; extern cl_platform_id platform; extern cl_device_id devices; extern void CL_CALLBACK setcontextdestructor_callback(cl_context _a, void* _b); struct clRetainContext_st clRetainContextData[NUM_ITEMS_clRetainContext] = { {NULL} }; struct clGetContextInfo_st clGetContextInfoData[NUM_ITEMS_clGetContextInfo] = { {NULL, 0, 0, NULL, NULL} }; struct clSetContextDestructorCallback_st clSetContextDestructorCallbackData[NUM_ITEMS_clSetContextDestructorCallback] = { {NULL, setcontextdestructor_callback, NULL} }; struct clGetPlatformInfo_st clGetPlatformInfoData[NUM_ITEMS_clGetPlatformInfo] = { {NULL, 0, 0, NULL, NULL} }; struct clGetDeviceInfo_st clGetDeviceInfoData[NUM_ITEMS_clGetDeviceInfo] = { {NULL, 0, 0, NULL, NULL} }; struct clCreateSubDevices_st clCreateSubDevicesData[NUM_ITEMS_clCreateSubDevices] = { {NULL, NULL, 0, NULL, NULL} }; struct clRetainDevice_st clRetainDeviceData[NUM_ITEMS_clRetainDevice] = { {NULL} }; int test_clRetainContext(const struct clRetainContext_st* data) { (void)data; cl_int ret_val; test_icd_app_log("clRetainContext(%p)\n", context); ret_val = clRetainContext(context); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetContextInfo(const struct clGetContextInfo_st* data) { cl_int ret_val; test_icd_app_log("clGetContextInfo(%p, %u, %u, %p, %p)\n", context, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val = clGetContextInfo(context, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clSetContextDestructorCallback( const struct clSetContextDestructorCallback_st* data) { cl_int ret_val; test_icd_app_log( "clSetContextDestructorCallback(%p, %p, %p)\n", context, data->pfn_notify, data->user_data); ret_val = clSetContextDestructorCallback( context, data->pfn_notify, data->user_data); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetPlatformInfo(const struct clGetPlatformInfo_st* data) { cl_int ret_val; test_icd_app_log("clGetPlatformInfo(%p, %u, %u, %p, %p)\n", platform, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val = clGetPlatformInfo(platform, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetDeviceInfo(const struct clGetDeviceInfo_st* data) { cl_int ret_val; test_icd_app_log("clGetDeviceInfo(%p, %u, %u, %p, %p)\n", devices, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val = clGetDeviceInfo(devices, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clCreateSubDevices(const struct clCreateSubDevices_st* data) { cl_int ret_val; test_icd_app_log("clCreateSubDevices(%p, %p, %u, %p, %p)\n", devices, data->properties, data->num_entries, &devices, data->num_devices); ret_val = clCreateSubDevices(devices, data->properties, data->num_entries, &devices, data->num_devices); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clRetainDevice(const struct clRetainDevice_st* data) { (void)data; cl_int ret_val; test_icd_app_log("clRetainDevice(%p)\n", devices); ret_val = clRetainDevice(devices); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_platforms(void) { int i; for (i = 0;i #include "param_struct.h" #include extern cl_context context; extern cl_program program; extern cl_platform_id platform; extern cl_device_id devices; extern void CL_CALLBACK program_callback(cl_program _a, void* _b); const struct clRetainProgram_st clRetainProgramData[NUM_ITEMS_clRetainProgram]= { {NULL} }; const struct clBuildProgram_st clBuildProgramData[NUM_ITEMS_clBuildProgram]= { {NULL,0,NULL,NULL,program_callback,NULL} }; const struct clCompileProgram_st clCompileProgramData[NUM_ITEMS_clCompileProgram]= { {NULL,0,NULL,NULL,0,NULL,NULL,program_callback,NULL} }; const struct clLinkProgram_st clLinkProgramData[NUM_ITEMS_clLinkProgram]= { {NULL,0,NULL,NULL,0,NULL,program_callback,NULL,NULL} }; const struct clUnloadPlatformCompiler_st clUnloadPlatformCompilerData[NUM_ITEMS_clUnloadPlatformCompiler]= { {NULL} }; const struct clGetExtensionFunctionAddressForPlatform_st clGetExtensionFunctionAddressForPlatformData[NUM_ITEMS_clGetExtensionFunctionAddressForPlatform]= { {NULL, ""} }; const struct clGetProgramInfo_st clGetProgramInfoData[NUM_ITEMS_clGetProgramInfo]= { {NULL,0,0,NULL,NULL} }; const struct clGetProgramBuildInfo_st clGetProgramBuildInfoData[NUM_ITEMS_clGetProgramBuildInfo]= { {NULL,NULL,0,0,NULL,NULL} }; int test_clRetainProgram(const struct clRetainProgram_st *data) { (void)data; cl_int ret_val; test_icd_app_log("clRetainProgram(%p)\n", program); ret_val=clRetainProgram(program); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clBuildProgram(const struct clBuildProgram_st *data) { cl_int ret_val; test_icd_app_log("clBuildProgram(%p, %u, %p, %p, %p, %p)\n", program, data->num_devices, &devices, data->options, data->pfn_notify, data->user_data); ret_val=clBuildProgram(program, data->num_devices, &devices, data->options, data->pfn_notify, data->user_data); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clCompileProgram(const struct clCompileProgram_st *data) { cl_int ret_val; test_icd_app_log("clCompileProgram(%p, %u, %p, %p, %u, %p, %p, %p)\n", program, data->num_devices, &devices, data->options, data->num_input_headers, data->header_include_names, data->pfn_notify, data->user_data); ret_val=clCompileProgram(program, data->num_devices, &devices, data->options, data->num_input_headers, data->headers, data->header_include_names, data->pfn_notify, data->user_data); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clLinkProgram(const struct clLinkProgram_st *data) { cl_program linked_program; cl_int ret_val; test_icd_app_log("clLinkProgram(%p, %u, %p, %p, %u, %p, %p, %p, %p)\n", context, data->num_devices, data->device_list, data->options, data->num_input_programs, data->input_programs, data->pfn_notify, data->user_data, data->errcode_ret); linked_program=clLinkProgram(context, data->num_devices, data->device_list, data->options, data->num_input_programs, data->input_programs, data->pfn_notify, data->user_data, data->errcode_ret); test_icd_app_log("Value returned: %p\n", linked_program); test_icd_app_log("clReleaseProgram(%p)\n", linked_program); ret_val = clReleaseProgram(linked_program); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clUnloadPlatformCompiler(const struct clUnloadPlatformCompiler_st *data) { (void)data; cl_int ret_val; test_icd_app_log("clUnloadPlatformCompiler(%p)\n", platform); ret_val=clUnloadPlatformCompiler(platform); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetExtensionFunctionAddressForPlatform(const struct clGetExtensionFunctionAddressForPlatform_st *data) { void *return_value; test_icd_app_log("clGetExtensionFunctionAddressForPlatform(%p, %p)\n", platform, data->func_name); return_value=clGetExtensionFunctionAddressForPlatform(platform, data->func_name); test_icd_app_log("Value returned: %p\n", return_value); return 0; } int test_clGetProgramInfo(const struct clGetProgramInfo_st *data) { cl_int ret_val; test_icd_app_log("clGetProgramInfo(%p, %u, %u, %p, %p)\n", program, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetProgramInfo(program, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetProgramBuildInfo(const struct clGetProgramBuildInfo_st *data) { cl_int ret_val; test_icd_app_log("clGetProgramBuildInfo(%p, %p, %u, %u, %p, %p)\n", program, data->device, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetProgramBuildInfo(program, data->device, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_program_objects(void) { int i; for (i=0;i #include "param_struct.h" #include extern cl_sampler sampler; const struct clRetainSampler_st clRetainSamplerData[NUM_ITEMS_clRetainSampler]= { { NULL } }; const struct clGetSamplerInfo_st clGetSamplerInfoData[NUM_ITEMS_clGetSamplerInfo]= { { NULL, 0, 0, NULL, NULL } }; int test_clRetainSampler(const struct clRetainSampler_st *data) { (void)data; cl_int ret_val; test_icd_app_log("clRetainSampler(%p)\n", sampler); ret_val=clRetainSampler(sampler); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_clGetSamplerInfo(const struct clGetSamplerInfo_st *data) { cl_int ret_val; test_icd_app_log("clGetSamplerInfo(%p, %u, %u, %p, %p)\n", sampler, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); ret_val=clGetSamplerInfo(sampler, data->param_name, data->param_value_size, data->param_value, data->param_value_size_ret); test_icd_app_log("Value returned: %d\n", ret_val); return 0; } int test_sampler_objects(void) { int i; for (i=0;i #include #include #include #include #include #if defined(_WIN32) #include #endif #define APP_LOG_FILE "icd_test_app_log.txt" #define STUB_LOG_FILE "icd_test_stub_log.txt" const char * log_getenv(const char *name, const char *dflt) { #if defined(_WIN32) char *retVal = NULL; DWORD valSize; valSize = GetEnvironmentVariableA(name, NULL, 0); // valSize DOES include the null terminator, so for any set variable // will always be at least 1. If it's 0, the variable wasn't set. if (valSize == 0) { if (dflt) { size_t sz = strlen(dflt) + 1; retVal = (char *)malloc(sz); if (retVal) strcpy(retVal, dflt); } return retVal; } // Allocate the space necessary for the registry entry retVal = (char *)malloc(valSize); if (NULL != retVal) { GetEnvironmentVariableA(name, retVal, valSize); } return retVal; #else const char *var = NULL; var = getenv(name); if (!var) var = dflt; return var; #endif } void log_freeenv(const char *var) { #if defined(_WIN32) if (var) free((void *)var); #else (void)var; #endif } static FILE *app_log_file; static FILE *stub_log_file; static const char *test_icd_get_app_log_file_name(void) { return log_getenv("APP_LOG_FILE", APP_LOG_FILE); } static const char *test_icd_get_stub_log_file_name(void) { return log_getenv("APP_STUB_FILE", STUB_LOG_FILE); } int test_icd_initialize_app_log(void) { const char *app_log_file_name = test_icd_get_app_log_file_name(); app_log_file = fopen(app_log_file_name, "w"); if (!app_log_file) { printf("Unable to open file %s\n", app_log_file_name); log_freeenv(app_log_file_name); return -1; } log_freeenv(app_log_file_name); return 0; } void test_icd_close_app_log(void) { fclose(app_log_file); } void test_icd_app_log(const char *format, ...) { va_list args; va_start(args, format); vfprintf(app_log_file, format, args); va_end(args); } int test_icd_initialize_stub_log(void) { const char *stub_log_file_name = test_icd_get_stub_log_file_name(); stub_log_file = fopen(stub_log_file_name, "w"); if (!stub_log_file) { printf("Unable to open file %s\n", stub_log_file_name); log_freeenv(stub_log_file_name); return -1; } log_freeenv(stub_log_file_name); return 0; } void test_icd_close_stub_log(void) { fclose(stub_log_file); } void test_icd_stub_log(const char *format, ...) { va_list args; va_start(args, format); vfprintf(stub_log_file, format, args); va_end(args); } static char *test_icd_get_log(const char *filename) { struct stat statbuf; FILE *fp; char *source = NULL; fp = fopen(filename, "rb"); log_freeenv(filename); if (fp) { size_t fsize = 0; stat(filename, &statbuf); fsize = statbuf.st_size; source = (char *)malloc(fsize+1); // +1 for NULL terminator if (source) { if (fsize) { if (fread(source, fsize, 1, fp) != 1) { free(source); source = NULL; } else { source[fsize] = '\0'; } } else { // Don't fail when fsize = 0, just return empty string source[fsize] = '\0'; } } fclose(fp); } return source; } char *test_icd_get_app_log(void) { return test_icd_get_log(test_icd_get_app_log_file_name()); } char *test_icd_get_stub_log(void) { return test_icd_get_log(test_icd_get_stub_log_file_name()); } OpenCL-ICD-Loader-2025.07.22/test/pkgconfig/000077500000000000000000000000001503776305700177775ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/pkgconfig/bare/000077500000000000000000000000001503776305700207105ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/pkgconfig/bare/CMakeLists.txt000066400000000000000000000014671503776305700234600ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.16) project(PkgConfigTest LANGUAGES C ) find_package(OpenCLHeaders REQUIRED CONFIG ) find_package(OpenCLICDLoader REQUIRED CONFIG ) add_executable(${PROJECT_NAME} ../pkgconfig.c ) target_link_libraries(${PROJECT_NAME} PRIVATE OpenCL::Headers OpenCL::OpenCL ) target_compile_definitions(${PROJECT_NAME} PRIVATE CL_TARGET_OPENCL_VERSION=120 ) include(CTest) add_test( NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} ) if(DEFINED DRIVER_STUB_PATH) file(TO_CMAKE_PATH "${DRIVER_STUB_PATH}" DRIVER_STUB_PATH_CMAKE) string(REGEX MATCH ".*/" DRIVER_STUB_DIR "${DRIVER_STUB_PATH_CMAKE}") set_tests_properties(${PROJECT_NAME} PROPERTIES ENVIRONMENT "OCL_ICD_FILENAMES=${DRIVER_STUB_PATH}" WORKING_DIRECTORY "${DRIVER_STUB_DIR}" ) endif() OpenCL-ICD-Loader-2025.07.22/test/pkgconfig/pkgconfig.c000066400000000000000000000036221503776305700221150ustar00rootroot00000000000000#ifdef __APPLE__ //Mac OSX has a different name for the header file #include #else #include #endif #include // printf #include // malloc #include // UINTMAX_MAX #include // strcmp void checkErr(cl_int err, const char * name) { if (err != CL_SUCCESS) { printf("ERROR: %s (%i)\n", name, err); exit( err ); } } int main(void) { cl_int CL_err = CL_SUCCESS; cl_uint numPlatforms = 0; cl_int stub_platform_found = CL_FALSE; CL_err = clGetPlatformIDs(0, NULL, &numPlatforms); checkErr(CL_err, "clGetPlatformIDs(numPlatforms)"); if (numPlatforms == 0) { printf("No OpenCL platform detected.\n"); exit( -1 ); } printf("Found %u platform(s)\n\n", numPlatforms); fflush(NULL); cl_platform_id* platforms = (cl_platform_id*)malloc(numPlatforms * sizeof(cl_platform_id)); CL_err = clGetPlatformIDs(numPlatforms, platforms, NULL); checkErr(CL_err, "clGetPlatformIDs(platforms)"); for (cl_uint i = 0; i < numPlatforms; ++i) { size_t vendor_length; CL_err = clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, 0, NULL, &vendor_length); checkErr(CL_err, "clGetPlatformInfo(CL_PLATFORM_VENDOR, NULL, &vendor_length)"); char* platform_name = (char*)malloc(vendor_length * sizeof(char)); CL_err = clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, vendor_length, platform_name, NULL); checkErr(CL_err, "clGetPlatformInfo(CL_PLATFORM_VENDOR, vendor_length, platform_name)"); printf("%s\n", platform_name); if (strcmp(platform_name, "stubvendorxxx") == 0) { stub_platform_found = CL_TRUE; } fflush(NULL); free(platform_name); } if (!stub_platform_found) { printf("Did not locate stub platform\n"); return -1; } return 0; } OpenCL-ICD-Loader-2025.07.22/test/pkgconfig/pkgconfig/000077500000000000000000000000001503776305700217465ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/pkgconfig/pkgconfig/CMakeLists.txt000066400000000000000000000022151503776305700245060ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.16) find_package(PkgConfig REQUIRED) project(PkgConfigTest LANGUAGES C ) pkg_check_modules(OPENCL REQUIRED OpenCL) if(CMAKE_VERSION VERSION_LESS 3.12) link_directories("${OPENCL_LIBRARY_DIRS}") endif() add_executable(${PROJECT_NAME} ../pkgconfig.c ) target_include_directories(${PROJECT_NAME} PRIVATE ${OPENCL_INCLUDE_DIRS} ) if(CMAKE_VERSION VERSION_LESS 3.12) target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENCL_LIBRARIES} ) else() target_link_libraries(${PROJECT_NAME} PRIVATE ${OPENCL_LINK_LIBRARIES} ) endif() target_compile_options(${PROJECT_NAME} PRIVATE ${OPENCL_CFLAGS_OTHER} ) target_compile_definitions(${PROJECT_NAME} PRIVATE CL_TARGET_OPENCL_VERSION=120 ) include(CTest) add_test( NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} ) if(DEFINED DRIVER_STUB_PATH) file(TO_CMAKE_PATH "${DRIVER_STUB_PATH}" DRIVER_STUB_PATH_CMAKE) string(REGEX MATCH ".*/" DRIVER_STUB_DIR "${DRIVER_STUB_PATH_CMAKE}") set_tests_properties(${PROJECT_NAME} PROPERTIES ENVIRONMENT "OCL_ICD_FILENAMES=${DRIVER_STUB_PATH}" WORKING_DIRECTORY "${DRIVER_STUB_DIR}" ) endif() OpenCL-ICD-Loader-2025.07.22/test/pkgconfig/sdk/000077500000000000000000000000001503776305700205605ustar00rootroot00000000000000OpenCL-ICD-Loader-2025.07.22/test/pkgconfig/sdk/CMakeLists.txt000066400000000000000000000014411503776305700233200ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.16) project(PkgConfigTest LANGUAGES C ) find_package(OpenCL REQUIRED CONFIG COMPONENTS Headers OpenCL ) add_executable(${PROJECT_NAME} ../pkgconfig.c ) target_link_libraries(${PROJECT_NAME} PRIVATE OpenCL::Headers OpenCL::OpenCL ) target_compile_definitions(${PROJECT_NAME} PRIVATE CL_TARGET_OPENCL_VERSION=120 ) include(CTest) add_test( NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} ) if(DEFINED DRIVER_STUB_PATH) file(TO_CMAKE_PATH "${DRIVER_STUB_PATH}" DRIVER_STUB_PATH_CMAKE) string(REGEX MATCH ".*/" DRIVER_STUB_DIR "${DRIVER_STUB_PATH_CMAKE}") set_tests_properties(${PROJECT_NAME} PROPERTIES ENVIRONMENT "OCL_ICD_FILENAMES=${DRIVER_STUB_PATH}" WORKING_DIRECTORY "${DRIVER_STUB_DIR}" ) endif()