Skip to content

Commit

Permalink
[SYCL] Change graph_support_level namespace (#256)
Browse files Browse the repository at this point in the history
Matching implementation change to specification PR
#255
  • Loading branch information
EwanC committed Jul 12, 2023
1 parent 7d88887 commit cfb2c40
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 56 deletions.
2 changes: 1 addition & 1 deletion sycl/include/sycl/info/ext_oneapi_device_traits.def
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ __SYCL_PARAM_TRAITS_TEMPLATE_SPEC(ext::oneapi::experimental,device, max_work_gro

__SYCL_PARAM_TRAITS_SPEC(
ext::oneapi::experimental, device, graph_support,
ext::oneapi::experimental::info::device::graph_support_level,
ext::oneapi::experimental::info::graph_support_level,
0 /* No PI device code needed */)

__SYCL_PARAM_TRAITS_SPEC(ext::oneapi::experimental, device, architecture,
Expand Down
8 changes: 5 additions & 3 deletions sycl/include/sycl/info/info_desc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,14 @@ template <typename T, T param> struct compatibility_param_traits {};
} /*namespace info */ \
} /*namespace Namespace */

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

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

} // namespace ext::oneapi::experimental::info::device
namespace device {
template <int Dimensions> struct max_work_groups;
} // namespace device
} // namespace ext::oneapi::experimental::info
#include <sycl/info/ext_codeplay_device_traits.def>
#include <sycl/info/ext_intel_device_traits.def>
#include <sycl/info/ext_oneapi_device_traits.def>
Expand Down
20 changes: 9 additions & 11 deletions sycl/source/detail/device_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,17 +888,16 @@ 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::graph_support_level,
ext::oneapi::experimental::info::device::graph_support> {
static ext::oneapi::experimental::info::device::graph_support_level
static ext::oneapi::experimental::info::graph_support_level
get(const DeviceImplPtr &Dev) {
size_t ResultSize = 0;
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
Dev->getHandleRef(), PI_DEVICE_INFO_EXTENSIONS, 0, nullptr,
&ResultSize);
if (ResultSize == 0)
return ext::oneapi::experimental::info::device::graph_support_level::
unsupported;
return ext::oneapi::experimental::info::graph_support_level::unsupported;

std::unique_ptr<char[]> Result(new char[ResultSize]);
Dev->getPlugin()->call<PiApiKind::piDeviceGetInfo>(
Expand All @@ -908,10 +907,10 @@ struct get_device_info_impl<
std::string_view ExtensionsString(Result.get());
bool CmdBufferSupport =
ExtensionsString.find("ur_exp_command_buffer") != std::string::npos;
return CmdBufferSupport ? ext::oneapi::experimental::info::device::
graph_support_level::native
: ext::oneapi::experimental::info::device::
graph_support_level::unsupported;
return CmdBufferSupport
? ext::oneapi::experimental::info::graph_support_level::native
: ext::oneapi::experimental::info::graph_support_level::
unsupported;
}
};

Expand Down Expand Up @@ -1810,11 +1809,10 @@ inline uint32_t get_device_info_host<
}

template <>
inline ext::oneapi::experimental::info::device::graph_support_level
inline ext::oneapi::experimental::info::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;
return ext::oneapi::experimental::info::graph_support_level::unsupported;
}

} // namespace detail
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ void executable_command_graph::finalizeImpl() {
bool CmdBufSupport =
Device.get_info<
ext::oneapi::experimental::info::device::graph_support>() ==
info::device::graph_support_level::native;
info::graph_support_level::native;

#if FORCE_EMULATION_MODE
// Above query should still succeed in emulation mode, but ignore the
Expand Down
8 changes: 3 additions & 5 deletions sycl/test-e2e/Graph/device_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ int main() {

auto Device = Queue.get_device();

exp_ext::info::device::graph_support_level SupportsGraphs =
exp_ext::info::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);
assert(SupportsGraphs == exp_ext::info::graph_support_level::native);
} else {
assert(SupportsGraphs ==
exp_ext::info::device::graph_support_level::unsupported);
assert(SupportsGraphs == exp_ext::info::graph_support_level::unsupported);
}
}
Loading

0 comments on commit cfb2c40

Please sign in to comment.