Skip to content

[Driver][NFC] Cleanup some option setting for SYCL offload #3542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 60 additions & 87 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4267,15 +4267,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
(IsSYCL || IsCuda || IsHIP) ? TC.getAuxTriple() : nullptr;
bool IsWindowsMSVC = RawTriple.isWindowsMSVCEnvironment();
bool IsIAMCU = RawTriple.isOSIAMCU();
bool IsSYCLDevice = (RawTriple.getEnvironment() == llvm::Triple::SYCLDevice ||
Triple.getEnvironment() == llvm::Triple::SYCLDevice);
// Using just the sycldevice environment is not enough to determine usage
// of the device triple when considering fat static archives. The
// compilation path requires the host object to be fed into the partial link
// step, and being part of the SYCL tool chain causes the incorrect target.
// FIXME - Is it possible to retain host environment when on a target
// device toolchain.
bool UseSYCLTriple = IsSYCLDevice && (!IsSYCL || IsSYCLOffloadDevice);

// Adjust IsWindowsXYZ for CUDA/HIP/SYCL compilations. Even when compiling in
// device mode (i.e., getToolchain().getTriple() is NVPTX/AMDGCN, not
Expand All @@ -4294,16 +4285,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,

// Add the "effective" target triple.
CmdArgs.push_back("-triple");
if (!UseSYCLTriple && IsSYCLDevice) {
// Do not use device triple when we know the device is not SYCL
// FIXME: We override the toolchain triple in this instance to address a
// disconnect with fat static archives. We should have a cleaner way of
// using the Host environment when on a device toolchain.
std::string NormalizedTriple =
llvm::Triple(llvm::sys::getProcessTriple()).normalize();
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
} else
CmdArgs.push_back(Args.MakeArgString(TripleStr));
CmdArgs.push_back(Args.MakeArgString(TripleStr));

if (const Arg *MJ = Args.getLastArg(options::OPT_MJ)) {
DumpCompilationDatabase(C, MJ->getValue(), TripleStr, Output, Input, Args);
Expand Down Expand Up @@ -4349,7 +4331,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,

Arg *SYCLStdArg = Args.getLastArg(options::OPT_sycl_std_EQ);

if (UseSYCLTriple) {
if (IsSYCLOffloadDevice) {
// Pass the triple of host when doing SYCL
llvm::Triple AuxT = C.getDefaultToolChain().getTriple();
std::string NormalizedTriple = AuxT.normalize();
CmdArgs.push_back("-aux-triple");
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));

// We want to compile sycl kernels.
CmdArgs.push_back("-fsycl-is-device");
CmdArgs.push_back("-fdeclare-spirv-builtins");
Expand All @@ -4364,18 +4352,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-sycl-opt");
}

// Turn on Dead Parameter Elimination Optimization with early optimizations
if (!RawTriple.isNVPTX() &&
Args.hasFlag(options::OPT_fsycl_dead_args_optimization,
options::OPT_fno_sycl_dead_args_optimization, false))
CmdArgs.push_back("-fenable-sycl-dae");

// Pass the triple of host when doing SYCL
llvm::Triple AuxT = C.getDefaultToolChain().getTriple();
std::string NormalizedTriple = AuxT.normalize();
CmdArgs.push_back("-aux-triple");
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));

bool IsMSVC = AuxT.isWindowsMSVCEnvironment();
if (IsMSVC) {
CmdArgs.push_back("-fms-extensions");
Expand Down Expand Up @@ -4404,22 +4386,67 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// along with marking the same function with explicit SYCL_EXTERNAL
CmdArgs.push_back("-Wno-sycl-strict");
}

// Add the integration header option to generate the header.
StringRef Header(D.getIntegrationHeader(Input.getBaseInput()));
if (!Header.empty()) {
SmallString<128> HeaderOpt("-fsycl-int-header=");
HeaderOpt.append(Header);
CmdArgs.push_back(Args.MakeArgString(HeaderOpt));
}
}
if (IsSYCL || UseSYCLTriple) {

if (IsSYCL) {
// Set options for both host and device
if (Arg *A = Args.getLastArg(options::OPT_fsycl_id_queries_fit_in_int,
options::OPT_fno_sycl_id_queries_fit_in_int))
A->render(Args, CmdArgs);
}

if (IsSYCL) {
if (SYCLStdArg) {
SYCLStdArg->render(Args, CmdArgs);
CmdArgs.push_back("-fsycl-std-layout-kernel-params");
} else {
// Ensure the default version in SYCL mode is 2020
CmdArgs.push_back("-sycl-std=2020");
}
if (Args.hasArg(options::OPT_fsycl_unnamed_lambda))
CmdArgs.push_back("-fsycl-unnamed-lambda");

// Enable generation of USM address spaces for FPGA.
// __ENABLE_USM_ADDR_SPACE__ will be used during compilation of SYCL headers
if (getToolChain().getTriple().getSubArch() ==
llvm::Triple::SPIRSubArch_fpga)
CmdArgs.push_back("-D__ENABLE_USM_ADDR_SPACE__");

// Add any options that are needed specific to SYCL offload while
// performing the host side compilation.
if (!IsSYCLOffloadDevice) {
// Add the -include option to add the integration header
StringRef Header = D.getIntegrationHeader(Input.getBaseInput());
if (types::getPreprocessedType(Input.getType()) != types::TY_INVALID &&
!Header.empty()) {
CmdArgs.push_back("-include");
CmdArgs.push_back(Args.MakeArgString(Header));
// When creating dependency information, filter out the generated
// header file.
CmdArgs.push_back("-dependency-filter");
CmdArgs.push_back(Args.MakeArgString(Header));
}
// Let the FE know we are doing a SYCL offload compilation, but we are
// doing the host pass.
CmdArgs.push_back("-fsycl-is-host");

if (!D.IsCLMode()) {
// SYCL library is guaranteed to work correctly only with dynamic
// MSVC runtime.
llvm::Triple AuxT = C.getDefaultToolChain().getTriple();
if (AuxT.isWindowsMSVCEnvironment()) {
CmdArgs.push_back("-D_MT");
CmdArgs.push_back("-D_DLL");
CmdArgs.push_back("--dependent-lib=msvcrt");
}
}
}
}

if (IsOpenMPDevice) {
Expand Down Expand Up @@ -4500,7 +4527,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-P");
}
} else if (isa<AssembleJobAction>(JA)) {
if (IsSYCLOffloadDevice && IsSYCLDevice) {
if (IsSYCLOffloadDevice) {
CmdArgs.push_back("-emit-llvm-bc");
} else {
CmdArgs.push_back("-emit-obj");
Expand Down Expand Up @@ -5958,10 +5985,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Forward -cl options to -cc1
RenderOpenCLOptions(Args, CmdArgs, InputType);

// Forward -sycl-std option to -cc1 only if -fsycl is enabled.
if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
Args.AddLastArg(CmdArgs, options::OPT_sycl_std_EQ);

// Forward -fsycl-instrument-device-code option to cc1. This option can only
// be used with spir triple.
if (Arg *A = Args.getLastArg(options::OPT_fsycl_instrument_device_code)) {
Expand Down Expand Up @@ -6425,7 +6448,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// selected. For optimization levels that want vectorization we use the alias
// option to simplify the hasFlag logic.
bool EnableVec = shouldEnableVectorizerAtOLevel(Args, false);
if (UseSYCLTriple && RawTriple.isSPIR() && EnableSYCLEarlyOptimizations)
if (RawTriple.isSPIR() && EnableSYCLEarlyOptimizations)
EnableVec = false; // But disable vectorization for SYCL device code
OptSpecifier VectorizeAliasOption =
EnableVec ? options::OPT_O_Group : options::OPT_fvectorize;
Expand All @@ -6435,7 +6458,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,

// -fslp-vectorize is enabled based on the optimization level selected.
bool EnableSLPVec = shouldEnableVectorizerAtOLevel(Args, true);
if (UseSYCLTriple && RawTriple.isSPIR() && EnableSYCLEarlyOptimizations)
if (RawTriple.isSPIR() && EnableSYCLEarlyOptimizations)
EnableSLPVec = false; // But disable vectorization for SYCL device code
OptSpecifier SLPVectAliasOption =
EnableSLPVec ? options::OPT_O_Group : options::OPT_fslp_vectorize;
Expand Down Expand Up @@ -6640,56 +6663,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-fcuda-short-ptr");
}

if (IsSYCL) {
// Add any options that are needed specific to SYCL offload while
// performing the host side compilation.
if (!IsSYCLOffloadDevice) {
// Add the integration header option to generate the header.
StringRef Header = D.getIntegrationHeader(Input.getBaseInput());
if (types::getPreprocessedType(InputType) != types::TY_INVALID &&
!Header.empty()) {
CmdArgs.push_back("-include");
CmdArgs.push_back(Args.MakeArgString(Header));
// When creating dependency information, filter out the generated
// header file.
CmdArgs.push_back("-dependency-filter");
CmdArgs.push_back(Args.MakeArgString(Header));
}
// Let the FE know we are doing a SYCL offload compilation, but we are
// doing the host pass.
CmdArgs.push_back("-fsycl-is-host");

if (!D.IsCLMode()) {
// SYCL library is guaranteed to work correctly only with dynamic
// MSVC runtime.
llvm::Triple AuxT = C.getDefaultToolChain().getTriple();
if (AuxT.isWindowsMSVCEnvironment()) {
CmdArgs.push_back("-D_MT");
CmdArgs.push_back("-D_DLL");
CmdArgs.push_back("--dependent-lib=msvcrt");
}
}
}
if (IsSYCLOffloadDevice) {
// Add the integration header option to generate the header.
StringRef Header(D.getIntegrationHeader(Input.getBaseInput()));
if (!Header.empty()) {
SmallString<128> HeaderOpt("-fsycl-int-header=");
HeaderOpt.append(Header);
CmdArgs.push_back(Args.MakeArgString(HeaderOpt));
}
}

if (Args.hasArg(options::OPT_fsycl_unnamed_lambda))
CmdArgs.push_back("-fsycl-unnamed-lambda");

// Enable generation of USM address spaces for FPGA.
// __ENABLE_USM_ADDR_SPACE__ will be used during compilation of SYCL headers
if (getToolChain().getTriple().getSubArch() ==
llvm::Triple::SPIRSubArch_fpga)
CmdArgs.push_back("-D__ENABLE_USM_ADDR_SPACE__");
}

if (IsCuda || IsHIP) {
// Determine the original source input.
const Action *SourceAction = &JA;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/sycl-MD-default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// RUN: %clangxx -### -fsycl -c -target x86_64-unknown-windows-msvc %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-DEFAULT %s
// CHK-DEFAULT-NOT: "-fsycl-is-device" {{.*}} "-D_MT" "-D_DLL"
// CHK-DEFAULT: "-fsycl-is-host" "-D_MT" "-D_DLL" "--dependent-lib=msvcrt{{d*}}" {{.*}}
// CHK-DEFAULT: "-fsycl-is-host"{{.*}} "-D_MT" "-D_DLL" "--dependent-lib=msvcrt{{d*}}" {{.*}}

// RUN: %clang_cl -### -fsycl -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-DEFAULT-CL %s
Expand All @@ -14,7 +14,7 @@
// RUN: %clang_cl -### -MDd -fsycl -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-DEFAULT-CL %s
// CHK-DEFAULT-CL-NOT: "-fsycl-is-device" {{.*}} "-D_MT" "-D_DLL"
// CHK-DEFAULT-CL: "-D_MT" "-D_DLL" "--dependent-lib=msvcrt{{d*}}" {{.*}} "-fsycl-is-host"
// CHK-DEFAULT-CL: "-fsycl-is-host"{{.*}} "-D_MT" "-D_DLL" "--dependent-lib=msvcrt{{d*}}"

// RUN: %clang_cl -### -MT -fsycl -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-ERROR %s
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Driver/sycl-offload-intelfpga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,16 @@
// CHK-FPGA-DEP-FILES: clang{{.*}} "-dependency-file" "[[INPUT1:.+\.d]]" "-MT" "{{.*}}.o"
// CHK-FPGA-DEP-FILES: clang{{.*}} "-dependency-file" "[[INPUT2:.+\.d]]" "-MT" "{{.*}}.o"
// CHK-FPGA-DEP-FILES: aoc{{.*}} "-dep-files={{.*}}[[INPUT1]],{{.*}}[[INPUT2]]"
// CHK-FPGA-DEP-FILES-NOT: clang{{.*}} "-dependency-file" {{.*}} "-fsycl-is-host"
// CHK-FPGA-DEP-FILES-NOT: clang{{.*}} "-fsycl-is-host"{{.*}} "-dependency-file"

/// -fintelfpga dependency file check with host .d enabled
// RUN: %clangxx -### -MMD -fsycl -fintelfpga %t-1.cpp %t-2.cpp 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-FPGA-DEP-FILES-HOST %s
// CHK-FPGA-DEP-FILES-HOST: clang{{.*}} "-dependency-file" "[[INPUT1:.+\.d]]" "-MT" "{{.*}}.o"
// CHK-FPGA-DEP-FILES-HOST: clang{{.*}} "-dependency-file" "[[INPUT2:.+\.d]]" "-MT" "{{.*}}.o"
// CHK-FPGA-DEP-FILES-HOST: aoc{{.*}} "-dep-files={{.*}}[[INPUT1]],{{.*}}[[INPUT2]]"
// CHK-FPGA-DEP-FILES-HOST: clang{{.*}} "-dependency-file" {{.*}} "-fsycl-is-host"
// CHK-FPGA-DEP-FILES-HOST: clang{{.*}} "-dependency-file" {{.*}} "-fsycl-is-host"
// CHK-FPGA-DEP-FILES-HOST: clang{{.*}} "-fsycl-is-host"{{.*}} "-dependency-file"
// CHK-FPGA-DEP-FILES-HOST: clang{{.*}} "-fsycl-is-host"{{.*}} "-dependency-file"

/// -fintelfpga dependency file generation test to object
// RUN: %clangxx -### -fsycl -fintelfpga -target x86_64-unknown-linux-gnu %t-1.cpp %t-2.cpp -c 2>&1 \
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-offload-nvptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// RUN: -fsycl-targets=nvptx64-nvidia-nvcl-sycldevice --cuda-path=%S/Inputs/CUDA/usr/local/cuda \
// RUN: -fsycl-libspirv-path=%S/Inputs/SYCL/libspirv.bc %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-ACTIONS %s
// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-Wno-sycl-strict" "-sycl-std=2020" {{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION:[0-9.]+]]"{{.*}} "-target-cpu" "sm_50"{{.*}} "-std=c++11"{{.*}}
// CHK-ACTIONS: "-cc1" "-triple" "nvptx64-nvidia-nvcl-sycldevice" "-aux-triple" "x86_64-unknown-linux-gnu"{{.*}} "-fsycl-is-device"{{.*}} "-Wno-sycl-strict"{{.*}} "-sycl-std=2020" {{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libspirv.bc"{{.*}} "-mlink-builtin-bitcode" "{{.*}}libdevice{{.*}}.10.bc"{{.*}} "-target-feature" "+ptx42"{{.*}} "-target-sdk-version=[[CUDA_VERSION:[0-9.]+]]"{{.*}} "-target-cpu" "sm_50"{{.*}} "-std=c++11"{{.*}}
// CHK-ACTIONS-NOT: "-mllvm -sycl-opt"
// CHK-ACTIONS: clang-offload-wrapper"{{.*}} "-host=x86_64-unknown-linux-gnu" "-target=nvptx64" "-kind=sycl"{{.*}}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/sycl-offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,4 +926,4 @@
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s -check-prefixes=CHECK-HEADER-DIR
// RUN: %clang_cl -### -fsycl %s 2>&1 | FileCheck %s -check-prefixes=CHECK-HEADER-DIR
// CHECK-HEADER-DIR: clang{{.*}} "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl" "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include"
// CHECK-HEADER-DIR: clang{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl" "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include"{{.*}} "-fsycl-is-host"
// CHECK-HEADER-DIR: clang{{.*}} "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl" "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include"{{.*}}
5 changes: 2 additions & 3 deletions clang/test/Driver/sycl-offload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
/// Check that -fcoverage-mapping is disabled for device
// RUN: %clang -### -fsycl -fprofile-instr-generate -fcoverage-mapping -target x86_64-unknown-linux-gnu -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK_COVERAGE_MAPPING %s
// CHECK_COVERAGE_MAPPING: clang{{.*}} "-cc1" "-triple" "spir64-unknown-unknown-sycldevice" "-fsycl-is-device"{{.*}} "-fprofile-instrument=clang"
// CHECK_COVERAGE_MAPPING: clang{{.*}} "-cc1" "-triple" "spir64-unknown-unknown-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-fprofile-instrument=clang"
// CHECK_COVERAGE_MAPPING-NOT: "-fcoverage-mapping"
// CHECK_COVERAGE_MAPPING: clang{{.*}} "-cc1" "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-fprofile-instrument=clang"
// CHECK_COVERAGE_MAPPING: "-fcoverage-mapping"{{.*}} "-fsycl-is-host"
// CHECK_COVERAGE_MAPPING: clang{{.*}} "-cc1" "-triple" "x86_64-unknown-linux-gnu"{{.*}} "-fsycl-is-host"{{.*}} "-fprofile-instrument=clang"{{.*}} "-fcoverage-mapping"{{.*}}
8 changes: 4 additions & 4 deletions clang/test/Driver/sycl.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
// RUN: %clangxx -### -fsycl-device-only -fsycl-unnamed-lambda %s 2>&1 | FileCheck %s --check-prefix=CHECK-LAMBDA
// RUN: %clang_cl -### -fsycl-device-only -fsycl-unnamed-lambda %s 2>&1 | FileCheck %s --check-prefix=CHECK-LAMBDA

// DEFAULT: "-triple" "spir64-unknown-{{.*}}-sycldevice{{.*}}" "-fsycl-is-device"{{.*}} "-sycl-std=2020"{{.*}} "-emit-llvm-bc"
// DEFAULT: "-triple" "spir64-unknown-{{.*}}-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-sycl-std=2020"{{.*}} "-emit-llvm-bc"
// DEFAULT: "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}sycl"
// DEFAULT: "-internal-isystem" "{{.*lib.*clang.*include}}"
// DEFAULT: "-std=c++17"
Expand All @@ -48,7 +48,7 @@
// DEFAULT-NOT: "-std=c++14"
// NO-BITCODE: "-triple" "spir64-unknown-{{.*}}-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-emit-llvm-bc"
// NO-BITCODE: "{{.*}}llvm-spirv"{{.*}} "-spirv-max-version=1.3"{{.*}} "-spirv-ext=+all,-SPV_INTEL_usm_storage_classes,-SPV_INTEL_optnone,-SPV_KHR_linkonce_odr"
// TARGET: "-triple" "spir64-unknown-linux-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-emit-llvm-bc"
// TARGET: "-triple" "spir64-unknown-linux-sycldevice"{{.*}} "-emit-llvm-bc"
// COMBINED: "-triple" "spir64-unknown-{{.*}}-sycldevice"{{.*}} "-fsycl-is-device"{{.*}} "-emit-llvm-bc"
// TEXTUAL: "-triple" "spir64-unknown-{{.*}}-sycldevice{{.*}}" "-fsycl-is-device"{{.*}} "-emit-llvm"
// CHECK-LAMBDA: "-fsycl-unnamed-lambda"
Expand All @@ -58,13 +58,13 @@
// RUN: | FileCheck --check-prefix=DEVICE-64 %s
// RUN: %clang_cl -fsycl-device-only --target=x86_64-unknown-linux-gnu -### %s 2>&1 \
// RUN: | FileCheck --check-prefix=DEVICE-64 %s
// DEVICE-64: clang{{.*}} "-triple" "spir64-unknown-unknown-sycldevice" {{.*}} "-aux-triple" "x86_64-unknown-linux-gnu"
// DEVICE-64: clang{{.*}} "-triple" "spir64-unknown-unknown-sycldevice" "-aux-triple" "x86_64-unknown-linux-gnu"

// RUN: %clang -fsycl-device-only -target i386-unknown-linux-gnu -### %s 2>&1 \
// RUN: | FileCheck --check-prefix=DEVICE-32 %s
// RUN: %clang_cl -fsycl-device-only --target=i386-unknown-linux-gnu -### %s 2>&1 \
// RUN: | FileCheck --check-prefix=DEVICE-32 %s
// DEVICE-32: clang{{.*}} "-triple" "spir-unknown-unknown-sycldevice" {{.*}} "-aux-triple" "i386-unknown-linux-gnu"
// DEVICE-32: clang{{.*}} "-triple" "spir-unknown-unknown-sycldevice" "-aux-triple" "i386-unknown-linux-gnu"

/// Verify that the sycl header directory is before /usr/include
// RUN: %clangxx -### -fsycl-device-only %s 2>&1 | FileCheck %s --check-prefix=HEADER_ORDER
Expand Down