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
9 changes: 7 additions & 2 deletions sycl/source/detail/platform_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ platform_impl::getOrMakePlatformImpl(ur_platform_handle_t UrPlatform,
return PlatImpl;
}

// Otherwise make the impl
Result = std::make_shared<platform_impl>(UrPlatform, Adapter);
// Otherwise make the impl. Our ctor/dtor are private, so std::make_shared
// needs a bit of help...
struct creator : platform_impl {
creator(ur_platform_handle_t APlatform, const AdapterPtr &AAdapter)
: platform_impl(APlatform, AAdapter) {}
};
Result = std::make_shared<creator>(UrPlatform, Adapter);
PlatformCache.emplace_back(Result);
}

Expand Down
5 changes: 4 additions & 1 deletion sycl/source/detail/platform_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ class device_impl;
// TODO: implement extension management for host device
// TODO: implement parameters treatment for host device
class platform_impl {
public:
/// Constructs platform_impl from a UR platform handle.
///
/// \param APlatform is a raw plug-in platform handle.
/// \param AAdapter is a plug-in handle.
//
// Platforms can only be created under `GlobalHandler`'s ownership via
// `platform_impl::getOrMakePlatformImpl` method.
explicit platform_impl(ur_platform_handle_t APlatform,
const std::shared_ptr<Adapter> &AAdapter)
: MPlatform(APlatform), MAdapter(AAdapter) {
Expand All @@ -50,6 +52,7 @@ class platform_impl {

~platform_impl() = default;

public:
/// Checks if this platform supports extension.
///
/// \param ExtensionName is a string containing extension name.
Expand Down