-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Link SYCL device libraries by default. #2400
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
[SYCL] Link SYCL device libraries by default. #2400
Conversation
As not all backends have supported spv file online link, we decided to disable fallback spv libraries online link at this time. Instead, all wrapper and fallback .o files will be linked offline. When all backends support spv online link, we will switch to online link for jit compilation transparently. Signed-off-by: gejin <[email protected]>
Hi, @vzakhari and @mdtoguchi |
/summary:run |
…c and libm-fp32 libs are linked by default Signed-off-by: gejin <[email protected]>
…ault_in_aot_style
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[email protected]>
Hi, @mdtoguchi |
/summary:run |
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 for devicelib tests.
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.
Could you add a driver specific test verifying that the various expected device libs are being pulled in for unbundling and use?
Signed-off-by: gejin <[email protected]>
…ault_in_aot_style
/summary:run |
Hi, @mdtoguchi , I have added 2 driver lit tests(Linux + Windows) for "-f[no-]sycl-device-lib" option. Please help review. |
Hi, @vzakhari , I think we can enable the devicelib lit test for GPU platform since the "AOT" style link should work on all backend including those who haven't supported online spv link. The latest patch has enabled GPU. |
/summary:run |
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.
Driver LGTM
…ault_in_aot_style
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[email protected]>
Signed-off-by: gejin <[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.
Thanks - LGTM
Hi, @AGindinson ,@intel/llvm-reviewers-runtime and @pvchupin |
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.
Looks good overall.
Though, I have only a single comment.
// The Level Zero driver support for online linking currently has bugs, but | ||
// we think the DPC++ runtime support is ready. This environment variable | ||
// gates the runtime support for online linking, so we can try enabling if a | ||
// new driver is released before the next DPC++ release. | ||
static bool EnableLevelZeroLink = std::getenv("SYCL_ENABLE_LEVEL_ZERO_LINK"); | ||
if (!EnableLevelZeroLink) { | ||
if (Context->getPlugin().getBackend() == backend::level_zero) { | ||
LinkDeviceLibs = false; | ||
} | ||
} |
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.
Online linking was disabled for Level Zero only. Now it's disabled for each and every backend. Why is that?
Another solution is to enable it for OpenCL backend.
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, @s-kanaev
There are 2 reasons:
-
The device library shouldn't depend on one specific backend to work, our final goal is to make device libraries to have same behavior in all backend. So, we switch to offline link for all backends.
-
Simplifying the usage requires us to make some device libraries to be linked in by default in offline build phase. If we enable devicelib for OCL backend, we must only link "wrapper" obj device libs offline.
However, to make L0 to work, we must link both "wrapper" and "fallback" libraries offline. Unfortunately, we can't know which backend will be used in offline build, so we have to disable all backends and switch back to "online" link transparently when L0 is ready.
Thank you very much.
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 looks like we are reaching the limit of a system if at the end everybody has to align on the intersection of all the features of the back-ends, which converges to the... empty set!
And if the root cause is a political back-end that nobody cares except the people who invented it, I am not super excited about this story jeopardizing all the other back-ends... :-/
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 agree with @keryell that special-casing for particular BEs in the generic SYCL runtime is something which should be avoided. The supposed way to avoid this is to extract the diverging piece of code into a separate function and make it part of the PI interface, hiding all specifics inside the plugin. @jinge90 - I'd suggest to add a TODO at least and maybe file an issue.
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.
Note that this PR removes the code that special-cases the L0 plugin.
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.
Upon second look, it seems nothing level zero-specific is in the patch. LinkDeviceLibs have existed before. But still, would be good to have TODO/issue for BE-specific stuff.
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, @kbobrovs @keryell and @gmlueck
I think all backends including Level zero will support online link, this patch is a temporary solution to make device library to work on all backends with same behaviors. Once all backends are ready, we will switch to "online" link transparently. I will add a "TODO" in another PR.
Thank you very much.
* upstream/sycl: (405 commits) [SYCL] Implement new env var SYCL_DEVICE_FILTER (intel#2239) [Driver][SYCL] Make /MD the default for -fsycl (intel#2478) [SYCL]: basic support of contexts with multiple devices in Level-Zero (intel#2440) [SYCL] Fix LIT regression after 9dd18ca (intel#2481) [SYCL][L0] Kernel Destroy in piKernelRelease (intel#2475) [SYCL] Emit an aliased function only if it is used (intel#2430) [Driver][SYCL] Add defaultlib directive for sycl lib (intel#2464) [Driver][SYCL] Improve situations where .exe is added for AOT tools (intel#2467) [SYCL][L0]: Check Queue refcnt prior to using members in event wait/release (intel#2471) [SYCL] Unroll several loops in __init method accessor class (intel#2449) [SYCL][Doc] Add link to use pinned memory spec (intel#2463) [SYCL] Link SYCL device libraries by default. (intel#2400) Revert "[SYCL] XFAIL test blcoking pulldown" Avoid usage of deprecated "VectorType::getNumElements" (intel#737) Fix nullptr dereference (intel#741) Do not translate arbitrary precision operations without corresponding extensions (intel#714) Add Constrained Floating-Point Intrinsics support [SYCL] Take into account auxiliary cmake options for Level Zero loader [InstCombine] improve fold of pointer differences [InstCombine] add ptr difference tests; NFC ...
Revert "Add new launch property to support work_group_scratch_memory"
As not all backends have supported spv file online link, we decided to
disable fallback spv libraries online link at this time. Instead, all
wrapper and fallback .o files will be linked offline. When all backends
support spv online link, we will switch to online link for jit compilation
transparently.
Signed-off-by: gejin [email protected]