1
LLVM IR is intermediate representation (byte code) between compilation and code generation.
2
Unforuntelly it doesn't directly support CUDA/OpenCL semantics and there are several incompatible
4
- LibCLC is OpenCL 1.1 frontend for LLVM. It compiles OpenCL code to LLVM IR and uses LLVM IR metadata
5
to represent GPU-specific constructs and provides a number of base functions as intrinsics. It also includes
6
a number of backends (i.e. NVPTX64) to generate NVIDIA (PTX) and AMD intermediate representation.
7
Disadvantage: Only OpenCL 1.1 at the moment and probably slower than nvcc as NVIDIA optimizer is not a part
9
- POCL is OpenCL 1.2 (with elements of 2.0) which supports native CUDA backend.
10
Disadvantage: Textures and atomics are not implemented yet. Seems some performance issues...
11
- NVVM IR is NVIDIA subset of LLVM IR which also uses LLVM IR metadata to represent GPU constructs. However,
12
it is not compatible with LibCLC and there is no OpenCL frontend available. Samples for Python and Haskell
13
are available officially.
14
https://github.com/nvidia-compiler-sdk
15
The sources are from 2014 and it seems not much happened since (at least in open-source world). Also, neither
16
nvcc nor othr NVIDIA tools output NVVM IR representation. There is unofficial hacks to getaccess though
17
(unclear if still working):
18
https://github.com/apc-llc/nvcc-llvm-ir
19
Disadvantage: The latest version of LLVM often is not supported (LLVM5 only while LLVM7 is already out). OpenCL
20
frontend is not available.
21
- SPIR-V is Khronos intermediate language wich modifies LLVM IR to include primitives required from rendering (Vulkan)
22
and GPU computing. It is part of OpenCL 2.1. NVIDIA also provides beta support for their Vulkan implementation, but no
23
support for CUDA/OpenCL yet. More details:
24
https://streamhpc.com/blog/2015-05-21/8-reasons-why-spir-v-makes-a-big-difference/
25
Disadvantage: Only OpenCL-2.1 compatible frameworks (Intel), no NVIDIA support yet. AMD is currently on OpenCL-2.0 which
26
uses SPIR 2.0 which is not compatible with SPIR-V. No SPIR-V to NVVM-IR converter either.
29
- Khronos plans to merge OpenCL in Vulkan specification later. But would NVIDIA care?
30
- There is WebVK prototype. But it seems there is agreement that Vulkan will not replace WebGL
31
https://floooh.github.io/2016/08/13/webgl-next.html
34
Non-LLVM based solutions:
35
- HIP is a part of new AMD ROCm stack. HIP is closely follows CUDA Run-time API. It provides tools to automatically
36
convert CUDA code to HIP. And it provides backends to execute HIP code using CUDA framework or AMD HCC.
37
https://streamhpc.com/blog/2016-04-05/comparing-syntax-cuda-opencl-hip/
38
https://rocm-documentation.readthedocs.io/en/latest/ROCm_API_References/HIP-API.html#hip-api
39
* It seems bounds are supported.
40
* It seems ROCm OpenCL uses standard pointers as cl_mem. This is not hte case on CUDA platform. I.e. we probably
41
can use HIP to integrate CUDA library to UFO on AMD platform, but in no way on NVIDIA.
42
Disadvantage: We can't easily migrate OpenCL applications. It also doesn't seem we can provide inter-operability
43
between OpenCL and CUDA/HIP on the NVIDIA platform. Still probably it is the best available solution to target
44
NVIDIA and AMD GPUs and general-purpose CPUs.
45
- SNUCL. Porvides two-way OpenCL/CUDA conversion by providing substitute libraries and recompiling kernels.
46
Disadvantages: Last commit 2 years ago and relies on modified LLVM source tree.
49
- AnyDSL: With backends to LLVM, CUDA, OpenCL.
54
- How it is complicated to implement OpenCL 'image' support in POCL? Can we get CUDA pointers out? And vice-versa construct
55
OpenCL pointers from CUDA. GPUDirect integration?
b'\\ No newline at end of file'