-
Notifications
You must be signed in to change notification settings - Fork 768
[SYCL] Embed bfloat16 devicelib into executable if necessary #16729
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
Conversation
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
Co-authored-by: Steffen Larsen <[email protected]>
…mbed_bf16_devicelib_spv
Hi, @mdtoguchi |
Hi, @maksimsab |
Signed-off-by: jinge90 <[email protected]>
Hi, @maksimsab |
; CHECK-BF16: [SYCL/imported symbols] | ||
; CHECK-BF16-NEXT: __devicelib_ConvertFToBF16INTEL | ||
|
||
%"class.sycl::_V1::id" = type { %"class.sycl::_V1::detail::array" } |
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.
Please, remove all unnecessary instructions, attributes and metadata.
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.
Hi, @maksimsab
Done.
Thanks very much!
@@ -751,7 +794,7 @@ bool isTargetCompatibleWithModule(const std::string &Target, | |||
} | |||
|
|||
std::vector<std::unique_ptr<util::SimpleTable>> | |||
processInputModule(std::unique_ptr<Module> M) { | |||
processInputModule(std::unique_ptr<Module> M, LLVMContext &Context) { |
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.
No need for LLVMContext
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.
Hi, @maksimsab
Done.
Thanks for the careful review.
@@ -775,3 +752,44 @@ uint32_t llvm::getSYCLDeviceLibReqMask(const Module &M) { | |||
} | |||
return ReqMask; | |||
} | |||
|
|||
static llvm::SmallVector<const char *, 14> BF16DeviceLibFuncs = { |
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.
Please, use static llvm::SmallVector<StringRef, 14>
.
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.
Hi, @maksimsab
Done.
Thanks very much!
Signed-off-by: jinge90 <[email protected]>
Signed-off-by: jinge90 <[email protected]>
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.
LGTM.
Hi, @intel/llvm-gatekeepers |
Incorporates recent changes to `sycl-post-link` into the RTC-specific version: - #16729 - #16236 - #17211 --------- Signed-off-by: Julian Oppermann <[email protected]>
…ion (#18023) As agreement in #16729 , In general we discourage the use of the extension strings as it is a remnant of the OpenCL days. Instead we want to use urDeviceGetInfo when possible. This is a follow-up pr to replace checking OpenCL extension string with urGetDeviceInfo for native bfloat16 conversion extension. --------- Signed-off-by: jinge90 <[email protected]> Co-authored-by: Steffen Larsen <[email protected]>
Currently, sycl bfloat16 conversion functions are implemented in 2 devicelib spvs(fallback version and native version).
The native version targets for any platform which supports "cl_intel_bfloat16_conversions" extension and fallback version is used for all other platforms.
SYCL runtime will select the bfloat16 spvs during execution time by checking bfloat16 extension.
The design requires us to ship 2 spv files together with sycl runtime which some users may dislike.
The PR uses sycl dynamic library mechanism to re-implement this behavior. These 2 bfloat16 lib files are regarded as dynamic library and embedded to final executable, so we don't need to ship any bfloat16 spv libs.
The PR consists following changes:
Fallback and native version of bfloat16 devicelib files have exactly same exported functions, we add a new metadata("SYCL_DEVICELIB_BF16_TYPE") to indicate the version in them. SYCL runtime will check cl_intel_bfloat16_conversions extension and this metadata to decide which version will be linked.