[clang] [llvm] [Clang][SYCL][CUDA] Add --[no-]offload-embed-virtual-arch (PR #242407)
Yury Plyakhin via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 4 09:00:55 PST 2026
================
@@ -1097,6 +1106,34 @@ DerivedArgList getLinkerArgs(ArrayRef<OffloadFile> Input,
DAL.AddJoinedArg(nullptr, Tbl.getOption(OPT_code_EQ),
Args.MakeArgString(Device));
+ // Pass --no-embed-virtual-arch only if there is at least one image other
+ // than generic ones (arch=generic, e.g. archive members), and all of them
+ // ask to drop the virtual architecture code. A missing "embed-virtual-arch"
+ // entry means the default for the image's offload kind.
+ size_t NumImages = 0;
+ size_t NumAskingToDrop = 0;
+ for (const OffloadFile &File : Input) {
+ const OffloadBinary &Image = *File.getBinary();
+ if (Image.getArch() == "generic")
+ continue;
+ ++NumImages;
+ StringRef Embed = Image.getString("embed-virtual-arch");
+ if (Embed.empty() ? !embedsVirtualArchByDefault(Image.getOffloadKind())
----------------
YuriPlyakhin wrote:
+1, I was also confused initially, but was hesitant to post, thought, maybe I'm alone :)
https://github.com/llvm/llvm-project/pull/242407
More information about the cfe-commits
mailing list