[clang] [llvm] [clang] Check validity of SYCL device target (PR #172366)
Tom Honermann via cfe-commits
cfe-commits at lists.llvm.org
Fri May 1 09:46:45 PDT 2026
================
@@ -0,0 +1,16 @@
+/// Check "-fsycl-is-device" and the default triple "spirv64-unknown-unknown"
+// is passed when compiling for device.
+
+// RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \
+// RUN: | FileCheck %s
+
+// CHECK: "-triple" "spirv64-unknown-unknown" {{.*}} "-fsycl-is-device"
+
+/// Check "-fsycl-is-device" and explicitly specified triple "nvptx" is
+// passed when compiling for device.
+
+// RUN: %clang -### -fsycl -fsycl-device-only --target=nvptx %s 2>&1 \
+// RUN: | FileCheck %s -check-prefix=TARGET
+//
+// TARGET: "-triple" "spirv32-unknown-unknown" "-aux-triple" "nvptx"
----------------
tahonermann wrote:
I just realized that this test is passing `-fsycl-device-only --target` to the driver. In that case, `--target` specifies the host target, not the device (as you noted, `--offload-arch` or `--offload-targets` should be used to specify the device target). So this case does appear to be working correctly, just with an odd choice of host target.
Greg has [a draft RFC](https://github.com/intel-sandbox/personal.gmlueck/pull/8) that is in this space; there has been a lot of discussion about `--offload-arch` and `--offload-targets` recently.
I'm fine with deferring the addition of this test to a later PR. We'll have more work to do in this space anyway.
https://github.com/llvm/llvm-project/pull/172366
More information about the cfe-commits
mailing list