@@ -100,8 +100,8 @@ void SYCL::constructLLVMForeachCommand(Compilation &C, const JobAction &JA,
100
100
std::unique_ptr<Command> InputCommand,
101
101
const InputInfoList &InputFiles,
102
102
const InputInfo &Output, const Tool *T,
103
- StringRef Increment,
104
- StringRef Ext = " out " ) {
103
+ StringRef Increment, StringRef Ext,
104
+ StringRef ParallelJobs ) {
105
105
// Construct llvm-foreach command.
106
106
// The llvm-foreach command looks like this:
107
107
// llvm-foreach --in-file-list=a.list --in-replace='{}' -- echo '{}'
@@ -123,6 +123,9 @@ void SYCL::constructLLVMForeachCommand(Compilation &C, const JobAction &JA,
123
123
if (!Increment.empty ())
124
124
ForeachArgs.push_back (
125
125
C.getArgs ().MakeArgString (" --out-increment=" + Increment));
126
+ if (!ParallelJobs.empty ())
127
+ ForeachArgs.push_back (C.getArgs ().MakeArgString (" --jobs=" + ParallelJobs));
128
+
126
129
ForeachArgs.push_back (C.getArgs ().MakeArgString (" --" ));
127
130
ForeachArgs.push_back (
128
131
C.getArgs ().MakeArgString (InputCommand->getExecutable ()));
@@ -395,10 +398,12 @@ void SYCL::fpga::BackendCompiler::constructOpenCLAOTCommand(
395
398
const char *Exec = C.getArgs ().MakeArgString (ExecPath);
396
399
auto Cmd = std::make_unique<Command>(JA, *this , ResponseFileSupport::None (),
397
400
Exec, CmdArgs, None);
398
- if (!ForeachInputs.empty ())
401
+ if (!ForeachInputs.empty ()) {
402
+ StringRef ParallelJobs =
403
+ Args.getLastArgValue (options::OPT_fsycl_parallel_jobs_EQ);
399
404
constructLLVMForeachCommand (C, JA, std::move (Cmd), ForeachInputs, Output,
400
- this , " " , ForeachExt);
401
- else
405
+ this , " " , ForeachExt, ParallelJobs );
406
+ } else
402
407
C.addCommand (std::move (Cmd));
403
408
}
404
409
@@ -560,10 +565,12 @@ void SYCL::fpga::BackendCompiler::ConstructJob(
560
565
auto Cmd = std::make_unique<Command>(JA, *this , ResponseFileSupport::None (),
561
566
Exec, CmdArgs, None);
562
567
addFPGATimingDiagnostic (Cmd, C);
563
- if (!ForeachInputs.empty ())
568
+ if (!ForeachInputs.empty ()) {
569
+ StringRef ParallelJobs =
570
+ Args.getLastArgValue (options::OPT_fsycl_parallel_jobs_EQ);
564
571
constructLLVMForeachCommand (C, JA, std::move (Cmd), ForeachInputs, Output,
565
- this , ReportOptArg, ForeachExt);
566
- else
572
+ this , ReportOptArg, ForeachExt, ParallelJobs );
573
+ } else
567
574
C.addCommand (std::move (Cmd));
568
575
}
569
576
@@ -599,10 +606,12 @@ void SYCL::gen::BackendCompiler::ConstructJob(Compilation &C,
599
606
const char *Exec = C.getArgs ().MakeArgString (ExecPath);
600
607
auto Cmd = std::make_unique<Command>(JA, *this , ResponseFileSupport::None (),
601
608
Exec, CmdArgs, None);
602
- if (!ForeachInputs.empty ())
609
+ if (!ForeachInputs.empty ()) {
610
+ StringRef ParallelJobs =
611
+ Args.getLastArgValue (options::OPT_fsycl_parallel_jobs_EQ);
603
612
constructLLVMForeachCommand (C, JA, std::move (Cmd), ForeachInputs, Output,
604
- this , " " );
605
- else
613
+ this , " " , " out " , ParallelJobs );
614
+ } else
606
615
C.addCommand (std::move (Cmd));
607
616
}
608
617
@@ -632,10 +641,12 @@ void SYCL::x86_64::BackendCompiler::ConstructJob(
632
641
const char *Exec = C.getArgs ().MakeArgString (ExecPath);
633
642
auto Cmd = std::make_unique<Command>(JA, *this , ResponseFileSupport::None (),
634
643
Exec, CmdArgs, None);
635
- if (!ForeachInputs.empty ())
644
+ if (!ForeachInputs.empty ()) {
645
+ StringRef ParallelJobs =
646
+ Args.getLastArgValue (options::OPT_fsycl_parallel_jobs_EQ);
636
647
constructLLVMForeachCommand (C, JA, std::move (Cmd), ForeachInputs, Output,
637
- this , " " );
638
- else
648
+ this , " " , " out " , ParallelJobs );
649
+ } else
639
650
C.addCommand (std::move (Cmd));
640
651
}
641
652
0 commit comments