@@ -4971,7 +4971,7 @@ static void ProcessVSRuntimeLibrary(const ArgList &Args,
4971
4971
const ToolChain &TC) {
4972
4972
unsigned RTOptionID = options::OPT__SLASH_MT;
4973
4973
4974
- bool isSPIR = TC.getTriple ().isSPIR ();
4974
+ bool isSPIROrSPIRV = TC.getTriple ().isSPIROrSPIRV ();
4975
4975
bool isSYCL = Args.hasArg (options::OPT_fsycl);
4976
4976
// For SYCL Windows, /MD is the default.
4977
4977
if (isSYCL)
@@ -4997,23 +4997,23 @@ static void ProcessVSRuntimeLibrary(const ArgList &Args,
4997
4997
.Default (options::OPT__SLASH_MT);
4998
4998
SetArg = A;
4999
4999
}
5000
- if (isSYCL && !isSPIR && SetArg &&
5000
+ if (isSYCL && !isSPIROrSPIRV && SetArg &&
5001
5001
(RTOptionID == options::OPT__SLASH_MT ||
5002
5002
RTOptionID == options::OPT__SLASH_MTd))
5003
- // Use of /MT or /MTd is not supported for SYCL.
5003
+ // Use of /MT or /MTd is not supported for SYCL.
5004
5004
TC.getDriver ().Diag (diag::err_drv_unsupported_opt_dpcpp)
5005
5005
<< SetArg->getOption ().getName ();
5006
5006
5007
5007
enum { addDEBUG = 0x1 , addMT = 0x2 , addDLL = 0x4 };
5008
5008
auto addPreDefines = [&](unsigned Defines) {
5009
5009
if (Defines & addDEBUG)
5010
5010
CmdArgs.push_back (" -D_DEBUG" );
5011
- if (Defines & addMT && !isSPIR )
5011
+ if (Defines & addMT && !isSPIROrSPIRV )
5012
5012
CmdArgs.push_back (" -D_MT" );
5013
- if (Defines & addDLL && !isSPIR )
5013
+ if (Defines & addDLL && !isSPIROrSPIRV )
5014
5014
CmdArgs.push_back (" -D_DLL" );
5015
5015
// for /MDd with spir targets
5016
- if ((Defines & addDLL) && (Defines & addDEBUG) && isSPIR ) {
5016
+ if ((Defines & addDLL) && (Defines & addDEBUG) && isSPIROrSPIRV ) {
5017
5017
CmdArgs.push_back (" -D_CONTAINER_DEBUG_LEVEL=0" );
5018
5018
CmdArgs.push_back (" -D_ITERATOR_DEBUG_LEVEL=0" );
5019
5019
}
@@ -5282,8 +5282,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
5282
5282
options::OPT_fno_sycl_early_optimizations,
5283
5283
!IsFPGASYCLOffloadDevice))
5284
5284
CmdArgs.push_back (" -fno-sycl-early-optimizations" );
5285
- else if (RawTriple.isSPIR ()) {
5286
- // Set `sycl-opt` option to configure LLVM passes for SPIR target
5285
+ else if (RawTriple.isSPIROrSPIRV ()) {
5286
+ // Set `sycl-opt` option to configure LLVM passes for SPIR/SPIR-V target
5287
5287
CmdArgs.push_back (" -mllvm" );
5288
5288
CmdArgs.push_back (" -sycl-opt" );
5289
5289
}
@@ -5325,8 +5325,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
5325
5325
}
5326
5326
5327
5327
// Forward -fsycl-instrument-device-code option to cc1. This option will
5328
- // only be used for SPIR-V- based targets.
5329
- if (Triple.isSPIR ())
5328
+ // only be used for SPIR/SPIR-V based targets.
5329
+ if (Triple.isSPIROrSPIRV ())
5330
5330
if (Args.hasFlag (options::OPT_fsycl_instrument_device_code,
5331
5331
options::OPT_fno_sycl_instrument_device_code, true ))
5332
5332
CmdArgs.push_back (" -fsycl-instrument-device-code" );
@@ -5412,8 +5412,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
5412
5412
CmdArgs.push_back (" -fno-sycl-force-inline-kernel-lambda" );
5413
5413
5414
5414
// Add -ffine-grained-bitfield-accesses option. This will be added
5415
- // only for SPIR based targets.
5416
- if (Triple.isSPIR ()) {
5415
+ // only for SPIR/SPIR-V based targets.
5416
+ if (Triple.isSPIROrSPIRV ()) {
5417
5417
// It cannot be enabled together with a sanitizer
5418
5418
if (!Args.getLastArg (options::OPT_fsanitize_EQ))
5419
5419
CmdArgs.push_back (" -ffine-grained-bitfield-accesses" );
@@ -5572,8 +5572,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
5572
5572
// are provided.
5573
5573
TC.addClangWarningOptions (CmdArgs);
5574
5574
5575
- // FIXME: Subclass ToolChain for SPIR and move this to addClangWarningOptions.
5576
- if (Triple.isSPIR () || Triple.isSPIRV ())
5575
+ // FIXME: Subclass ToolChain for SPIR/SPIR-V and move this to
5576
+ // addClangWarningOptions.
5577
+ if (Triple.isSPIROrSPIRV ())
5577
5578
CmdArgs.push_back (" -Wspir-compat" );
5578
5579
5579
5580
// Select the appropriate action.
@@ -6353,9 +6354,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
6353
6354
if (Arg *A = Args.getLastArg (options::OPT_LongDouble_Group)) {
6354
6355
if (TC.getTriple ().isX86 ())
6355
6356
A->render (Args, CmdArgs);
6356
- else if (TC.getTriple ().isSPIR () &&
6357
+ else if (TC.getTriple ().isSPIROrSPIRV () &&
6357
6358
(A->getOption ().getID () == options::OPT_mlong_double_64))
6358
- // Only allow for -mlong-double-64 for SPIR-V
6359
+ // Only allow for -mlong-double-64 for SPIR/SPIR -V
6359
6360
A->render (Args, CmdArgs);
6360
6361
else if (TC.getTriple ().isPPC () &&
6361
6362
(A->getOption ().getID () != options::OPT_mlong_double_80))
@@ -9590,7 +9591,7 @@ void OffloadBundler::ConstructJobMultipleOutputs(
9590
9591
TypeArg = (InputType == types::TY_FPGA_AOCX) ? " aocx" : " aocr" ;
9591
9592
// When the output is a Tempfilelist, we know we are unbundling
9592
9593
// the .bc files from the archive.
9593
- if (!getToolChain ().getTriple ().isSPIR () ||
9594
+ if (!getToolChain ().getTriple ().isSPIROrSPIRV () ||
9594
9595
JA.getType () == types::TY_Tempfilelist)
9595
9596
TypeArg = " aoo" ;
9596
9597
}
@@ -9604,7 +9605,7 @@ void OffloadBundler::ConstructJobMultipleOutputs(
9604
9605
auto SYCLTCRange = C.getOffloadToolChains <Action::OFK_SYCL>();
9605
9606
for (auto TI = SYCLTCRange.first , TE = SYCLTCRange.second ; TI != TE; ++TI) {
9606
9607
llvm::Triple TT (TI->second ->getTriple ());
9607
- if (TT.isSPIR ()) {
9608
+ if (TT.isSPIROrSPIRV ()) {
9608
9609
HasSPIRTarget = true ;
9609
9610
if (TT.getSubArch () == llvm::Triple::SPIRSubArch_fpga)
9610
9611
HasFPGATarget = true ;
@@ -9641,7 +9642,7 @@ void OffloadBundler::ConstructJobMultipleOutputs(
9641
9642
// aocx or aocr type bundles. Also, we only do a specific target
9642
9643
// unbundling, skipping the host side or device side.
9643
9644
if (types::isFPGA (InputType) || InputType == types::TY_Tempfilelist) {
9644
- if (getToolChain ().getTriple ().isSPIR ()) {
9645
+ if (getToolChain ().getTriple ().isSPIROrSPIRV ()) {
9645
9646
if (Dep.DependentToolChain ->getTriple ().getSubArch () ==
9646
9647
llvm::Triple::SPIRSubArch_fpga) {
9647
9648
StringRef TypeName (types::getTypeName (InputType));
@@ -10470,7 +10471,7 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
10470
10471
addArgs (CmdArgs, TCArgs, {" -ir-output-only" });
10471
10472
} else {
10472
10473
assert (SYCLPostLink->getTrueType () == types::TY_Tempfiletable);
10473
- bool SplitEsimdByDefault = T.isSPIR ();
10474
+ bool SplitEsimdByDefault = T.isSPIROrSPIRV ();
10474
10475
bool SplitEsimd = TCArgs.hasFlag (
10475
10476
options::OPT_fsycl_device_code_split_esimd,
10476
10477
options::OPT_fno_sycl_device_code_split_esimd, SplitEsimdByDefault);
@@ -10766,12 +10767,6 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
10766
10767
if (Args.hasArg (options::OPT_v))
10767
10768
CmdArgs.push_back (" --wrapper-verbose" );
10768
10769
10769
- // Pass the device triple to the linker wrapper tool for SYCL offload.
10770
- // Only spir64 is currently passed.
10771
- // TODO(NOM1): Support target triples in a more generic way.
10772
- // TODO(NOM3): Investigate why passing spir64-unknown-unknown does not work.
10773
- CmdArgs.push_back (" --triple=spir64" );
10774
-
10775
10770
// TODO(NOM2): Pass following options to clang-linker-wrapper.
10776
10771
// Please refer to sycl/doc/design/OffloadDesign.md for details.
10777
10772
// sycl-device-libraries
@@ -10814,20 +10809,30 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
10814
10809
// device specific libraries that are needed. This provides the list of
10815
10810
// files file only.
10816
10811
// TODO: This generic list will be populated with only device binaries
10817
- // for spir64. Other targets (AOT and others) can represent a different
10812
+ // for spir/spirv. Other targets (AOT and others) can represent a different
10818
10813
// set of device libraries. We will cross that bridge when we begin to
10819
10814
// enable the other possible targets.
10820
10815
llvm::Triple TargetTriple;
10821
10816
auto ToolChainRange = C.getOffloadToolChains <Action::OFK_SYCL>();
10822
10817
for (auto &I :
10823
10818
llvm::make_range (ToolChainRange.first , ToolChainRange.second )) {
10824
10819
const ToolChain *TC = I.second ;
10825
- if (TC->getTriple ().isSPIR () &&
10820
+ if (TC->getTriple ().isSPIROrSPIRV () &&
10826
10821
TC->getTriple ().getSubArch () == llvm::Triple::NoSubArch) {
10827
10822
TargetTriple = TC->getTriple ();
10828
10823
break ;
10829
10824
}
10830
10825
}
10826
+ // Pass the device triple to the linker wrapper tool for SYCL offload.
10827
+ // Only spir64 or spirv64 is currently passed.
10828
+ // TODO(NOM1): Support target triples in a more generic way.
10829
+ // TODO(NOM3): Investigate why passing spirv64-unknown-unknown does not
10830
+ // work.
10831
+ if (TargetTriple.isSPIR ())
10832
+ CmdArgs.push_back (" --triple=spir64" );
10833
+ else if (TargetTriple.isSPIRV ())
10834
+ CmdArgs.push_back (" --triple=spirv64" );
10835
+
10831
10836
SmallVector<std::string, 8 > SYCLDeviceLibs;
10832
10837
SYCLDeviceLibs = SYCL::getDeviceLibraries (C, TargetTriple,
10833
10838
/* IsSpirvAOT=*/ false );
0 commit comments