@@ -723,14 +723,19 @@ runSYCLPostLinkTool(ArrayRef<StringRef> InputFiles, const ArgList &Args) {
723723 return SYCLPostLinkPath.takeError ();
724724
725725 // Create a new file to write the output of sycl-post-link to.
726+ const llvm::Triple Triple (Args.getLastArgValue (OPT_triple_EQ));
726727 auto TempFileOrErr =
727728 createOutputFile (sys::path::filename (ExecutableName), " table" );
728729 if (!TempFileOrErr)
729730 return TempFileOrErr.takeError ();
731+ std::string OutputPathWithArch = TempFileOrErr->str ();
732+ StringRef Arch = Args.getLastArgValue (OPT_arch_EQ);
733+ if (Triple.getSubArch () == llvm::Triple::SPIRSubArch_gen && Arch.data ()) {
734+ std::string OutputPathWithArch = " intel_gpu_" + Arch.str () + " ," + OutputPathWithArch;
735+ }
730736
731737 SmallVector<StringRef, 8 > CmdArgs;
732738 CmdArgs.push_back (*SYCLPostLinkPath);
733- const llvm::Triple Triple (Args.getLastArgValue (OPT_triple_EQ));
734739 Arg *SYCLDeviceLibLoc = Args.getLastArg (OPT_sycl_device_library_location_EQ);
735740 if (SYCLDeviceLibLoc && !Triple.isSPIRAOT ()) {
736741 std::string SYCLDeviceLibLocParam = SYCLDeviceLibLoc->getValue ();
@@ -748,7 +753,7 @@ runSYCLPostLinkTool(ArrayRef<StringRef> InputFiles, const ArgList &Args) {
748753 SYCLPostLinkOptions.split (CmdArgs, " " , /* MaxSplit = */ -1 ,
749754 /* KeepEmpty = */ false );
750755 CmdArgs.push_back (" -o" );
751- CmdArgs.push_back (*TempFileOrErr );
756+ CmdArgs.push_back (Args. MakeArgString (OutputPathWithArch) );
752757 for (auto &File : InputFiles)
753758 CmdArgs.push_back (File);
754759 if (Error Err = executeCommands (*SYCLPostLinkPath, CmdArgs))
0 commit comments