-
Notifications
You must be signed in to change notification settings - Fork 798
[SYCL] fix for __sycl_unregister_lib() on Windows and tests #19633
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
base: sycl
Are you sure you want to change the base?
[SYCL] fix for __sycl_unregister_lib() on Windows and tests #19633
Conversation
Signed-off-by: Chris Perkins <[email protected]>
Signed-off-by: Chris Perkins <[email protected]>
Signed-off-by: Chris Perkins <[email protected]>
Signed-off-by: Chris Perkins <[email protected]>
PVC failures is unrelated: #19662 |
Signed-off-by: Chris Perkins <[email protected]>
Signed-off-by: Chris Perkins <[email protected]>
// DEFINE: %{shared_lib_ext} = %if windows %{dll%} %else %{so%} | ||
|
||
// clang-format off | ||
// IMPORTANT -DSO_PATH='R"(%T)"' WTF ?? |
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.
// IMPORTANT -DSO_PATH='R"(%T)"' WTF ?? | |
// IMPORTANT -DSO_PATH='R"(%T)"' |
// Because on Windows, the path delimiters are \, | ||
// which C++ preprocessor converts to escape sequences, | ||
// which becomes a nightmare. | ||
// SO the hack here is to put heredoc in the definition |
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.
// SO the hack here is to put heredoc in the definition | |
// So the hack here is to put heredoc in the definition |
// UNSUPPORTED: cuda || hip | ||
// UNSUPPORTED-TRACKER: CMPLRLLVM-69415 | ||
|
||
// REQUIRES: level_zero |
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.
Should we remove "REQUIRES: level_zero"? It looks like test is supposed to work on OpenCL backend as well.
If you want to additionally check leaks on level_zero backend, then probably something like this should be done:
// RUN: %if level_zero %{%{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK %}
RegBuilder.CreateRetVoid(); | ||
|
||
// Add this function to global destructors. | ||
// Match priority of __tgt_register_lib |
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.
// Match priority of __tgt_register_lib | |
// Match priority of __sycl_register_lib |
{ | ||
sycl::detail::DeviceGlobalMap &DeviceGlobalMap = PM.getDeviceGlobals(); | ||
EXPECT_EQ(DeviceGlobalMap.size(), ExpectedCount) << Comment; | ||
EXPECT_TRUE(DeviceGlobalMap.count(generateRefName("A", "DeviceGlobal")) > 0) | ||
<< Comment; | ||
EXPECT_TRUE(DeviceGlobalMap.count(generateRefName("B", "DeviceGlobal")) > 0) | ||
<< Comment; | ||
EXPECT_EQ(DeviceGlobalMap.getPointerMap().size(), ExpectedCount) << Comment; | ||
} | ||
|
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 it possible to add a test for new behavior to compensate the removed test?
For my own education, could you please point me to some info regarding this limitation. |
__sycl_unregister_lib()
is not being called on Windows when using shared libraries due to a limitation in LLVM/clang To work around this, on Windows we register both__sycl_register_lib()
and anstd::atexit
handler that will call__sycl_unregister_lib()
. Further, it was discovered that freeing of the device globals during device images destruction is duplicate and unnecessary. The~context_impl
destructor handles that (and handles it correctly, because a context is needed to free USM memory). So we remove the unneeded duplication. Adding a test that stresses__sycl_unregister_lib()
and makes sure there are no resource leaks