@@ -545,26 +545,35 @@ void RocmInstallationDetector::AddHIPIncludeArgs(const ArgList &DriverArgs,
545
545
}
546
546
547
547
const auto HandleHipStdPar = [=, &DriverArgs, &CC1Args]() {
548
- if (!hasHIPStdParLibrary ()) {
549
- D.Diag (diag::err_drv_no_hipstdpar_lib);
550
- return ;
551
- }
552
- if (!HasRocThrustLibrary &&
553
- !D.getVFS ().exists (getIncludePath () + " /thrust" )) {
548
+ StringRef Inc = getIncludePath ();
549
+ auto &FS = D.getVFS ();
550
+
551
+ if (!hasHIPStdParLibrary ())
552
+ if (!HIPStdParPathArg.empty () ||
553
+ !FS.exists (Inc + " /thrust/system/hip/hipstdpar/hipstdpar_lib.hpp" )) {
554
+ D.Diag (diag::err_drv_no_hipstdpar_lib);
555
+ return ;
556
+ }
557
+ if (!HasRocThrustLibrary && !FS.exists (Inc + " /thrust" )) {
554
558
D.Diag (diag::err_drv_no_hipstdpar_thrust_lib);
555
559
return ;
556
560
}
557
- if (!HasRocPrimLibrary &&
558
- !D.getVFS ().exists (getIncludePath () + " /rocprim" )) {
561
+ if (!HasRocPrimLibrary && !FS.exists (Inc + " /rocprim" )) {
559
562
D.Diag (diag::err_drv_no_hipstdpar_prim_lib);
560
563
return ;
561
564
}
562
-
563
565
const char *ThrustPath;
564
566
if (HasRocThrustLibrary)
565
567
ThrustPath = DriverArgs.MakeArgString (HIPRocThrustPathArg);
566
568
else
567
- ThrustPath = DriverArgs.MakeArgString (getIncludePath () + " /thrust" );
569
+ ThrustPath = DriverArgs.MakeArgString (Inc + " /thrust" );
570
+
571
+ const char *HIPStdParPath;
572
+ if (hasHIPStdParLibrary ())
573
+ HIPStdParPath = DriverArgs.MakeArgString (HIPStdParPathArg);
574
+ else
575
+ HIPStdParPath = DriverArgs.MakeArgString (StringRef (ThrustPath) +
576
+ " /system/hip/hipstdpar" );
568
577
569
578
const char *PrimPath;
570
579
if (HasRocPrimLibrary)
@@ -573,8 +582,8 @@ void RocmInstallationDetector::AddHIPIncludeArgs(const ArgList &DriverArgs,
573
582
PrimPath = DriverArgs.MakeArgString (getIncludePath () + " /rocprim" );
574
583
575
584
CC1Args.append ({" -idirafter" , ThrustPath, " -idirafter" , PrimPath,
576
- " -idirafter" , DriverArgs. MakeArgString (HIPStdParPathArg) ,
577
- " -include " , " hipstdpar_lib.hpp" });
585
+ " -idirafter" , HIPStdParPath, " -include " ,
586
+ " hipstdpar_lib.hpp" });
578
587
};
579
588
580
589
if (DriverArgs.hasArg (options::OPT_nogpuinc)) {
0 commit comments