Skip to content

Commit 91cceb1

Browse files
author
Sergey Kanaev
committed
[SYCL] Address review comments.
Signed-off-by: Sergey Kanaev <sergey.kanaev@intel.com>
1 parent 44ea4d4 commit 91cceb1

File tree

7 files changed

+70
-19
lines changed

7 files changed

+70
-19
lines changed

sycl/include/CL/sycl/detail/cg_types.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//==---- cg_types.hpp - Auxiliary types required by command group class ----==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
19
#pragma once
210

311
#include <CL/sycl/detail/host_profiling_info.hpp>

sycl/include/CL/sycl/detail/handler_proxy.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//==--------- handler_proxy.hpp - Proxy methods to call in handler ---------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
19
#pragma once
210

311
#include <CL/sycl/access/access.hpp>

sycl/include/CL/sycl/interop_handler.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//==------- interop_handler.hpp - Argument for codeplay_introp_task --------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
19
#pragma once
210

311
#include <CL/sycl/accessor.hpp>

sycl/source/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ set(SYCL_SOURCES
144144
"function_pointer.cpp"
145145
"half_type.cpp"
146146
"handler.cpp"
147+
"interop_handler.cpp"
147148
"kernel.cpp"
148149
"platform.cpp"
149150
"program.cpp"

sycl/source/detail/cg.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,5 @@
2222
__SYCL_INLINE_NAMESPACE(cl) {
2323
namespace sycl {
2424

25-
pi_native_handle interop_handler::GetNativeQueue() const {
26-
return MQueue->getNative();
27-
}
28-
29-
pi_native_handle interop_handler::GetNativeMem(detail::Requirement *Req) const {
30-
auto Iter = std::find_if(std::begin(MMemObjs), std::end(MMemObjs),
31-
[=](ReqToMem Elem) { return (Elem.first == Req); });
32-
33-
if (Iter == std::end(MMemObjs)) {
34-
throw("Invalid memory object used inside interop");
35-
}
36-
37-
auto Plugin = MQueue->getPlugin();
38-
pi_native_handle Handle;
39-
Plugin.call<detail::PiApiKind::piextMemGetNativeHandle>(Iter->second,
40-
&Handle);
41-
return Handle;
42-
}
43-
4425
} // sycl
4526
} // __SYCL_INLINE_NAMESPACE(cl)

sycl/source/detail/handler_proxy.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//==--------- handler_proxy.cpp - Proxy methods to call in handler ---------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
19
#include <CL/sycl/detail/handler_proxy.hpp>
210

311
#include <CL/sycl/handler.hpp>

sycl/source/interop_handler.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//==------- interop_handler.cpp - Argument for codeplay_introp_task --------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include <CL/sycl/detail/defines.hpp>
10+
#include <CL/sycl/detail/pi.hpp>
11+
#include <CL/sycl/interop_handler.hpp>
12+
#include <detail/queue_impl.hpp>
13+
14+
__SYCL_INLINE_NAMESPACE(cl) {
15+
namespace sycl {
16+
17+
pi_native_handle interop_handler::GetNativeQueue() const {
18+
return MQueue->getNative();
19+
}
20+
21+
pi_native_handle interop_handler::GetNativeMem(detail::Requirement *Req) const {
22+
auto Iter = std::find_if(std::begin(MMemObjs), std::end(MMemObjs),
23+
[=](ReqToMem Elem) { return (Elem.first == Req); });
24+
25+
if (Iter == std::end(MMemObjs)) {
26+
throw("Invalid memory object used inside interop");
27+
}
28+
29+
auto Plugin = MQueue->getPlugin();
30+
pi_native_handle Handle;
31+
Plugin.call<detail::PiApiKind::piextMemGetNativeHandle>(Iter->second,
32+
&Handle);
33+
return Handle;
34+
}
35+
36+
} // namespace sycl
37+
} // __SYCL_INLINE_NAMESPACE(cl)

0 commit comments

Comments
 (0)