llvm-project/clang/lib/Basic
Yaxun (Sam) Liu a6786cdd57 [HIPSPV][3/4] Enable SPIR-V emission for HIP
This patch enables SPIR-V binary emission for HIP device code via the
HIPSPV tool chain.

‘--offload’ option, which is envisioned in [1], is added for specifying
offload targets. This option is used to override default device target
(amdgcn-amd-amdhsa) for HIP compilation for emitting device code as
SPIR-V binary. The option is handled in getHIPOffloadTargetTriple().

getOffloadingDeviceToolChain() function (based on the design in the
SYCL repository) is added to select HIPSPVToolChain when HIP offload
target is ‘spirv64’.

The HIPActionBuilder is modified to produce LLVM IR at the backend
phase. HIPSPV tool chain expects to receive HIP device code as LLVM
IR so it can run external LLVM passes over them. HIPSPV TC is also
responsible for emitting the SPIR-V binary.

A Cuda GPU architecture ‘generic’ is added. The name is picked from
the LLVM SPIR-V Backend. In the HIPSPV code path the architecture
name is inserted to the bundle entry ID as target ID. Target ID is
expected to be always present so a component in the target triple
is not mistaken as target ID.

Tests are added for checking the HIPSPV tool chain.

[1]: https://lists.llvm.org/pipermail/cfe-dev/2020-December/067362.html

Patch by: Henry Linjamäki

Reviewed by: Yaxun Liu, Artem Belevich, Alexey Bader

Differential Revision: https://reviews.llvm.org/D110622
2021-12-20 10:45:09 -05:00
..
Targets [HIPSPV][3/4] Enable SPIR-V emission for HIP 2021-12-20 10:45:09 -05:00
Attributes.cpp [OpenMP] Support OpenMP 5.1 attributes 2021-07-12 06:51:19 -04:00
Builtins.cpp [OpenCL] Defines helper function for kernel language compatible OpenCL version 2021-08-31 10:08:38 +01:00
CLWarnings.cpp Reland "[clang-cl] Accept `#pragma warning(disable : N)` for some N" 2021-09-30 15:03:23 -04:00
CMakeLists.txt Reland "[clang-cl] Accept `#pragma warning(disable : N)` for some N" 2021-09-30 15:03:23 -04:00
CharInfo.cpp
CodeGenOptions.cpp [NFC] Remove duplicate isNoBuiltinFunc method 2021-03-10 09:18:55 +01:00
Cuda.cpp [HIPSPV][3/4] Enable SPIR-V emission for HIP 2021-12-20 10:45:09 -05:00
DarwinSDKInfo.cpp [clang][driver][darwin] Add driver support for Mac Catalyst 2021-07-22 10:20:19 -07:00
Diagnostic.cpp [clang] Allow printing 64 bit ints in diagnostics 2021-10-06 09:53:47 -07:00
DiagnosticIDs.cpp [clang][NFC] Inclusive terms: replace some uses of sanity in clang 2021-11-19 14:58:35 -05:00
DiagnosticOptions.cpp
ExpressionTraits.cpp [clang][NFC] Generate the {Type,ArrayType,UnaryExprOrType,Expression}Traits... 2020-06-11 14:35:52 +01:00
FileEntry.cpp Basic: Add native support for stdin to SourceManager and FileManager 2020-12-23 15:18:50 -08:00
FileManager.cpp Fix a use-after-scope from 9902362701 2021-10-29 16:25:13 -07:00
FileSystemStatCache.cpp
IdentifierTable.cpp Correct the 'KEYALL' mask. 2021-05-27 07:20:32 -07:00
LangOptions.cpp [OpenCL] Defines helper function for kernel language compatible OpenCL version 2021-08-31 10:08:38 +01:00
LangStandards.cpp
Module.cpp [Basic] Use llvm::is_contained (NFC) 2021-10-10 08:52:14 -07:00
NoSanitizeList.cpp [clang][patch] Inclusive language, modify filename SanitizerBlacklist.h to NoSanitizeList.h 2021-02-22 15:11:37 -05:00
ObjCRuntime.cpp
OpenCLOptions.cpp [OpenCL] Add support of __opencl_c_pipes feature macro. 2021-07-30 18:10:25 +03:00
OpenMPKinds.cpp [OpenMP] Add parsing/sema/serialization for 'bind' clause. 2021-11-04 14:40:30 -07:00
OperatorPrecedence.cpp
ProfileList.cpp [clang] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine) 2021-10-06 11:43:19 +01:00
SanitizerSpecialCaseList.cpp
Sanitizers.cpp [clang-cl][sanitizer] Add -fsanitize-address-use-after-return to clang. 2021-06-11 12:07:35 -07:00
SourceLocation.cpp [NFC][clang] Return underlying strings directly instead of OS.str() 2021-12-09 16:05:46 -08:00
SourceManager.cpp [clang][NFC] Inclusive terms: replace some uses of sanity in clang 2021-11-19 14:58:35 -05:00
Stack.cpp
TargetID.cpp [clang][AMDGPU] rename sram-ecc as sramecc 2020-12-07 18:05:47 -05:00
TargetInfo.cpp [X86][clang] Disable long double type for -mno-x87 option 2021-11-03 12:08:39 +03:00
Targets.cpp [SPIR-V] Add SPIR-V triple and clang target info. 2021-11-08 13:34:10 +00:00
Targets.h
TokenKinds.cpp
TypeTraits.cpp [clang][NFC] Generate the {Type,ArrayType,UnaryExprOrType,Expression}Traits... 2020-06-11 14:35:52 +01:00
Version.cpp [NFC][clang] Return underlying strings directly instead of OS.str() 2021-12-09 16:05:46 -08:00
Warnings.cpp [Sema] Special case -Werror-implicit-function-declaration and reject other -Werror- 2020-11-05 10:25:30 -08:00
XRayInstr.cpp [clang][cli] Generate and round-trip CodeGen options 2021-02-09 11:43:38 +01:00
XRayLists.cpp Avoid including FileManager.h from SourceManager.h 2020-03-11 13:53:12 -07:00