-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] default context as default on windows #12599
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] default context as default on windows #12599
Conversation
…t work well on Windows with the default context enabled.
✅ With the latest revision this PR passed the Python code formatter. |
✅ With the latest revision this PR passed the C/C++ code formatter. |
…ced it when resolving merge conflicts. Removing it from this PR
#else | ||
// Windows does not maintain dependencies between dynamically loaded libraries | ||
// and can unload SYCL runtime dependencies before sycl.dll's DllMain has | ||
// finished. To avoid calls to nowhere, intentionally leak platform to device | ||
// cache. This will prevent destructors from being called, thus no PI cleanup | ||
// routines will be called in the end. | ||
// Update: the pi_win_proxy_loader addresses this for SYCL's own dependencies, | ||
// but the GPU device dlls seem to manually load yet another DLL which may | ||
// have been released when this function is called. So we still release() and | ||
// leak until that is addressed. context destructs fine on CPU device. | ||
MPlatformToDefaultContextCache.Inst.release(); | ||
#endif |
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.
Do I get it right that you have to modify all the tests because this workaround is removed? Do we have to remove it to make default context as default?
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.
This workaround (or not) has no bearing on the leak check itself. If Windows uses a default context, the leak check races and may report leaks. If Windows does not use a default context, it doesn't.
But the call here to .release() vs. .reset() DOES determine whether the default context (if one exists) ACTUALLY leaks or not. We want .reset() so that it is actually destroyed, otherwise it leaks.
And we want the behavior Lin vs Win to the same ( as much as we can manage ) so it is easier to think about.
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.
UR LGTM
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.
Sycl-Graph LGTM
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.
sycl/test-e2e/Graph/RecordReplay/usm_memset_shortcut.cpp
which just merged in #12508 will need UR_L0_LEAKS_DEBUG=1
updated too
@intel/sycl-graphs-reviewers - ping for review. This touches the //RUN directive of many of your tests, but just changing the LEAK check to a placeholder. |
Now that there have been improvements to Windows shutdown made by the proxy loader, host task handling, and the unified runtime, we are finally able to have Windows support a "default" context. This makes any routine that loops over queue creation, etc perform much faster.
Note that on Windows the UR L0 Leak check does not work correctly with the default contexts on Windows. This is because on Windows the release of the plugin DLLs races against the release of static global variables (like the default context). This has been reported.
The tests that use this feature have been modified to use a new
%{l0_leak_check}
substitution that will NOT use default context on Windows.