-
Notifications
You must be signed in to change notification settings - Fork 80
Frontends
doe300 edited this page Feb 14, 2021
·
6 revisions
Possible compilation work-flows:
| Source language | compilation work-flows | comparison | comments |
|---|---|---|---|
| SPIR-V (binary/text) | SPIR-V front-end | fast | requires SPRV-LLVM Translator or SPIRV-LLVM |
| LLVM IR binary | LLVM library front-endllvm-spirv + SPIR-V front-end |
fast fast |
least error-prone only for SPIRV-LLVM |
| LLVM IR text |
llvm-as + either front-end |
not implemented | |
| OpenCL C |
clang (with PCH) + LLVM library front-end clang (with PCH) + llvm-spirv + SPIR-V front-endclang + llvm-link (vc4cl std-lib module) + LLVM library front-end |
default fast fast |
slow on RPi with default clang fast on RPi with default clang |
Compilation work-flows for version of clang:
"Default" clang
- SPIR-V: not supported
- LLVM IR: LLVM library front-end
- OpenCL C:
clang+llvm-link+ LLVM front-end
SPIRV-LLVM
- SPIR-V: SPIR-V front-end
- LLVM IR: LLVM library front-end or
llvm-spirv+ SPIR-V front-end - OpenCL C:
clang(with PCH) +llvm-spirv+ SPIR-V front-end orclang(with PCH) + LLVM library front-end
| Frontend | SPIR-V reader | LLVM library |
|---|---|---|
| Input formats | SPIR-V text/bin | LLVM IR text/bin |
| Speed | fast | faster |
| Supported LLVMs | SPIRV | Standard / SPIRV |
| Runtime deps | SPIRV-LLVM Translator / SPIRV-LLVM CLang | any CLang, matching LLVM library |
| Development deps | SPIRV-Headers (provided) | LLVM headers |
| Configuration | always enabled |
LLVMLIB_FRONTEND set, LLVM_CONFIG_PATH found |
| Supports linking | yes | yes |
- Requires additional pre-compilation step to convert LLVM IR (generated from OpenCL C source-code) to SPIR-V
- Supports linking of SPIR-V modules via the SPIRV-Tools project (either in-process by setting the
SPIRV_FRONTENDCMake flag or by using thespirv-linkexecutable)
- Uses the LLVM library to parse the LLVM IR module
- Only supports one LLVM version at a time, depending on against which library the front-end is linked against
- Supports linking of LLVM IR modules via
llvm-linktool provided by LLVM - Supports linking against static and shared LLVM libraries. For static linkage, the LLVM library does not need to be available at run-time
- The location the LLVM library and headers as well as the type of library (shared, static) to include is automatically obtained from the
llvm-configtool found atLLVM_CONFIG_PATH. IfLLVM_CONFIG_PATHis not set, the CMakefind_packagemechanism is used to retrieve the LLVM configuration.