-
Notifications
You must be signed in to change notification settings - Fork 755
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
[UR] Replace calls to UR in native handle functions to proper OpenCL functions #17016
base: sycl
Are you sure you want to change the base?
Conversation
8a1e5a3
to
d3e930c
Compare
d3e930c
to
cd73105
Compare
cd73105
to
dae0641
Compare
dae0641
to
7664104
Compare
7664104
to
6b55d56
Compare
6b55d56
to
38563a4
Compare
38563a4
to
55f9034
Compare
85c448c
to
93ce35e
Compare
93ce35e
to
7c29c52
Compare
7c29c52
to
d16b32d
Compare
d16b32d
to
4b996d2
Compare
688137b
to
2238fb5
Compare
a73f57f
to
18a4a0c
Compare
18a4a0c
to
5bdef29
Compare
5bdef29
to
1d54a86
Compare
3967df3
to
6f3f471
Compare
At various points, OpenCL native handles need to be retained to ensure SYCL semantics. Previously, this relied on the fact that UR handles were typecast CL handles and shared the same reference count. However, the SYCL RT shouldn't assume this, so instead we call the appropriate (dynamically looked-up) CL functions on the native handles instead. This is in preperation for oneapi-src/unified-runtime#1176 . This change should also have no observable effect for SYCL code; there is no change in lifetime semantics.
6f3f471
to
357e397
Compare
@intel/llvm-reviewers-runtime Looks like the only failures now are random ones, so marking this ready. Just to give some context on this change: In the OpenCL backend, UR handles are just CL handles. So the OpenCL reference count would be used as the UR one (that is, In a future UR change, we would like to break this equivalence so that These changes should not be externally visible; a user of SYCL should not encounter any change of behaviour as a result of this patch; It does make testing much more complicated though, requiring a "fake" OpenCL for SYCL to call into that does nothing but track reference counts. |
// The library must already have been loaded (perhaps by UR), otherwise this | ||
// function throws. | ||
template <typename fn> | ||
fn *dynLookupFunction([[maybe_unused]] const char *WinName, |
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 there a more suitable place for this than common.hpp?
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.
Probably it should go into os_util.hpp
and/or os_util.cpp
There are also windows_os_utils.hpp
and friends in sycl/source/detail/
} | ||
return reinterpret_cast<fn *>(retVal); | ||
} | ||
#define _OCL_GET_FUNCTION(FN) \ |
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 macro name okay, or should it be _SYCL_DETAIL_OCL_GET_FUNCTION
or 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.
__SYCL_OCL_GET_FUNCTION
with two leading underscores
Why is that better than to provide |
I considered that, but I don't think that makes sense to be part of the UR API; I think the main purpose of native handles is to be manipulated by code wanting to manipulate the backend directly. In addition, if there's |
Is there a unittest when we have several OpenCL platforms available on the system? We need to ensure that dynamic library corresponds to the sycl device/queue/context/etc. we are working with. |
At various points, OpenCL native handles need to be retained to ensure
SYCL semantics. Previously, this relied on the fact that UR handles were
typecast CL handles and shared the same reference count.
However, the SYCL RT shouldn't assume this, so instead we call the
appropriate (dynamically looked-up) CL functions on the native handles
instead.
This is in preperation for oneapi-src/unified-runtime#1176 .
This change should also have no observable effect for SYCL code; there
is no change in lifetime semantics.