Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sycl/include/sycl/info/ext_oneapi_device_traits.def
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ __SYCL_PARAM_TRAITS_SPEC(ext::oneapi::experimental,device, max_global_work_group
__SYCL_PARAM_TRAITS_TEMPLATE_SPEC(ext::oneapi::experimental,device, max_work_groups<1>, id<1>, PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_1D)
__SYCL_PARAM_TRAITS_TEMPLATE_SPEC(ext::oneapi::experimental,device, max_work_groups<2>, id<2>, PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_2D)
__SYCL_PARAM_TRAITS_TEMPLATE_SPEC(ext::oneapi::experimental,device, max_work_groups<3>, id<3>, PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D)
__SYCL_PARAM_TRAITS_SPEC(ext::oneapi::experimental,device, graph_support, ext::oneapi::experimental::info::device::graph_support_level, PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT)

#ifdef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC_NEEDS_UNDEF
#undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC
#undef __SYCL_PARAM_TRAITS_TEMPLATE_SPEC_NEEDS_UNDEF
Expand Down
3 changes: 3 additions & 0 deletions sycl/include/sycl/info/info_desc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ template <typename T, T param> struct compatibility_param_traits {};

namespace ext::oneapi::experimental::info::device {
template <int Dimensions> struct max_work_groups;

enum class graph_support_level { unsupported = 0, native, emulated };

} // namespace ext::oneapi::experimental::info::device
#include <sycl/info/ext_codeplay_device_traits.def>
#include <sycl/info/ext_intel_device_traits.def>
Expand Down
33 changes: 33 additions & 0 deletions sycl/source/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,31 @@ struct get_device_info_impl<
}
};

// Specialization for graph extension support
template <>
struct get_device_info_impl<
ext::oneapi::experimental::info::device::graph_support_level,
ext::oneapi::experimental::info::device::graph_support> {
static ext::oneapi::experimental::info::device::graph_support_level
get(const DeviceImplPtr &Dev) {
// Level zero is currently only supported backend
if (Dev->getBackend() != backend::ext_oneapi_level_zero) {
return ext::oneapi::experimental::info::device::graph_support_level::
unsupported;
}

pi_bool CmdBufSupport = false;
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
Dev->getHandleRef(), PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT,
sizeof(pi_bool), &CmdBufSupport, nullptr);

return CmdBufSupport ? ext::oneapi::experimental::info::device::
graph_support_level::native
: ext::oneapi::experimental::info::device::
graph_support_level::emulated;
}
};

template <typename Param>
typename Param::return_type get_device_info(const DeviceImplPtr &Dev) {
static_assert(is_device_info_desc<Param>::value,
Expand Down Expand Up @@ -1692,6 +1717,14 @@ inline uint32_t get_device_info_host<
PI_ERROR_INVALID_DEVICE);
}

template <>
inline ext::oneapi::experimental::info::device::graph_support_level
get_device_info_host<ext::oneapi::experimental::info::device::graph_support>() {
// No support for graphs on the host device.
return ext::oneapi::experimental::info::device::graph_support_level::
unsupported;
}

} // namespace detail
} // __SYCL_INLINE_VER_NAMESPACE(_V1)
} // namespace sycl
25 changes: 25 additions & 0 deletions sycl/test-e2e/Graph/device_query.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

// Tests the using device query for graphs support, and that the return value
// matches expectations.

#include "graph_common.hpp"

int main() {
queue Queue;

auto Device = Queue.get_device();

exp_ext::info::device::graph_support_level SupportsGraphs =
Device.get_info<exp_ext::info::device::graph_support>();
auto Backend = Device.get_backend();

if (Backend == backend::ext_oneapi_level_zero) {
assert(SupportsGraphs ==
exp_ext::info::device::graph_support_level::native);
} else {
assert(SupportsGraphs ==
exp_ext::info::device::graph_support_level::unsupported);
}
}
2 changes: 0 additions & 2 deletions sycl/test-e2e/Graph/vendor_test_macro.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// REQUIRES: level_zero, gpu

// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

Expand Down