@@ -10353,33 +10353,48 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
10353
10353
assert (JA.getInputs ().size () == Inputs.size () &&
10354
10354
" Not have inputs for all dependence actions??" );
10355
10355
10356
- // For FPGA, we wrap the host objects before archiving them when using
10357
- // -fsycl-link. This allows for better extraction control from the
10358
- // archive when we need the host objects for subsequent compilations.
10359
10356
if (OffloadingKind == Action::OFK_None &&
10360
- C.getArgs ().hasArg (options::OPT_fintelfpga) &&
10361
10357
C.getArgs ().hasArg (options::OPT_fsycl_link_EQ)) {
10362
10358
10363
- // Add offload targets and inputs.
10364
- CmdArgs.push_back (C.getArgs ().MakeArgString (
10365
- Twine (" -kind=" ) + Action::GetOffloadKindName (OffloadingKind)));
10366
- CmdArgs.push_back (
10367
- TCArgs.MakeArgString (Twine (" -target=" ) + Triple.getTriple ()));
10359
+ // For FPGA, we wrap the host objects before archiving them when using
10360
+ // -fsycl-link. This allows for better extraction control from the
10361
+ // archive when we need the host objects for subsequent compilations.
10362
+ if (C.getArgs ().hasArg (options::OPT_fintelfpga)) {
10368
10363
10369
- if (Inputs[0 ].getType () == types::TY_Tempfiletable ||
10370
- Inputs[0 ].getType () == types::TY_Tempfilelist)
10371
- // Input files are passed via the batch job file table.
10372
- CmdArgs.push_back (C.getArgs ().MakeArgString (" -batch" ));
10364
+ // Add offload targets and inputs.
10365
+ CmdArgs.push_back (C.getArgs ().MakeArgString (
10366
+ Twine (" -kind=" ) + Action::GetOffloadKindName (OffloadingKind)));
10367
+ CmdArgs.push_back (
10368
+ TCArgs.MakeArgString (Twine (" -target=" ) + Triple.getTriple ()));
10373
10369
10374
- // Add input.
10375
- assert (Inputs[0 ].isFilename () && " Invalid input." );
10376
- CmdArgs.push_back (TCArgs.MakeArgString (Inputs[0 ].getFilename ()));
10370
+ if (Inputs[0 ].getType () == types::TY_Tempfiletable ||
10371
+ Inputs[0 ].getType () == types::TY_Tempfilelist)
10372
+ // Input files are passed via the batch job file table.
10373
+ CmdArgs.push_back (C.getArgs ().MakeArgString (" -batch" ));
10377
10374
10378
- C.addCommand (std::make_unique<Command>(
10379
- JA, *this , ResponseFileSupport::None (),
10380
- TCArgs.MakeArgString (getToolChain ().GetProgramPath (getShortName ())),
10381
- CmdArgs, Inputs));
10382
- return ;
10375
+ // Add input.
10376
+ assert (Inputs[0 ].isFilename () && " Invalid input." );
10377
+ CmdArgs.push_back (TCArgs.MakeArgString (Inputs[0 ].getFilename ()));
10378
+
10379
+ C.addCommand (std::make_unique<Command>(
10380
+ JA, *this , ResponseFileSupport::None (),
10381
+ TCArgs.MakeArgString (getToolChain ().GetProgramPath (getShortName ())),
10382
+ CmdArgs, Inputs));
10383
+ return ;
10384
+ } else {
10385
+ // When compiling and linking separately, we need to propagate the
10386
+ // compression related CLI options to offload-wrapper. Don't propagate
10387
+ // these options when wrapping objects for FPGA.
10388
+ if (C.getInputArgs ().getLastArg (options::OPT_offload_compress)) {
10389
+ CmdArgs.push_back (
10390
+ C.getArgs ().MakeArgString (Twine (" -offload-compress" )));
10391
+ // -offload-compression-level=<>
10392
+ if (Arg *A = C.getInputArgs ().getLastArg (
10393
+ options::OPT_offload_compression_level_EQ))
10394
+ CmdArgs.push_back (C.getArgs ().MakeArgString (
10395
+ Twine (" -offload-compression-level=" ) + A->getValue ()));
10396
+ }
10397
+ }
10383
10398
}
10384
10399
10385
10400
// Add offload targets and inputs.
0 commit comments