GPU Programming: Intel

By Wolfgang Keller
Draft
Originally written 2021-04-04
Last modified 2023-02-10

Table of contents

Download and install Intel® SDK For OpenCL™ Applications

Websites:

Build Intercept Layer for OpenCL™ Applications

Install Visual Studio 2019 (including MFC) and CMake.

Intercept Layer for OpenCL™ Applications (opencl-intercept-layer) is available at intel/opencl-intercept-layer: Intercept Layer for Debugging and Analyzing OpenCL Applications [visited 2021-04-04T11:32:13Z]. Download the most recent release and extract it.

Create a folder _bin64 inside the extracted opencl-intercept-layer. In the command prompt, go into this folder, and type

cmake.exe -G "Visual Studio 14 2015 Win64" ..

Open the generated CLIntercept.sln Visual Studio project and build it. You are very likely in particular interested in the build target INSTALL.

GEN Assembly

Kernel ISA Binary Disassembler

For GPU: opencl-intercept-layer/kernel_isa_gpu.md at main · intel/opencl-intercept-layer [visited 2023-02-10T00:53:02Z]

Remark: for CPU, see opencl-intercept-layer/kernel_isa_cpu.md at main · intel/opencl-intercept-layer [visited 2023-02-10T00:54:04Z]

You need Ubuntu 20.04 (the most recent LTS release 22.04 won’t do it as of 2023-02-09!). In the Windows shell (command promt or Windows PowerShell), type

wsl --list --online

Find Ubuntu-20.04 listed. Thus type in the Windows shell

wsl --install -d Ubuntu-20.04

It might be necessary to reboot Windows.

After starting Ubuntu (on WSL2) for the first time, it is a good practice to do apply the updates via

sudo apt-get update
sudo apt-get upgrade

“Reboot” Ubuntu afterwards: in the Windows shell, type

wsl -t Ubuntu-20.04

Now for building IGA (the Intel GPU ISA disassembler that we will use), which is part of the Intel Graphics Compiler (IGC): the required packages for IGA are listed under intel-graphics-compiler/build_ubuntu.md at master · intel/intel-graphics-compiler [visited 2023-02-10T01:19:17Z]. Note that for building IGA, we don't need all of them.

Now we can build IGA:

git clone https://github.com/intel/intel-graphics-compiler.git
cd intel-graphics-compiler
git checkout releases/igc-1.0.13230

Note that igc-1.0.13230 is the most recent stable version as of 2023-02-10. You might prefer a more recent version as soon as one gets available.

We have to set environment variables to use clang 11 as C and C++ compiler:

export CC=/usr/bin/clang-11
export CXX=/usr/bin/clang++-11

(see Switching between GCC and Clang/LLVM using CMake - Stack Overflow [published 2011-08-11T19:57; last modified 2022-12-18T09:91; visited 2023-02-10T01:27:58Z]).

Now for building IGA:

cd visa/iga
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release