-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[SYCL] Add offload wrapping for SYCL kind. #147508
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 10 commits
524da07
e19602e
eee8b0f
0669663
cefdefc
8d80041
262e39a
fee98af
53b5a95
c17682b
ad141aa
20e54a1
ca63663
f6e98a0
700fd4a
c636b33
5f1eee1
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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -13,6 +13,8 @@ | |||||||||
#include "llvm/IR/Module.h" | ||||||||||
#include "llvm/Support/Compiler.h" | ||||||||||
|
||||||||||
#include <string> | ||||||||||
|
||||||||||
namespace llvm { | ||||||||||
namespace offloading { | ||||||||||
using EntryArrayTy = std::pair<GlobalVariable *, GlobalVariable *>; | ||||||||||
|
@@ -52,6 +54,23 @@ LLVM_ABI llvm::Error wrapHIPBinary(llvm::Module &M, llvm::ArrayRef<char> Images, | |||||||||
EntryArrayTy EntryArray, | ||||||||||
llvm::StringRef Suffix = "", | ||||||||||
bool EmitSurfacesAndTextures = true); | ||||||||||
|
||||||||||
struct SYCLWrappingOptions { | ||||||||||
|
struct SYCLWrappingOptions { | |
struct SYCLJITOptions { |
Or maybe even just "JITOptions". These are specific to the device code format rather than a programming model. If we use some intermediate representation (e.g. SPIR-V), which just be compiled to the executable format, these options are useful to configure the runtime compilation step.
@sarnex, does OpenMP offload to SPIR-V compiler allows setting JIT compiler options? If so, I think this structure should have a neutral name like "JITOptions" and re-used by different offloading modes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's supported and the generated device ELF contains it but I didn't hook it up to anything from the driver yet, see here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit that can be addressed in follow-up pr, this comment might be clearer, these options arent really a suggestion, they must be passed to the gpu driver
// Target/compiler specific options that are suggested to use to "compile" | |
// program at runtime. | |
// Target/compiler specific options that are passed to the device compiler | |
// at runtime. |
maksimsab marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,8 @@ LLVM_ABI StructType *getEntryTy(Module &M); | |
/// \param Data Extra data storage associated with the entry. | ||
/// \param SectionName The section this entry will be placed at. | ||
/// \param AuxAddr An extra pointer if needed. | ||
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. can we explain what this means more? when do we need it |
||
LLVM_ABI void | ||
/// \return The emitted global variable containing the offloading entry. | ||
LLVM_ABI GlobalVariable * | ||
emitOffloadingEntry(Module &M, object::OffloadKind Kind, Constant *Addr, | ||
StringRef Name, uint64_t Size, uint32_t Flags, | ||
uint64_t Data, Constant *AuxAddr = nullptr, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just copied from OpenMP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUN
lines are copied from OpenMP and adjusted to SYCL case. Output's checks are copied from theclang-linker-wrapper
's output.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'm just wondering why everything's called
tgt_bin_desc
and similar.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, we customized old
clang-offload-wrapper
and then we extracted SYCL logic in a separate place. That is how these names stuck with us.