[PATCH] D134546: [clang-offload-bundler] extracting compatible bundle entry

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 23 09:09:39 PDT 2022


yaxunl created this revision.
yaxunl added reviewers: tra, saiislam, lamb-j.
Herald added a project: All.
yaxunl requested review of this revision.
Herald added subscribers: sstefan1, MaskRay.
Herald added a reviewer: jdoerfert.

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.


https://reviews.llvm.org/D134546

Files:
  clang/include/clang/Basic/TargetID.h
  clang/include/clang/Driver/OffloadBundler.h
  clang/lib/Basic/TargetID.cpp
  clang/lib/Driver/OffloadBundler.cpp
  clang/test/Driver/clang-offload-bundler.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134546.462482.patch
Type: text/x-patch
Size: 11212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220923/8a538295/attachment.bin>


More information about the cfe-commits mailing list