@@ -340,6 +340,17 @@ InputArgList Driver::ParseArgStrings(ArrayRef<const char *> ArgStrings,
340
340
DiagnosticsEngine::Warning;
341
341
continue;
342
342
}
343
+ // Emit an unsupported and removed diagnostic for any options that were
344
+ // previously supported and subsequently removed. This is considered a
345
+ // special case scenario that is currently being used for FPGA related
346
+ // options that did not go through the regular deprecation process.
347
+ if (A->getOption().hasFlag(options::UnsupportedRemoved)) {
348
+ Diag(diag::err_drv_unsupported_opt_removed) << A->getAsString(Args);
349
+ ContainsError |= Diags.getDiagnosticLevel(
350
+ diag::err_drv_unsupported_opt_removed,
351
+ SourceLocation()) > DiagnosticsEngine::Warning;
352
+ continue;
353
+ }
343
354
344
355
// Deprecated options emit a diagnostic about deprecation, but are still
345
356
// supported until removed. It's possible to have a deprecated option which
@@ -886,6 +897,10 @@ static bool isValidSYCLTriple(llvm::Triple T) {
886
897
((T.getArch() == llvm::Triple::spir && A != "spir") ||
887
898
(T.getArch() == llvm::Triple::spir64 && A != "spir64")))
888
899
return false;
900
+
901
+ // spir64_fpga is not supported.
902
+ if (T.isSPIR() && T.getSubArch() == llvm::Triple::SPIRSubArch_fpga)
903
+ return false;
889
904
return true;
890
905
}
891
906
@@ -896,10 +911,19 @@ static const char *getDefaultSYCLArch(Compilation &C) {
896
911
return "spir64";
897
912
}
898
913
899
- llvm::Triple Driver::getSYCLDeviceTriple(StringRef TargetArch) const {
914
+ llvm::Triple Driver::getSYCLDeviceTriple(StringRef TargetArch,
915
+ const Arg *Arg) const {
900
916
SmallVector<StringRef, 5> SYCLAlias = {
901
917
"spir", "spir64", "spir64_fpga", "spir64_x86_64",
902
918
"spir64_gen", "spirv32", "spirv64", "nvptx64"};
919
+ // spir64_fpga is no longer supported.
920
+ llvm::Triple TargetTriple(TargetArch);
921
+ if (Arg && !Arg->isClaimed() && TargetTriple.isSPIR() &&
922
+ TargetTriple.getSubArch() == llvm::Triple::SPIRSubArch_fpga) {
923
+ Diag(diag::err_drv_unsupported_opt_removed)
924
+ << Arg->getSpelling().str() + TargetArch.str();
925
+ Arg->claim();
926
+ }
903
927
if (llvm::is_contained(SYCLAlias, TargetArch)) {
904
928
llvm::Triple TT;
905
929
TT.setArchName(TargetArch);
@@ -1239,8 +1263,17 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
1239
1263
<< ArgValue << A->getOption().getName();
1240
1264
};
1241
1265
1266
+ // TODO: Transition to using -fsycl-link as a flag as opposed to an option
1267
+ // that takes an argument. The use of 'default' is a temporary solution as we
1268
+ // remove FPGA support.
1242
1269
Arg *SYCLLink = getArgRequiringSYCLRuntime(options::OPT_fsycl_link_EQ);
1243
- checkSingleArgValidity(SYCLLink, {"early", "image"});
1270
+ checkSingleArgValidity(SYCLLink, {"early", "image", "default"});
1271
+
1272
+ // Use of -fsycl-link=early and -fsycl-link=image are not supported.
1273
+ if (SYCLLink && (SYCLLink->getValue() == StringRef("early") ||
1274
+ SYCLLink->getValue() == StringRef("image")))
1275
+ Diag(diag::err_drv_unsupported_opt_removed)
1276
+ << SYCLLink->getAsString(C.getInputArgs());
1244
1277
1245
1278
Arg *DeviceCodeSplit =
1246
1279
C.getInputArgs().getLastArg(options::OPT_fsycl_device_code_split_EQ);
@@ -1268,7 +1301,7 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
1268
1301
getArgRequiringSYCLRuntime(options::OPT_fsycl_force_target_EQ);
1269
1302
if (SYCLForceTarget) {
1270
1303
StringRef Val(SYCLForceTarget->getValue());
1271
- llvm::Triple TT(getSYCLDeviceTriple(Val));
1304
+ llvm::Triple TT(getSYCLDeviceTriple(Val, SYCLForceTarget ));
1272
1305
if (!isValidSYCLTriple(TT))
1273
1306
Diag(clang::diag::err_drv_invalid_sycl_target) << Val;
1274
1307
}
@@ -2730,7 +2763,6 @@ void Driver::PrintHelp(bool ShowHidden) const {
2730
2763
VisibilityMask);
2731
2764
}
2732
2765
2733
-
2734
2766
// Print the help from any of the given tools which are used for AOT
2735
2767
// compilation for SYCL
2736
2768
void Driver::PrintSYCLToolHelp(const Compilation &C) const {
@@ -2743,9 +2775,12 @@ void Driver::PrintSYCLToolHelp(const Compilation &C) const {
2743
2775
if (AV == "gen" || AV == "all")
2744
2776
HelpArgs.push_back(std::make_tuple(getSYCLDeviceTriple("spir64_gen"),
2745
2777
"ocloc", "--help", ""));
2746
- if (AV == "fpga" || AV == "all")
2778
+ if (AV == "fpga") {
2779
+ Diag(diag::err_drv_unsupported_opt_removed)
2780
+ << A->getSpelling().str() + AV.str();
2747
2781
HelpArgs.push_back(std::make_tuple(getSYCLDeviceTriple("spir64_fpga"),
2748
2782
"aoc", "-help", "-sycl"));
2783
+ }
2749
2784
if (AV == "x86_64" || AV == "all")
2750
2785
HelpArgs.push_back(std::make_tuple(getSYCLDeviceTriple("spir64_x86_64"),
2751
2786
"opencl-aot", "--help", ""));
@@ -4003,9 +4038,9 @@ bool Driver::checkForSYCLDefaultDevice(Compilation &C,
4003
4038
4004
4039
// Do not do the check if the default device is passed in -fsycl-targets
4005
4040
// or if -fsycl-targets isn't passed (that implies default device)
4006
- if (const Arg *A = Args.getLastArg (options::OPT_fsycl_targets_EQ)) {
4041
+ if (const Arg *A = Args.getLastArgNoClaim (options::OPT_fsycl_targets_EQ)) {
4007
4042
for (const char *Val : A->getValues()) {
4008
- llvm::Triple TT(C.getDriver().getSYCLDeviceTriple(Val));
4043
+ llvm::Triple TT(C.getDriver().getSYCLDeviceTriple(Val, A ));
4009
4044
if ((TT.isSPIROrSPIRV()) && TT.getSubArch() == llvm::Triple::NoSubArch)
4010
4045
// Default triple found
4011
4046
return false;
@@ -6652,7 +6687,8 @@ class OffloadingActionBuilder final {
6652
6687
continue;
6653
6688
}
6654
6689
6655
- llvm::Triple TT(C.getDriver().getSYCLDeviceTriple(Val));
6690
+ llvm::Triple TT(
6691
+ C.getDriver().getSYCLDeviceTriple(Val, SYCLTargetsValues));
6656
6692
std::string NormalizedName = TT.normalize();
6657
6693
6658
6694
// Make sure we don't have a duplicate triple.
0 commit comments