[clang] [llvm] [SYCL] Normalize the device image target triple (PR #231446)

Kseniya Tikhomirova via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 15 03:38:42 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:

Ok, I see your idea. Reworked the impl to normalize triple to 3-parts form and added triple search (only 1st part is needed) on libsycl side.
Note: intel/llvm don't have and don't use other parts of triple but the "architecture". So I am not sure how we should use these data "spirv64(useful)-**amdgpu(?)-amdhsa**(?)" in runtime.

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


More information about the cfe-commits mailing list