@@ -97,8 +97,8 @@ void SYCL::constructLLVMForeachCommand(Compilation &C, const JobAction &JA,
9797 std::unique_ptr<Command> InputCommand,
9898 const InputInfoList &InputFiles,
9999 const InputInfo &Output, const Tool *T,
100- StringRef Increment,
101- StringRef Ext = " out " ) {
100+ StringRef Increment, StringRef Ext,
101+ StringRef ParallelJobs ) {
102102 // Construct llvm-foreach command.
103103 // The llvm-foreach command looks like this:
104104 // llvm-foreach --in-file-list=a.list --in-replace='{}' -- echo '{}'
@@ -120,6 +120,9 @@ void SYCL::constructLLVMForeachCommand(Compilation &C, const JobAction &JA,
120120 if (!Increment.empty ())
121121 ForeachArgs.push_back (
122122 C.getArgs ().MakeArgString (" --out-increment=" + Increment));
123+ if (!ParallelJobs.empty ())
124+ ForeachArgs.push_back (C.getArgs ().MakeArgString (" --jobs=" + ParallelJobs));
125+
123126 ForeachArgs.push_back (C.getArgs ().MakeArgString (" --" ));
124127 ForeachArgs.push_back (
125128 C.getArgs ().MakeArgString (InputCommand->getExecutable ()));
@@ -392,10 +395,12 @@ void SYCL::fpga::BackendCompiler::constructOpenCLAOTCommand(
392395 const char *Exec = C.getArgs ().MakeArgString (ExecPath);
393396 auto Cmd = std::make_unique<Command>(JA, *this , ResponseFileSupport::None (),
394397 Exec, CmdArgs, None);
395- if (!ForeachInputs.empty ())
398+ if (!ForeachInputs.empty ()) {
399+ StringRef ParallelJobs =
400+ Args.getLastArgValue (options::OPT_fsycl_max_parallel_jobs_EQ);
396401 constructLLVMForeachCommand (C, JA, std::move (Cmd), ForeachInputs, Output,
397- this , " " , ForeachExt);
398- else
402+ this , " " , ForeachExt, ParallelJobs );
403+ } else
399404 C.addCommand (std::move (Cmd));
400405}
401406
@@ -557,10 +562,12 @@ void SYCL::fpga::BackendCompiler::ConstructJob(
557562 auto Cmd = std::make_unique<Command>(JA, *this , ResponseFileSupport::None (),
558563 Exec, CmdArgs, None);
559564 addFPGATimingDiagnostic (Cmd, C);
560- if (!ForeachInputs.empty ())
565+ if (!ForeachInputs.empty ()) {
566+ StringRef ParallelJobs =
567+ Args.getLastArgValue (options::OPT_fsycl_max_parallel_jobs_EQ);
561568 constructLLVMForeachCommand (C, JA, std::move (Cmd), ForeachInputs, Output,
562- this , ReportOptArg, ForeachExt);
563- else
569+ this , ReportOptArg, ForeachExt, ParallelJobs );
570+ } else
564571 C.addCommand (std::move (Cmd));
565572}
566573
@@ -596,10 +603,12 @@ void SYCL::gen::BackendCompiler::ConstructJob(Compilation &C,
596603 const char *Exec = C.getArgs ().MakeArgString (ExecPath);
597604 auto Cmd = std::make_unique<Command>(JA, *this , ResponseFileSupport::None (),
598605 Exec, CmdArgs, None);
599- if (!ForeachInputs.empty ())
606+ if (!ForeachInputs.empty ()) {
607+ StringRef ParallelJobs =
608+ Args.getLastArgValue (options::OPT_fsycl_max_parallel_jobs_EQ);
600609 constructLLVMForeachCommand (C, JA, std::move (Cmd), ForeachInputs, Output,
601- this , " " );
602- else
610+ this , " " , " out " , ParallelJobs );
611+ } else
603612 C.addCommand (std::move (Cmd));
604613}
605614
@@ -629,10 +638,12 @@ void SYCL::x86_64::BackendCompiler::ConstructJob(
629638 const char *Exec = C.getArgs ().MakeArgString (ExecPath);
630639 auto Cmd = std::make_unique<Command>(JA, *this , ResponseFileSupport::None (),
631640 Exec, CmdArgs, None);
632- if (!ForeachInputs.empty ())
641+ if (!ForeachInputs.empty ()) {
642+ StringRef ParallelJobs =
643+ Args.getLastArgValue (options::OPT_fsycl_max_parallel_jobs_EQ);
633644 constructLLVMForeachCommand (C, JA, std::move (Cmd), ForeachInputs, Output,
634- this , " " );
635- else
645+ this , " " , " out " , ParallelJobs );
646+ } else
636647 C.addCommand (std::move (Cmd));
637648}
638649
0 commit comments