Skip to content

Commit 041ca27

Browse files
authored
[SYCL] Add SYCL-2020 interop_handle::get_backend() method (#3664)
The corresponding patch in LIT tests: intel/llvm-test-suite#258 Signed-off-by: Vyacheslav N Klochkov <[email protected]>
1 parent 39ac038 commit 041ca27

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

sycl/include/CL/sycl/interop_handle.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ class context;
3636

3737
class interop_handle {
3838
public:
39+
interop_handle() = delete;
40+
41+
/// Returns a backend associated with the queue associated with this
42+
/// interop_handle.
43+
__SYCL_EXPORT backend get_backend() const noexcept;
44+
3945
/// Receives a SYCL accessor that has been defined as a requirement for the
4046
/// command group, and returns the underlying OpenCL memory object that is
4147
/// used by the SYCL runtime. If the accessor passed as parameter is not part
@@ -131,15 +137,13 @@ class interop_handle {
131137
friend class detail::DispatchHostTask;
132138
using ReqToMem = std::pair<detail::Requirement *, pi_mem>;
133139

134-
// TODO set c-tor private
135140
interop_handle(std::vector<ReqToMem> MemObjs,
136141
const std::shared_ptr<detail::queue_impl> &Queue,
137142
const std::shared_ptr<detail::device_impl> &Device,
138143
const std::shared_ptr<detail::context_impl> &Context)
139144
: MQueue(Queue), MDevice(Device), MContext(Context),
140145
MMemObjs(std::move(MemObjs)) {}
141146

142-
private:
143147
template <backend BackendName, typename DataT, int Dims, access::mode Mode,
144148
access::target Target, access::placeholder IsPlh>
145149
auto getMemImpl(detail::Requirement *Req) const ->

sycl/source/interop_handle.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <CL/sycl/detail/accessor_impl.hpp>
1010
#include <CL/sycl/exception.hpp>
1111
#include <CL/sycl/interop_handle.hpp>
12+
#include <detail/backend_impl.hpp>
1213
#include <detail/context_impl.hpp>
1314
#include <detail/device_impl.hpp>
1415
#include <detail/queue_impl.hpp>
@@ -18,6 +19,10 @@
1819
__SYCL_INLINE_NAMESPACE(cl) {
1920
namespace sycl {
2021

22+
backend interop_handle::get_backend() const noexcept {
23+
return detail::getImplBackend(MQueue);
24+
}
25+
2126
pi_native_handle interop_handle::getNativeMem(detail::Requirement *Req) const {
2227
auto Iter = std::find_if(std::begin(MMemObjs), std::end(MMemObjs),
2328
[=](ReqToMem Elem) { return (Elem.first == Req); });

sycl/test/abi/sycl_symbols_linux.dump

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3908,6 +3908,7 @@ _ZNK2cl4sycl13host_selectorclERKNS0_6deviceE
39083908
_ZNK2cl4sycl14exception_list3endEv
39093909
_ZNK2cl4sycl14exception_list4sizeEv
39103910
_ZNK2cl4sycl14exception_list5beginEv
3911+
_ZNK2cl4sycl14interop_handle11get_backendEv
39113912
_ZNK2cl4sycl14interop_handle12getNativeMemEPNS0_6detail16AccessorImplHostE
39123913
_ZNK2cl4sycl14interop_handle14getNativeQueueEv
39133914
_ZNK2cl4sycl14interop_handle15getNativeDeviceEv

0 commit comments

Comments
 (0)