Skip to content

Commit a5eda04

Browse files
author
Alexander Batashev
committed
React to offline comments
Signed-off-by: Alexander Batashev <[email protected]>
1 parent dfabf85 commit a5eda04

File tree

7 files changed

+40
-23
lines changed

7 files changed

+40
-23
lines changed

sycl/include/CL/sycl/device.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ namespace sycl {
2121
class device_selector;
2222
namespace detail {
2323
class device_impl;
24-
25-
// Helper function to avoid calls to implementation detail methods.
26-
pi_device getRawDevice(device &D);
2724
}
28-
2925
class device {
3026
public:
3127
/// Constructs a SYCL device instance as a host device.

sycl/include/CL/sycl/intel/function_pointer.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ namespace intel {
2828

2929
using device_func_ptr_holder_t = cl_ulong;
3030

31+
namespace detail {
32+
device_func_ptr_holder_t getDeviceFunctionPointerImpl(device &D, program &P,
33+
const char *FuncName);
34+
}
35+
3136
/// \brief this function performs a cast from device_func_ptr_holder_t type
3237
/// to the provided function pointer type.
3338
template <
@@ -77,13 +82,7 @@ device_func_ptr_holder_t get_device_func_ptr(FuncType F, const char *FuncName,
7782
"Program must be built before passing to get_device_func_ptr");
7883
}
7984

80-
device_func_ptr_holder_t FPtr = 0;
81-
// FIXME: return value must be checked here, but since we cannot yet check
82-
// if corresponding extension is supported, let's silently ignore it here.
83-
PI_CALL(piextGetDeviceFunctionPointer)(
84-
detail::getRawDevice(D), detail::getRawProgram(P), FuncName, &FPtr);
85-
86-
return FPtr;
85+
return detail::getDeviceFunctionPointerImpl(D, P, FuncName);
8786
}
8887

8988
} // namespace intel

sycl/include/CL/sycl/program.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class context;
2323
class device;
2424
namespace detail {
2525
class program_impl;
26-
27-
// Helper function to avoid calls to implementation detail methods.
28-
pi_program getRawProgram(program &P);
2926
}
3027

3128
enum class program_state { none, compiled, linked };

sycl/source/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ set(SYCL_SOURCES
8888
"event.cpp"
8989
"exception.cpp"
9090
"exception_list.cpp"
91+
"function_pointer.cpp"
9192
"half_type.cpp"
9293
"handler.cpp"
9394
"kernel.cpp"

sycl/source/device.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ void force_type(info::device_type &t, const info::device_type &ft) {
2222
throw cl::sycl::invalid_parameter_error("No device of forced type.");
2323
}
2424
}
25-
pi_device getRawDevice(device &D) {
26-
return detail::pi::cast<pi_device>(detail::getSyclObjImpl(D)->getHandleRef());
27-
}
2825
} // namespace detail
2926

3027
device::device() : impl(std::make_shared<detail::device_impl>()) {}

sycl/source/function_pointer.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//==----------- function_pointer.cpp --- SYCL Function pointers ------------==//
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/intel/function_pointer.hpp>
10+
#include <CL/sycl/detail/device_impl.hpp>
11+
#include <CL/sycl/detail/program_impl.hpp>
12+
13+
__SYCL_INLINE namespace cl {
14+
namespace sycl {
15+
namespace intel {
16+
namespace detail {
17+
device_func_ptr_holder_t getDeviceFunctionPointerImpl(device &D, program &P,
18+
const char *FuncName) {
19+
device_func_ptr_holder_t FPtr = 0;
20+
// FIXME: return value must be checked here, but since we cannot yet check
21+
// if corresponding extension is supported, let's silently ignore it here.
22+
PI_CALL(piextGetDeviceFunctionPointer)(
23+
sycl::detail::pi::cast<pi_device>(sycl::detail::getSyclObjImpl(D)->getHandleRef()),
24+
sycl::detail::pi::cast<pi_program>(sycl::detail::getSyclObjImpl(P)->getHandleRef()),
25+
FuncName, &FPtr);
26+
return FPtr;
27+
}
28+
29+
} // namespace detail
30+
} // namespace intel
31+
} // namespace sycl
32+
} // namespace cl

sycl/source/program.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@
1313

1414
__SYCL_INLINE namespace cl {
1515
namespace sycl {
16-
namespace detail {
17-
pi_program getRawProgram(program &P) {
18-
return detail::pi::cast<pi_program>(
19-
detail::getSyclObjImpl(P)->getHandleRef());
20-
}
21-
} // namespace detail
16+
2217
program::program(const context &context)
2318
: impl(std::make_shared<detail::program_impl>(
2419
detail::getSyclObjImpl(context))) {}

0 commit comments

Comments
 (0)