@@ -9905,26 +9905,6 @@ void OffloadBundler::ConstructJob(Compilation &C, const JobAction &JA,
99059905 const ToolChain *CurTC = &getToolChain ();
99069906 const Action *CurDep = JA.getInputs ()[I];
99079907
9908- // Special handling for FPGA AOC[RX] binaries that are bundled prior to
9909- // being added to the generated archive.
9910- llvm::Triple Triple = CurTC->getTriple ();
9911- bool IsFPGA = Triple.isSPIR () &&
9912- Triple.getSubArch () == llvm::Triple::SPIRSubArch_fpga;
9913- Arg *A = TCArgs.getLastArg (options::OPT_fsycl_link_EQ);
9914- if (A && IsFPGA) {
9915- bool IsFPGAImage = false ;
9916- IsFPGAImage = A->getValue () == StringRef (" image" );
9917- if (Inputs.size () == 1 ) {
9918- Triples += Action::GetOffloadKindName (CurKind);
9919- Triples += " -fpga_" ;
9920- Triples += IsFPGAImage ? " aocx" : " aocr" ;
9921- if (!IsFPGAImage && !C.getDriver ().IsFPGAHWMode ())
9922- Triples += " _emu" ;
9923- Triples += " -intel-unknown" ;
9924- continue ;
9925- }
9926- }
9927-
99289908 if (const auto *OA = dyn_cast<OffloadAction>(CurDep)) {
99299909 CurTC = nullptr ;
99309910 OA->doOnEachDependence ([&](Action *A, const ToolChain *TC, const char *) {
@@ -10073,112 +10053,43 @@ void OffloadBundler::ConstructJobMultipleOutputs(
1007310053 const char *InputFileName = Input.getFilename ();
1007410054 types::ID InputType (Input.getType ());
1007510055 bool IsFPGADepUnbundle = JA.getType () == types::TY_FPGA_Dependencies;
10076- bool IsFPGADepLibUnbundle = JA.getType () == types::TY_FPGA_Dependencies_List;
1007710056 InputInfoList ForeachInputs;
1007810057 if (InputType == types::TY_Tempfilelist)
1007910058 ForeachInputs.push_back (Input);
10080-
10081- if (InputType == types::TY_FPGA_AOCX || InputType == types::TY_FPGA_AOCR ||
10082- InputType == types::TY_FPGA_AOCR_EMU) {
10083- // Override type with AOCX/AOCR which will unbundle to a list containing
10084- // binaries with the appropriate extension (.aocx/.aocr)
10085- // TODO - representation of the output file from the unbundle for these
10086- // types (aocx/aocr) are always list files. We should represent this
10087- // better in the output extension and type for improved understanding
10088- // of file contents and debuggability.
10089- TypeArg = (InputType == types::TY_FPGA_AOCX) ? " aocx" : " aocr" ;
10090- // When the output is a Tempfilelist, we know we are unbundling
10091- // the .bc files from the archive.
10092- if (!getToolChain ().getTriple ().isSPIROrSPIRV () ||
10093- JA.getType () == types::TY_Tempfilelist)
10094- TypeArg = " aoo" ;
10095- }
10096- if (InputType == types::TY_FPGA_AOCO || IsFPGADepLibUnbundle)
10097- TypeArg = " aoo" ;
1009810059 if (IsFPGADepUnbundle)
1009910060 TypeArg = " o" ;
1010010061
1010110062 bool HasSPIRTarget = false ;
10102- bool HasFPGATarget = false ;
1010310063 auto SYCLTCRange = C.getOffloadToolChains <Action::OFK_SYCL>();
1010410064 for (auto TI = SYCLTCRange.first , TE = SYCLTCRange.second ; TI != TE; ++TI) {
1010510065 llvm::Triple TT (TI->second ->getTriple ());
10106- if (TT.isSPIROrSPIRV ()) {
10066+ if (TT.isSPIROrSPIRV ())
1010710067 HasSPIRTarget = true ;
10108- if (TT.getSubArch () == llvm::Triple::SPIRSubArch_fpga)
10109- HasFPGATarget = true ;
10110- }
1011110068 }
1011210069 if (InputType == types::TY_Archive && HasSPIRTarget)
1011310070 TypeArg = " aoo" ;
1011410071
1011510072 // Get the type.
1011610073 CmdArgs.push_back (TCArgs.MakeArgString (Twine (" -type=" ) + TypeArg));
1011710074
10118- // For FPGA Archives that contain AOCO in them, we only want to unbundle
10119- // the objects from the archive that do not have AOCO associated in that
10120- // specific object. Only do this when in hardware mode.
10121- if (InputType == types::TY_Archive && HasFPGATarget && !IsFPGADepUnbundle &&
10122- !IsFPGADepLibUnbundle && C.getDriver ().IsFPGAHWMode ()) {
10123- llvm::Triple TT;
10124- TT.setArchName (types::getTypeName (types::TY_FPGA_AOCO));
10125- TT.setVendorName (" intel" );
10126- TT.setOS (getToolChain ().getTriple ().getOS ());
10127- SmallString<128 > ExcludedTargets (" -excluded-targets=" );
10128- ExcludedTargets += " sycl-" ;
10129- ExcludedTargets += TT.normalize ();
10130- CmdArgs.push_back (TCArgs.MakeArgString (ExcludedTargets));
10131- }
10132-
1013310075 // Get the targets.
1013410076 SmallString<128 > Triples;
1013510077 Triples += " -targets=" ;
1013610078 auto DepInfo = UA.getDependentActionsInfo ();
1013710079 for (unsigned I = 0 , J = 0 ; I < DepInfo.size (); ++I) {
1013810080 auto &Dep = DepInfo[I];
10139- // FPGA device triples are 'transformed' for the bundler when creating
10140- // aocx or aocr type bundles. Also, we only do a specific target
10141- // unbundling, skipping the host side or device side.
10142- if (types::isFPGA (InputType) || InputType == types::TY_Tempfilelist) {
10081+ // We only do a specific target unbundling, skipping the host side or
10082+ // device side.
10083+ if (InputType == types::TY_Tempfilelist) {
1014310084 if (getToolChain ().getTriple ().isSPIROrSPIRV ()) {
10144- if (Dep.DependentToolChain ->getTriple ().getSubArch () ==
10145- llvm::Triple::SPIRSubArch_fpga) {
10146- StringRef TypeName (types::getTypeName (InputType));
10147- types::ID Type = UA.getDependentType ();
10148- if (InputType == types::TY_Tempfilelist && Type != types::TY_Nothing)
10149- TypeName = types::getTypeName (Type);
10150- if (J++)
10151- Triples += ' ,' ;
10152- llvm::Triple TT;
10153- TT.setArchName (TypeName);
10154- TT.setVendorName (" intel" );
10155- TT.setOS (getToolChain ().getTriple ().getOS ());
10156- if ((InputType == types::TY_FPGA_AOCX ||
10157- InputType == types::TY_FPGA_AOCR ||
10158- InputType == types::TY_FPGA_AOCR_EMU) &&
10159- JA.getType () == types::TY_Tempfilelist)
10160- // AOCX device and AOCR bc info is bundled in the host kind
10161- Triples += " host-" ;
10162- else
10163- // AOCR device is bundled in the sycl kind
10164- Triples += " sycl-" ;
10165- Triples += TT.normalize ();
10166- continue ;
10167- } else if (Dep.DependentOffloadKind == Action::OFK_Host) {
10168- // No host unbundle for FPGA binaries.
10085+ if (Dep.DependentOffloadKind == Action::OFK_Host)
1016910086 continue ;
10170- }
1017110087 } else if (Dep.DependentOffloadKind == Action::OFK_SYCL)
1017210088 continue ;
10173- } else if (InputType == types::TY_Archive ||
10174- (getToolChain ().getTriple ().getSubArch () ==
10175- llvm::Triple::SPIRSubArch_fpga &&
10176- TCArgs.hasArg (options::OPT_fsycl_link_EQ))) {
10089+ } else if (InputType == types::TY_Archive) {
1017710090 // Do not extract host part if we are unbundling archive on Windows
1017810091 // because it is not needed. Static offload libraries are added to the
10179- // host link command just as normal libraries. Do not extract the host
10180- // part from FPGA -fsycl-link unbundles either, as the full obj
10181- // is used in the final link
10092+ // host link command just as normal libraries.
1018210093 if (Dep.DependentOffloadKind == Action::OFK_Host)
1018310094 continue ;
1018410095 }
@@ -10231,7 +10142,7 @@ void OffloadBundler::ConstructJobMultipleOutputs(
1023110142 Triples += GPUArchName.str ();
1023210143 }
1023310144 }
10234- if (IsFPGADepUnbundle || IsFPGADepLibUnbundle ) {
10145+ if (IsFPGADepUnbundle) {
1023510146 // TODO - We are currently using the target triple inputs to slot a location
1023610147 // of the dependency information into the bundle. It would be good to
1023710148 // separate this out to an explicit option in the bundler for the dependency
@@ -10259,7 +10170,7 @@ void OffloadBundler::ConstructJobMultipleOutputs(
1025910170 // When dealing with -fintelfpga, there is an additional unbundle step
1026010171 // that occurs for the dependency file. In that case, do not use the
1026110172 // dependent information, but just the output file.
10262- if (IsFPGADepUnbundle || IsFPGADepLibUnbundle ) {
10173+ if (IsFPGADepUnbundle) {
1026310174 SmallString<128 > UB;
1026410175 UB += " -output=" ;
1026510176 UB += Outputs[0 ].getFilename ();
@@ -10382,8 +10293,6 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1038210293
1038310294 llvm::Triple TT = getToolChain ().getTriple ();
1038410295 SmallString<128 > TargetTripleOpt = TT.getArchName ();
10385- bool WrapFPGADevice = false ;
10386- bool FPGAEarly = false ;
1038710296
1038810297 // Validate and propogate CLI options related to device image compression.
1038910298 // -offload-compress
@@ -10397,32 +10306,9 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1039710306 Twine (" -offload-compression-level=" ) + A->getValue ()));
1039810307 }
1039910308
10400- if (Arg *A = C.getInputArgs ().getLastArg (options::OPT_fsycl_link_EQ)) {
10401- WrapFPGADevice = true ;
10402- FPGAEarly = (A->getValue () == StringRef (" early" ));
10403- // When wrapping an FPGA aocx binary to archive, do not emit registration
10404- // functions
10405- if (A->getValue () == StringRef (" image" ))
10406- WrapperArgs.push_back (C.getArgs ().MakeArgString (" --emit-reg-funcs=0" ));
10407- }
1040810309 addRunTimeWrapperOpts (C, OffloadingKind, TCArgs, WrapperArgs,
1040910310 getToolChain (), JA);
1041010311
10411- // When wrapping an FPGA device binary, we need to be sure to apply the
10412- // appropriate triple that corresponds (fpga_aocr-intel-<os>)
10413- // to the target triple setting.
10414- if (TT.getSubArch () == llvm::Triple::SPIRSubArch_fpga && WrapFPGADevice) {
10415- SmallString<16 > FPGAArch (" fpga_" );
10416- if (FPGAEarly) {
10417- FPGAArch += " aocr" ;
10418- if (C.getDriver ().IsFPGAEmulationMode ())
10419- FPGAArch += " _emu" ;
10420- } else
10421- FPGAArch += " aocx" ;
10422- TT.setArchName (FPGAArch);
10423- TT.setVendorName (" intel" );
10424- TargetTripleOpt = TT.str ();
10425- }
1042610312 const toolchains::SYCLToolChain &TC =
1042710313 static_cast <const toolchains::SYCLToolChain &>(getToolChain ());
1042810314 bool IsEmbeddedIR = cast<OffloadWrapperJobAction>(JA).isEmbeddedIR ();
@@ -10449,18 +10335,6 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1044910335 WrapperArgs.push_back (
1045010336 C.getArgs ().MakeArgString (Twine (" -kind=" ) + Twine (Kind)));
1045110337
10452- // For FPGA toolchains, we can provide previously wrapped bc input files to
10453- // the wrapper step. This is done for AOCR based files that will need the
10454- // Symbols and Properties from a previous compilation step.
10455- if (TC.getTriple ().isSPIR () && Inputs.size () == 2 &&
10456- TC.getTriple ().getSubArch () == llvm::Triple::SPIRSubArch_fpga) {
10457- // If there is an additional input argument passed in, that is considered
10458- // the .bc file to include in this wrapping job.
10459- const InputInfo &I = Inputs[1 ];
10460- WrapperArgs.push_back (C.getArgs ().MakeArgString (
10461- Twine (" --sym-prop-bc-files=" ) + I.getFilename ()));
10462- }
10463-
1046410338 assert ((Inputs.size () > 0 ) && " no inputs for clang-offload-wrapper" );
1046510339 assert (((Inputs[0 ].getType () != types::TY_Tempfiletable) ||
1046610340 (Inputs.size () == 1 )) &&
0 commit comments