[llvm-branch-commits] [clang] [llvm] [OffloadBundler] Rework the ctor of `OffloadTargetInfo` to support AMDGPU's generic target (PR #122629)

Yaxun Liu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 14 10:05:54 PST 2025


yxsamliu wrote:

> First of all, I don't think it can fix the issue in a robust way. Second, `generic` is already a valid target/cpu/offload target.
> 
> Unless we do something like, if the last part is `generic`, we keep looking forward until we can construct a valid target. That has no difference than doing pattern matching, which is back to my previous point about AMD special sauce.
> 
> If we assert that the offload bundler is an AMD only thing (which TBH really looks like so), I'm fine with adding a bunch of more special sauce here.

offload-bundler is not an AMD only thing. At least HIPSPRV toolchain uses it, which is Intel GPU.

Still, I think it is possible to make it generic with minor assumption. Let's say you are now about to parsing the final part of the target ID string which may be either "env-cpu" or "cpu" without env. clang has a function getCanonicalProcessorName() which can check whether a string is a valid cpu name. Just pass the remaining string to it. If true, that means the remaining is a cpu, without env string. Otherwise, assuming there is an env string that contains no "-" and split it.

https://github.com/llvm/llvm-project/pull/122629


More information about the llvm-branch-commits mailing list