[all-commits] [llvm/llvm-project] 844b84: [clang-offload-bundler] extracting compatible bund...

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Wed Oct 5 16:45:08 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 844b84af20c71482093995b1d64abc190eb5a5f9
      https://github.com/llvm/llvm-project/commit/844b84af20c71482093995b1d64abc190eb5a5f9
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2022-10-05 (Wed, 05 Oct 2022)

  Changed paths:
    M clang/include/clang/Basic/TargetID.h
    M clang/include/clang/Driver/OffloadBundler.h
    M clang/lib/Basic/TargetID.cpp
    M clang/lib/Driver/OffloadBundler.cpp
    M clang/test/Driver/clang-offload-bundler.c
    M clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp

  Log Message:
  -----------
  [clang-offload-bundler] extracting compatible bundle entry

In HIP a library is usually compiled with default target ID e.g. gfx906 so that
it can be used in all GPU configurations. The bitcode is saved in bundled
bitcode with gfx906 in entry ID.

In runtime compilation, a HIP program is compiled with a target ID matching
the GPU configuration, e.g. gfx906:xnack-. This program needs to link with
a library bundled bitcode with target ID gfx906.

For example:

  clang --offload-arch=gfx906 -o lib.o lib.hip
  clang --offload-arch=gfx906:xnack- program.hip lib.o

This common use case requires that clang-offlod-bundler to be able to extract
entry with compatible target ID, e.g. extracting an gfx906 entry when requesting
gfx906:xnack-.

Currently clang-offload-bundler only allow extracting entry with exact match
of target ID. This patch relaxes that so that it can extract entries with compatible
target ID.

Reviewed by: Artem Belevich, Saiyedul Islam

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




More information about the All-commits mailing list