[all-commits] [llvm/llvm-project] 9acb53: [clang][Driver] Add HIPAMD Driver support for AMDG...

Alex Voicu via All-commits all-commits at lists.llvm.org
Tue Jun 25 04:19:49 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9acb533c38be833ec1d8daa06e127a9de8f0a5ef
      https://github.com/llvm/llvm-project/commit/9acb533c38be833ec1d8daa06e127a9de8f0a5ef
  Author: Alex Voicu <alexandru.voicu at amd.com>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M clang/include/clang/Basic/Cuda.h
    M clang/lib/Basic/Cuda.cpp
    M clang/lib/Basic/Targets/NVPTX.cpp
    M clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/HIPAMD.cpp
    M clang/lib/Driver/ToolChains/HIPAMD.h
    M clang/test/Driver/cuda-arch-translation.cu
    M clang/test/Frontend/embed-bitcode.ll
    M clang/test/Misc/target-invalid-cpu-note.c
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

  Log Message:
  -----------
  [clang][Driver] Add HIPAMD Driver support for AMDGCN flavoured SPIR-V (#95061)

This patch augments the HIPAMD driver to allow it to target AMDGCN
flavoured SPIR-V compilation. It's mostly straightforward, as we re-use
some of the existing SPIRV infra, however there are a few notable
additions:

- we introduce an `amdgcnspirv` offload arch, rather than relying on
using `generic` (this is already fairly overloaded) or simply using
`spirv` or `spirv64` (we'll want to use these to denote unflavoured
SPIRV, once we bring up that capability)
- initially it is won't be possible to mix-in SPIR-V and concrete AMDGPU
targets, as it would require some relatively intrusive surgery in the
HIPAMD Toolchain and the Driver to deal with two triples
(`spirv64-amd-amdhsa` and `amdgcn-amd-amdhsa`, respectively)
- in order to retain user provided compiler flags and have them
available at JIT time, we rely on embedding the command line via
`-fembed-bitcode=marker`, which the bitcode writer had previously not
implemented for SPIRV; we only allow it conditionally for AMDGCN
flavoured SPIRV, and it is handled correctly by the Translator (it ends
up as a string literal)

Once the SPIRV BE is no longer experimental we'll switch to using that
rather than the translator. There's some additional work that'll come
via a separate PR around correctly piping through AMDGCN's
implementation of `printf`, for now we merely handle its flags
correctly.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list