[HIPSPV][2/4] Add HIPSPV tool chain
authorHenry Linjamäki <henry.linjamaki@parmance.com>
Tue, 14 Dec 2021 18:08:57 +0000 (10:08 -0800)
committerArtem Belevich <tra@google.com>
Tue, 14 Dec 2021 18:22:38 +0000 (10:22 -0800)
commit4e94cba5b4e431794026085b89a34112b2d9ac0d
treeb972d4fe31150bdcdf64db3a63de5f38aa90e9d7
parent04192422c4e3b730c580498b8e948088cb15580b
[HIPSPV][2/4] Add HIPSPV tool chain

This patch adds a new tool chain, HIPSPVToolChain, for emitting HIP
device code as SPIR-V binary. The SPIR-V binary is emitted by using an
external tool, SPIRV-LLVM-Translator, temporarily. We intend to switch
the translator to the llc tool when the SPIR-V backend lands on LLVM
and proves to work well on HIP implementations which consume SPIR-V.

Before the SPIR-V emission the tool chain loads an optional external
pass plugin, either automatically from a HIP installation or from a
path pointed by --hipspv-pass-plugin, and runs passes that are meant
to expand/lower HIP features that do not have direct counterpart in
SPIR-V (e.g. dynamic shared memory).

Code emission for SPIR-V will be enabled and HIPSPVToolChain tests
will be added in the follow up patch part 3.

Other changes: New option ‘-nohipwrapperinc’ is added to exclude HIP
include wrappers. The reason for the addition is that they cause
compile errors when compiling HIP sources for the host side for HIPCL
and HIPLZ implementations. New option is added to avoid this issue.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D110618
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Driver/Options.td
clang/lib/Driver/CMakeLists.txt
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/lib/Driver/ToolChains/HIPSPV.cpp [new file with mode: 0644]
clang/lib/Driver/ToolChains/HIPSPV.h [new file with mode: 0644]