[clang] [llvm] [SYCL] Shorten triple form in device binary. (PR #231446)
Kseniya Tikhomirova via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 13 08:54:38 PDT 2026
================
@@ -1043,8 +1043,12 @@ static Error runSYCLLink(ArrayRef<std::unique_ptr<MemoryBuffer>> Inputs,
OffloadingImage TheImage{};
TheImage.TheImageKind = IsAOTCompileNeeded ? IMG_Object : IMG_SPIRV;
TheImage.TheOffloadKind = OFK_SYCL;
+ // Pack the short form of the triple. The runtime only needs to know which
+ // binary format the image holds, and the architecture is the single
+ // canonical spelling of it: inputs may spell the same target as 'spirv64'
+ // or 'spirv64-unknown-unknown'.
TheImage.StringData["triple"] =
- Args.MakeArgString(Result.TargetTriple.str());
+ Args.MakeArgString(Result.TargetTriple.getArchName());
----------------
KseniyaTikhomirova wrote:
I fill I am missing something here. @bader, what do you mean under "normalized" triple? How is it different from initial impl when we write "spirv64-unknown-unknown"? From what I see in class Triple, normalize(...) has forms:
```
/// Canonical form
enum class CanonicalForm {
ANY = 0,
THREE_IDENT = 3, // ARCHITECTURE-VENDOR-OPERATING_SYSTEM
FOUR_IDENT = 4, // ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
FIVE_IDENT = 5, // ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT-FORMAT
};
```
all of them have more data than I need.
about getArch() we talked with @YuriPlyakhin - it is kind of reserved for exact device arch (AOT) binary is built for. So it seems to be not a good place to pass target here.
https://github.com/llvm/llvm-project/pull/231446
More information about the cfe-commits
mailing list