[all-commits] [llvm/llvm-project] dd5d65: [HIP][Clang][CodeGen] Add CodeGen support for `hip...

Alex Voicu via All-commits all-commits at lists.llvm.org
Tue Oct 17 03:41:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dd5d65adb6413122a5ba1ed04c5c2c0b4951b76c
      https://github.com/llvm/llvm-project/commit/dd5d65adb6413122a5ba1ed04c5c2c0b4951b76c
  Author: Alex Voicu <alexandru.voicu at amd.com>
  Date:   2023-10-17 (Tue, 17 Oct 2023)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CGStmt.cpp
    M clang/lib/CodeGen/CMakeLists.txt
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    A clang/test/CodeGenHipStdPar/unannotated-functions-get-emitted.cpp
    A clang/test/CodeGenHipStdPar/unsupported-ASM.cpp
    A clang/test/CodeGenHipStdPar/unsupported-builtins.cpp

  Log Message:
  -----------
  [HIP][Clang][CodeGen] Add CodeGen support for `hipstdpar`

This patch adds the CodeGen changes needed for enabling HIP parallel algorithm offload on AMDGPU targets. This change relaxes restrictions on what gets emitted on the device path, when compiling in `hipstdpar` mode:

1. Unless a function is explicitly marked `__host__`, it will get emitted, whereas before only `__device__` and `__global__` functions would be emitted;
2. Unsupported builtins are ignored as opposed to being marked as an error, as the decision on their validity is deferred to the `hipstdpar` specific code selection pass;
3. We add a `hipstdpar` specific pass to the opt pipeline, independent of optimisation level:
    - When compiling for the host, iff the user requested it via the `--hipstdpar-interpose-alloc` flag, we add a pass which replaces canonical allocation / deallocation functions with accelerator aware equivalents.

A test to validate that unannotated functions get correctly emitted is added as well.

Reviewed by: yaxunl, efriedma

Differential Revision: https://reviews.llvm.org/D155850




More information about the All-commits mailing list