File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,7 @@ class HandlerAccess;
213
213
class HostTask ;
214
214
215
215
using EventImplPtr = std::shared_ptr<event_impl>;
216
+ using DeviceImplPtr = std::shared_ptr<device_impl>;
216
217
217
218
template <typename RetType, typename Func, typename Arg>
218
219
static Arg member_ptr_helper (RetType (Func::*)(Arg) const );
@@ -249,6 +250,7 @@ template <typename Type> struct get_kernel_wrapper_name_t {
249
250
};
250
251
251
252
__SYCL_EXPORT device getDeviceFromHandler (handler &);
253
+ const DeviceImplPtr &getDeviceImplFromHandler (handler &);
252
254
253
255
// Checks if a device_global has any registered kernel usage.
254
256
__SYCL_EXPORT bool isDeviceGlobalUsedInKernel (const void *DeviceGlobalPtr);
@@ -3481,6 +3483,8 @@ class __SYCL_EXPORT handler {
3481
3483
typename PropertyListT>
3482
3484
friend class accessor ;
3483
3485
friend device detail::getDeviceFromHandler (handler &);
3486
+ friend const detail::DeviceImplPtr &
3487
+ detail::getDeviceImplFromHandler (handler &);
3484
3488
3485
3489
template <typename DataT, int Dimensions, access::mode AccessMode,
3486
3490
access::target AccessTarget, access::placeholder IsPlaceholder>
Original file line number Diff line number Diff line change @@ -919,6 +919,12 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
919
919
// / @return Context associated with graph.
920
920
sycl::context getContext () const { return MContext; }
921
921
922
+ // / Query for the device_impl tied to this graph.
923
+ // / @return device_impl shared ptr reference associated with graph.
924
+ const DeviceImplPtr &getDeviceImplPtr () const {
925
+ return getSyclObjImpl (MDevice);
926
+ }
927
+
922
928
// / Query for the device tied to this graph.
923
929
// / @return Device associated with graph.
924
930
sycl::device getDevice () const { return MDevice; }
Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ inline namespace _V1 {
43
43
44
44
namespace detail {
45
45
46
+ const DeviceImplPtr &getDeviceImplFromHandler (handler &CGH) {
47
+ assert ((CGH.MQueue || getSyclObjImpl (CGH)->MGraph ) &&
48
+ " One of MQueue or MGraph should be nonnull!" );
49
+ if (CGH.MQueue )
50
+ return CGH.MQueue ->getDeviceImplPtr ();
51
+
52
+ return getSyclObjImpl (CGH)->MGraph ->getDeviceImplPtr ();
53
+ }
54
+
46
55
bool isDeviceGlobalUsedInKernel (const void *DeviceGlobalPtr) {
47
56
DeviceGlobalMapEntry *DGEntry =
48
57
detail::ProgramManager::getInstance ().getDeviceGlobalEntry (
@@ -2059,10 +2068,10 @@ void handler::setUserFacingNodeType(ext::oneapi::experimental::node_type Type) {
2059
2068
}
2060
2069
2061
2070
std::optional<std::array<size_t , 3 >> handler::getMaxWorkGroups () {
2062
- auto Dev = detail::getSyclObjImpl ( detail::getDeviceFromHandler ( *this ) );
2071
+ const auto &DeviceImpl = detail::getDeviceImplFromHandler ( *this );
2063
2072
std::array<size_t , 3 > UrResult = {};
2064
- auto Ret = Dev ->getAdapter ()->call_nocheck <UrApiKind::urDeviceGetInfo>(
2065
- Dev ->getHandleRef (),
2073
+ auto Ret = DeviceImpl ->getAdapter ()->call_nocheck <UrApiKind::urDeviceGetInfo>(
2074
+ DeviceImpl ->getHandleRef (),
2066
2075
UrInfoCode<
2067
2076
ext::oneapi::experimental::info::device::max_work_groups<3 >>::value,
2068
2077
sizeof (UrResult), &UrResult, nullptr );
You can’t perform that action at this time.
0 commit comments