[llvm] 32ab88d - [clang][SYCL] Set default device and host triples for SYCL device compilation (#172366)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 08:49:21 PDT 2026


Author: elizabethandrews
Date: 2026-05-13T11:49:15-04:00
New Revision: 32ab88d2bac60a2aebe649cc13fa74744a17ec1f

URL: https://github.com/llvm/llvm-project/commit/32ab88d2bac60a2aebe649cc13fa74744a17ec1f
DIFF: https://github.com/llvm/llvm-project/commit/32ab88d2bac60a2aebe649cc13fa74744a17ec1f.diff

LOG: [clang][SYCL] Set default device and host triples for SYCL device compilation  (#172366)

This PR checks whether the triple specified for SYCL device compilation
is supported. If the triple is not specified, assume a default of
spirv64-unknown-unknown.

While a driver invocation does set the default triple when invoked, this
PR is required to fix a crash for cc1 invocations when an invalid/no
triple is specified.

This PR also sets HostTriple from -aux-triple to inherit host type
properties during SYCL device compilation.

Fixes https://github.com/llvm/llvm-project/issues/167358

Added: 
    clang/test/Frontend/check-sycl-device-target.cpp
    clang/test/SemaSYCL/aux-triple.cpp

Modified: 
    clang/include/clang/Basic/DiagnosticSemaKinds.td
    clang/include/clang/Frontend/FrontendOptions.h
    clang/lib/Frontend/CompilerInstance.cpp
    clang/lib/Frontend/CompilerInvocation.cpp
    clang/test/AST/ByteCode/sycl.cpp
    clang/test/ASTSYCL/ast-dump-sycl-kernel-call-stmt.cpp
    clang/test/ASTSYCL/ast-dump-sycl-kernel-entry-point.cpp
    clang/test/CodeGenSYCL/address-space-mangling.cpp
    clang/test/SemaSYCL/float128.cpp
    clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp
    clang/test/SemaSYCL/sycl-kernel-entry-point-attr-device-odr-use.cpp
    clang/test/SemaSYCL/sycl-kernel-entry-point-attr-grammar.cpp
    clang/test/SemaSYCL/sycl-kernel-entry-point-attr-kernel-name.cpp
    clang/test/SemaSYCL/sycl-kernel-entry-point-attr-sfinae.cpp
    clang/test/SemaSYCL/sycl-kernel-entry-point-attr-this.cpp
    clang/test/SemaSYCL/sycl-kernel-launch-ms-compat.cpp
    clang/test/SemaSYCL/sycl-kernel-launch.cpp
    clang/test/SemaSYCL/unique-stable-name-multiple-target-crash.cpp
    clang/test/SemaSYCL/unique_stable_name.cpp
    llvm/include/llvm/TargetParser/Triple.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 5c225dc56ddd8..56df01d7ce06e 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -13436,6 +13436,8 @@ def warn_sycl_kernel_return_type : Warning<
 def err_sycl_special_type_num_init_method : Error<
   "types with 'sycl_special_class' attribute must have one and only one '__init' "
   "method defined">;
+def err_sycl_device_invalid_target : Error<
+  "%0 is not a supported SYCL device target">;
 
 // SYCL external attribute diagnostics
 def err_sycl_external_invalid_linkage : Error<

diff  --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h
index f7f51bc37c98d..2f75fba566dfb 100644
--- a/clang/include/clang/Frontend/FrontendOptions.h
+++ b/clang/include/clang/Frontend/FrontendOptions.h
@@ -513,7 +513,7 @@ class FrontendOptions {
   /// (in the format produced by -fdump-record-layouts).
   std::string OverrideRecordLayoutsFile;
 
-  /// Auxiliary triple for CUDA/HIP compilation.
+  /// Auxiliary triple for CUDA/HIP/SYCL compilation.
   std::string AuxTriple;
 
   /// Auxiliary target CPU for CUDA/HIP compilation.

diff  --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 91eda7392784f..0885b01f1a6bb 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -119,6 +119,12 @@ bool CompilerInstance::createTarget() {
   if (!hasTarget())
     return false;
 
+  if (getLangOpts().SYCLIsDevice && !getTarget().getTriple().isGPU()) {
+    getDiagnostics().Report(diag::err_sycl_device_invalid_target)
+        << getTarget().getTriple().str();
+    return false;
+  }
+
   // Check whether AuxTarget exists, if not, then create TargetInfo for the
   // other side of CUDA/OpenMP/SYCL compilation.
   if (!getAuxTarget() &&

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index c6e8644905964..60749104252af 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -5117,6 +5117,13 @@ bool CompilerInvocation::CreateFromArgsImpl(
   if (LangOpts.OpenMPIsTargetDevice)
     Res.getTargetOpts().HostTriple = Res.getFrontendOpts().AuxTriple;
 
+  // Set the default and host triples for SYCL device compilation.
+  if (LangOpts.SYCLIsDevice) {
+    if (!Args.hasArg(options::OPT_triple))
+      Res.getTargetOpts().Triple = "spirv64-unknown-unknown";
+    Res.getTargetOpts().HostTriple = Res.getFrontendOpts().AuxTriple;
+  }
+
   ParseCodeGenArgs(Res.getCodeGenOpts(), Args, DashX, Diags, T,
                    Res.getFrontendOpts().OutputFile, LangOpts);
 

diff  --git a/clang/test/AST/ByteCode/sycl.cpp b/clang/test/AST/ByteCode/sycl.cpp
index 5c922eca58091..dfd62508fb6a3 100644
--- a/clang/test/AST/ByteCode/sycl.cpp
+++ b/clang/test/AST/ByteCode/sycl.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 %s -std=c++17 -triple x86_64-linux-gnu -fsycl-is-device -verify=both,ref -fsyntax-only -Wno-unused
-// RUN: %clang_cc1 %s -std=c++17 -triple x86_64-linux-gnu -fsycl-is-device -verify=both,expected -fsyntax-only -Wno-unused -fexperimental-new-constant-interpreter
+// RUN: %clang_cc1 %s -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device -verify=both,ref -fsyntax-only -Wno-unused
+// RUN: %clang_cc1 %s -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device -verify=both,expected -fsyntax-only -Wno-unused -fexperimental-new-constant-interpreter
 
 // both-no-diagnostics
 

diff  --git a/clang/test/ASTSYCL/ast-dump-sycl-kernel-call-stmt.cpp b/clang/test/ASTSYCL/ast-dump-sycl-kernel-call-stmt.cpp
index 1047302d8f36e..d66d4fdcc9483 100644
--- a/clang/test/ASTSYCL/ast-dump-sycl-kernel-call-stmt.cpp
+++ b/clang/test/ASTSYCL/ast-dump-sycl-kernel-call-stmt.cpp
@@ -1,5 +1,5 @@
 // Tests without serialization:
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -fsycl-is-device \
+// RUN: %clang_cc1 -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device \
 // RUN:   -ast-dump %s \
 // RUN:   | FileCheck --match-full-lines %s
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -fsycl-is-host \
@@ -7,9 +7,9 @@
 // RUN:   | FileCheck --match-full-lines %s
 //
 // Tests with serialization:
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -fsycl-is-device \
+// RUN: %clang_cc1 -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device \
 // RUN:   -emit-pch -o %t %s
-// RUN: %clang_cc1 -x c++ -std=c++17 -triple x86_64-unknown-unknown -fsycl-is-device \
+// RUN: %clang_cc1 -x c++ -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device \
 // RUN:   -include-pch %t -ast-dump-all /dev/null \
 // RUN:   | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
 // RUN:   | FileCheck --match-full-lines %s

diff  --git a/clang/test/ASTSYCL/ast-dump-sycl-kernel-entry-point.cpp b/clang/test/ASTSYCL/ast-dump-sycl-kernel-entry-point.cpp
index cf7db46b3567e..cca10365e7686 100644
--- a/clang/test/ASTSYCL/ast-dump-sycl-kernel-entry-point.cpp
+++ b/clang/test/ASTSYCL/ast-dump-sycl-kernel-entry-point.cpp
@@ -1,5 +1,5 @@
 // Tests without serialization:
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -fsycl-is-device \
+// RUN: %clang_cc1 -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device \
 // RUN:   -ast-dump %s \
 // RUN:   | FileCheck --match-full-lines %s
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -fsycl-is-host \
@@ -7,9 +7,9 @@
 // RUN:   | FileCheck --match-full-lines %s
 //
 // Tests with serialization:
-// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -fsycl-is-device \
+// RUN: %clang_cc1 -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device \
 // RUN:   -emit-pch -o %t %s
-// RUN: %clang_cc1 -x c++ -std=c++17 -triple x86_64-unknown-unknown -fsycl-is-device \
+// RUN: %clang_cc1 -x c++ -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device \
 // RUN:   -include-pch %t -ast-dump-all /dev/null \
 // RUN:   | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
 // RUN:   | FileCheck --match-full-lines %s

diff  --git a/clang/test/CodeGenSYCL/address-space-mangling.cpp b/clang/test/CodeGenSYCL/address-space-mangling.cpp
index ecc2d4b43a159..5d011e9770bb0 100644
--- a/clang/test/CodeGenSYCL/address-space-mangling.cpp
+++ b/clang/test/CodeGenSYCL/address-space-mangling.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -triple spir64 -fsycl-is-device -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=SPIR
-// RUN: %clang_cc1 -triple x86_64 -fsycl-is-device -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=X86
 
 // REQUIRES: x86-registered-target
 
@@ -13,11 +12,6 @@ void foo(int *);
 // SPIR: declare spir_func void @_Z3fooPU3AS0i(ptr noundef) #1
 // SPIR: declare spir_func void @_Z3fooPi(ptr addrspace(4) noundef) #1
 
-// X86: declare void @_Z3fooPU8SYglobali(ptr noundef) #1
-// X86: declare void @_Z3fooPU7SYlocali(ptr noundef) #1
-// X86: declare void @_Z3fooPU9SYprivatei(ptr noundef) #1
-// X86: declare void @_Z3fooPi(ptr noundef) #1
-
 [[clang::sycl_external]] void test() {
   __attribute__((opencl_global)) int *glob;
   __attribute__((opencl_local)) int *loc;

diff  --git a/clang/test/Frontend/check-sycl-device-target.cpp b/clang/test/Frontend/check-sycl-device-target.cpp
new file mode 100644
index 0000000000000..9e75a4b99ef61
--- /dev/null
+++ b/clang/test/Frontend/check-sycl-device-target.cpp
@@ -0,0 +1,10 @@
+// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -fsycl-is-device %s 2>&1 | FileCheck --check-prefixes=INVALID %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -fsyntax-only -fsycl-is-device -verify=valid %s
+// RUN: %clang_cc1 -fsyntax-only -fsycl-is-device -verify=valid %s
+
+// These tests validate the target for SYCL device compilation
+
+// INVALID: x86_64-unknown-unknown is not a supported SYCL device target
+
+// valid-no-diagnostics
+

diff  --git a/clang/test/SemaSYCL/aux-triple.cpp b/clang/test/SemaSYCL/aux-triple.cpp
new file mode 100644
index 0000000000000..34c45b7d2a5ec
--- /dev/null
+++ b/clang/test/SemaSYCL/aux-triple.cpp
@@ -0,0 +1,22 @@
+// Test that SYCL device compilation inherits type properties from the host
+// architecture via AuxTriple/HostTriple.
+
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown \
+// RUN:   -aux-triple x86_64-unknown-linux-gnu -fsycl-is-device \
+// RUN:   -fsyntax-only -verify=linux %s
+
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown \
+// RUN:   -aux-triple x86_64-pc-windows-msvc -fsycl-is-device \
+// RUN:   -fsyntax-only -verify=windows %s
+
+// linux-no-diagnostics
+// windows-no-diagnostics
+
+void test_long_size() {
+#if defined(_WIN64)
+  static_assert(sizeof(long) == 4, "long should be 4 bytes on Windows");
+#else
+  static_assert(sizeof(long) == 8, "long should be 8 bytes on Linux");
+#endif
+}
+

diff  --git a/clang/test/SemaSYCL/float128.cpp b/clang/test/SemaSYCL/float128.cpp
index e41dea38dbe75..9841d620ebc22 100644
--- a/clang/test/SemaSYCL/float128.cpp
+++ b/clang/test/SemaSYCL/float128.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -triple spir64 -fsycl-is-device -verify -fsyntax-only %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsycl-is-device -fsyntax-only %s
 
 typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
 typedef __float128 BIGTY;

diff  --git a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp
index 45da8c71348b2..18118fc43a602 100644
--- a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-host -fcxx-exceptions -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-device -fcxx-exceptions -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++17 -fsyntax-only -fsycl-is-device -fcxx-exceptions -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-host -fcxx-exceptions -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-device -fcxx-exceptions -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++20 -fsyntax-only -fsycl-is-device -fcxx-exceptions -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -fsycl-is-host -fcxx-exceptions -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -fsycl-is-device -fcxx-exceptions -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++23 -fsyntax-only -fsycl-is-device -fcxx-exceptions -verify %s
 
 // These tests validate appertainment for the sycl_kernel_entry_point attribute.
 
@@ -286,10 +286,12 @@ consteval void bad25() {}
 [[clang::sycl_kernel_entry_point(BADKN<26>)]]
 [[noreturn]] void bad26();
 
+#if !defined(__SYCL_DEVICE_ONLY__)
 // expected-error at +3 {{attribute 'target' multiversioning cannot be combined with attribute 'clang::sycl_kernel_entry_point'}}
 __attribute__((target("avx"))) void bad27();
 [[clang::sycl_kernel_entry_point(BADKN<27>)]]
 __attribute__((target("sse4.2"))) void bad27();
+#endif
 
 template<typename KNT>
 struct B28 {

diff  --git a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-device-odr-use.cpp b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-device-odr-use.cpp
index e2854983da552..631e1d7ad3870 100644
--- a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-device-odr-use.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-device-odr-use.cpp
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsycl-is-host -verify=host %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsycl-is-device -verify=device %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++17 -fsycl-is-device -verify=device %s
 
 // These tests validate that a diagnostic is issued if a function declared with
 // the sycl_kernel_entry_point attribute is ODR-used from code that is emitted

diff  --git a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-grammar.cpp b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-grammar.cpp
index b1c9e270a02b8..379e38391d288 100644
--- a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-grammar.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-grammar.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++17 -fsyntax-only -fsycl-is-device -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++20 -fsyntax-only -fsycl-is-device -verify %s
 
 // These tests validate parsing of the sycl_kernel_entry_point argument list
 // and that the single argument names a type.

diff  --git a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-kernel-name.cpp b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-kernel-name.cpp
index 2abb24cde6663..70d9e5f218139 100644
--- a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-kernel-name.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-kernel-name.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++17 -fsyntax-only -fsycl-is-device -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++20 -fsyntax-only -fsycl-is-device -verify %s
 
 // These tests validate that the kernel name type argument provided to the
 // sycl_kernel_entry_point attribute meets the requirements of a SYCL kernel

diff  --git a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-sfinae.cpp b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-sfinae.cpp
index b39a77bd35878..654564f675e54 100644
--- a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-sfinae.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-sfinae.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++17 -fsyntax-only -fsycl-is-device -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++20 -fsyntax-only -fsycl-is-device -verify %s
 
 // These tests are intended to validate that a sycl_kernel_entry_point attribute
 // appearing in the declaration of a function template does not affect overload

diff  --git a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-this.cpp b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-this.cpp
index 2112733b41fc6..ac2d5c1541528 100644
--- a/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-this.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-entry-point-attr-this.cpp
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -std=c++17 -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -std=c++17 -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -fsyntax-only -std=c++17 -fsycl-is-device -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -std=c++20 -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -std=c++20 -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -fsyntax-only -std=c++20 -fsycl-is-device -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -std=c++23 -fsycl-is-host -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -std=c++23 -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -fsyntax-only -std=c++23 -fsycl-is-device -verify %s
 
 // These tests validate diagnostics for invalid use of 'this' in the body of
 // a function declared with the sycl_kernel_entry_point attribute.

diff  --git a/clang/test/SemaSYCL/sycl-kernel-launch-ms-compat.cpp b/clang/test/SemaSYCL/sycl-kernel-launch-ms-compat.cpp
index cd186a833b024..f62b129273217 100644
--- a/clang/test/SemaSYCL/sycl-kernel-launch-ms-compat.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-launch-ms-compat.cpp
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -std=c++20 -fsyntax-only -fsycl-is-host -fms-compatibility -fcxx-exceptions -verify=host,expected %s
-// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -std=c++20 -fsyntax-only -fsycl-is-device -fms-compatibility -verify=device,expected %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++20 -fsyntax-only -fsycl-is-device -fms-compatibility -verify=device,expected %s
 
 // Test Microsoft extensions for lookup of a sycl_kernel_launch member template
 // in a dependent base class.

diff  --git a/clang/test/SemaSYCL/sycl-kernel-launch.cpp b/clang/test/SemaSYCL/sycl-kernel-launch.cpp
index b673025f03b40..06452de35b3d2 100644
--- a/clang/test/SemaSYCL/sycl-kernel-launch.cpp
+++ b/clang/test/SemaSYCL/sycl-kernel-launch.cpp
@@ -1,9 +1,9 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-host -fcxx-exceptions -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++17 -fsyntax-only -fsycl-is-device -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-host -fcxx-exceptions -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++20 -fsyntax-only -fsycl-is-device -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -fsycl-is-host -fcxx-exceptions -verify %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -fsyntax-only -fsycl-is-device -verify %s
+// RUN: %clang_cc1 -triple spirv64-unknown-unknown -std=c++23 -fsyntax-only -fsycl-is-device -verify %s
 
 // Test overload resolution for implicit calls to sycl_kernel_launch<KN>(...)
 // synthesized for functions declared with the sycl_kernel_entry_point

diff  --git a/clang/test/SemaSYCL/unique-stable-name-multiple-target-crash.cpp b/clang/test/SemaSYCL/unique-stable-name-multiple-target-crash.cpp
index ec78feac8b7b3..5ec1b8120ebfa 100644
--- a/clang/test/SemaSYCL/unique-stable-name-multiple-target-crash.cpp
+++ b/clang/test/SemaSYCL/unique-stable-name-multiple-target-crash.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s %s -std=c++17 -triple x86_64-linux-gnu -fsycl-is-device -verify -fsyntax-only -Wno-unused
+// RUN: %clang_cc1 %s %s -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device -verify -fsyntax-only -Wno-unused
 
 // This would crash due to the double-inputs, since the 'magic static' use in
 // the AST Context SCYL Filtering would end up caching an old version of the

diff  --git a/clang/test/SemaSYCL/unique_stable_name.cpp b/clang/test/SemaSYCL/unique_stable_name.cpp
index fb3b0dbe9e0ee..15f64cc556845 100644
--- a/clang/test/SemaSYCL/unique_stable_name.cpp
+++ b/clang/test/SemaSYCL/unique_stable_name.cpp
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++17 -triple x86_64-pc-windows-msvc -fsycl-is-device -verify -fsyntax-only -Wno-unused
-// RUN: %clang_cc1 %s -std=c++17 -triple x86_64-linux-gnu -fsycl-is-device -verify -fsyntax-only -Wno-unused
+// RUN: %clang_cc1 %s -std=c++17 -triple spirv64-unknown-unknown -fsycl-is-device -verify -fsyntax-only -Wno-unused
 
 template <typename KernelName, typename KernelType>
 [[clang::sycl_kernel]] void kernel_single_task(KernelType kernelFunc) { // #kernelSingleTask

diff  --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index d5a42d9646c18..7b24db121818f 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -1287,7 +1287,7 @@ class Triple {
   LLVM_ABI bool isCompatibleWith(const Triple &Other) const;
 
   /// Test whether the target triple is for a GPU.
-  bool isGPU() const { return isSPIRV() || isNVPTX() || isAMDGPU(); }
+  bool isGPU() const { return isSPIROrSPIRV() || isNVPTX() || isAMDGPU(); }
 
   /// Merge target triples.
   LLVM_ABI std::string merge(const Triple &Other) const;


        


More information about the llvm-commits mailing list