================
@@ -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());
----------------
bader wrote:
> what do you mean under "normalized" triple?
Based on the comment you add, the problem you are trying to solve is that some
parts of the `Result.TargetTriple` can be omitted. `clang` sets "unknown" value
to omitted parts of the triple. By "normalized" triple I mean explicitly all
parts of the triple even if they are omitted.
> How is it different from initial impl when we write
> "spirv64-unknown-unknown"?
I don't know what is "initial impl", but according to your comment we don't
write "spirv64-unknown-unknown". We write either "spirv64-unknown-unknown" or
"spirv64". Could you clarify your question, please?
> 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.
Compiler can produce for different target triples. I think you are talking
about narrow case of SYCL implementation for Level Zero backend and specific
Intel GPU. Using full triple provides more flexibility with supporting more
SYCL runtime backends and vendors (e.g. SPIR-V for AMDGPU uses
"spirv64-amdgpu-amdhsa" target triple).
https://github.com/llvm/llvm-project/pull/231446
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits