[PATCH] D80750: llvm-link: Add module flag behavior MergeTargetId

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 12:05:41 PDT 2020


yaxunl created this revision.
yaxunl added reviewers: scott.linder, kzhuravl.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Target Id is a module flag metadata needed by HIP language.

Its format is a list of strings delimited by ':', e.g. amdgcn-amd-amdhsa--gfx908:xnack+:sramecc-. The first string is an id string which could be
triple-cpu but may not be necessarily so. The other strings are called feature string which may or may not be target features.
Except for the id string, all feature strings end with '+' or '-'.

A new module flag behavior is needed for merging module flags in this format.

The rule is:

1. the id string and existing features of the destination target id are kept

2. If a feature is in both source and destination target id, they must have the same sign, otherwise it results in a conflict module flag error.

3. If a feature is in source target id but not in destination target id

  a. if the id string of destination and source target id match, the feature is added to the destination target id

  b. otherwise it results in conflict module flag error


https://reviews.llvm.org/D80750

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/Module.h
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Linker/IRMover.cpp
  llvm/test/Linker/Inputs/module-flags-target-id-src-default.ll
  llvm/test/Linker/Inputs/module-flags-target-id-src-diff-cpu.ll
  llvm/test/Linker/Inputs/module-flags-target-id-src-invalid.ll
  llvm/test/Linker/Inputs/module-flags-target-id-src-xnack-off.ll
  llvm/test/Linker/Inputs/module-flags-target-id-src-xnack-on-sramecc-off.ll
  llvm/test/Linker/module-flags-target-id-dst-default.ll
  llvm/test/Linker/module-flags-target-id-dst-xnack-on-sramecc-off.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80750.266962.patch
Type: text/x-patch
Size: 11747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200528/f9440d4e/attachment.bin>


More information about the llvm-commits mailing list