-
Notifications
You must be signed in to change notification settings - Fork 790
[Driver][SYCL] Improve integration header usage when performing offload #3471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
315a535
2bae7b4
9e5c4a4
b4ae4ce
d26d93a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3854,17 +3854,10 @@ class OffloadingActionBuilder final { | |
} | ||
} | ||
|
||
// FIXME: This adds the integration header generation pass before the | ||
// Host compilation pass so the Host can use the header generated. This | ||
// can be improved upon to where the header generation and spv generation | ||
// is done in the same step. Currently, its not too efficient. | ||
// The host depends on the generated integrated header from the device | ||
// compilation. | ||
// Device compilation generates LLVM BC. | ||
if (CurPhase == phases::Compile) { | ||
bool SYCLDeviceOnly = Args.hasArg(options::OPT_fsycl_device_only); | ||
for (Action *&A : SYCLDeviceActions) { | ||
DeviceCompilerInput = | ||
C.MakeAction<CompileJobAction>(A, types::TY_SYCL_Header); | ||
types::ID OutputType = types::TY_LLVM_BC; | ||
if (SYCLDeviceOnly) { | ||
if (Args.hasArg(options::OPT_S)) | ||
|
@@ -3879,6 +3872,7 @@ class OffloadingActionBuilder final { | |
} | ||
} | ||
A = C.MakeAction<CompileJobAction>(A, OutputType); | ||
DeviceCompilerInput = A; | ||
} | ||
const auto *TC = ToolChains.front(); | ||
const char *BoundArch = nullptr; | ||
|
@@ -5113,6 +5107,21 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args, | |
|
||
handleArguments(C, Args, Inputs, Actions); | ||
|
||
// When compiling for -fsycl, generate the integration header files that | ||
// will be used during the compilation. | ||
if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be also working when using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
for (auto &I : Inputs) { | ||
if (!types::isSrcFile(I.first)) | ||
continue; | ||
std::string SrcFileName(I.second->getAsString(Args)); | ||
std::string TmpFileNameHeader = C.getDriver().GetTemporaryPath( | ||
llvm::sys::path::stem(SrcFileName).str() + "-header", "h"); | ||
StringRef TmpFileHeader = | ||
C.addTempFile(C.getArgs().MakeArgString(TmpFileNameHeader)); | ||
addIntegrationFiles(TmpFileHeader, SrcFileName); | ||
} | ||
} | ||
|
||
// Builder to be used to build offloading actions. | ||
OffloadingActionBuilder OffloadBuilder(C, Args, Inputs); | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.