19 inline namespace _V1 {
25 detail::pi::cast<sycl::detail::pi::PiPlatform>(PlatformId),
26 sycl::detail::pi::getPlugin<backend::opencl>());
33 *
this = dev_selector.select_device().get_platform();
39 return impl->has_extension(ExtensionName);
42 bool platform::is_host()
const {
43 bool IsHost = impl->is_host();
45 "platform::is_host should not be called in implementation.");
50 return impl->get_devices(DeviceType);
59 template <
typename Param>
62 platform::get_info_impl()
const {
70 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
71 template __SYCL_EXPORT detail::ABINeutralT_t<ReturnT> \
72 platform::get_info_impl<info::platform::Desc>() const;
74 #include <sycl/info/platform_traits.def>
75 #undef __SYCL_PARAM_TRAITS_SPEC
77 template <
typename Param>
80 return impl->get_backend_info<Param>();
83 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, Picode) \
84 template __SYCL_EXPORT ReturnT \
85 platform::get_backend_info<info::DescType::Desc>() const;
87 #include <sycl/info/sycl_backend_traits.def>
89 #undef __SYCL_PARAM_TRAITS_SPEC
93 throw std::runtime_error(
"SYCL default contexts are not enabled");
97 std::unordered_map<detail::PlatformImplPtr, detail::ContextImplPtr>
98 &PlatformToDefaultContextCache =
101 std::lock_guard<std::mutex> Lock{
105 auto It = PlatformToDefaultContextCache.find(impl);
106 if (PlatformToDefaultContextCache.end() == It)
107 std::tie(It, std::ignore) = PlatformToDefaultContextCache.insert(
110 return detail::createSyclObjFromImpl<context>(It->second);
119 std::vector<device> Composites;
120 std::vector<device> Result;
121 for (
auto &Dev : GPUDevices) {
122 if (!Dev.has(sycl::aspect::ext_oneapi_is_component))
125 auto Composite = Dev.get_info<
126 sycl::ext::oneapi::experimental::info::device::composite_device>();
127 if (std::find(Result.begin(), Result.end(), Composite) == Result.end())
128 Composites.push_back(Composite);
130 for (
const auto &Composite : Composites) {
131 auto Components = Composite.get_info<
132 sycl::ext::oneapi::experimental::info::device::component_devices>();
137 size_t ComponentsFound = std::count_if(
138 Components.begin(), Components.end(), [&](
const device &d) {
139 return std::find(GPUDevices.begin(), GPUDevices.end(), d) !=
142 if (ComponentsFound == Components.size())
143 Result.push_back(Composite);
151 const char *StringVal = Val ?
"1" :
"0";
The context class represents a SYCL context on which kernel functions may be executed.
std::unordered_map< PlatformImplPtr, ContextImplPtr > & getPlatformToDefaultContextCache()
std::mutex & getPlatformToDefaultContextCacheMutex()
static GlobalHandler & instance()
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
platform get_platform() const
Get associated SYCL platform.
class __SYCL2020_DEPRECATED("Host device is no longer supported.") host_selector int default_selector_v(const device &dev)
Selects SYCL host device.
constexpr tuple_element< I, tuple< Types... > >::type & get(sycl::detail::tuple< Types... > &Arg) noexcept
auto convert_to_abi_neutral(ParamT &&Info)
void enable_ext_oneapi_default_context(bool Val)
Allows to enable/disable "Default Context" extension.
decltype(Obj::impl) getSyclObjImpl(const Obj &SyclObject)
typename ABINeutralT< T >::type ABINeutralT_t
bool has_extension(const sycl::platform &SyclPlatform, const std::string &Extension)
uintptr_t pi_native_handle
_Abi const simd< _Tp, _Abi > & noexcept