Skip to content

[SYCL] Remove unused argument from getDeviceImpl #6780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2022
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
13 changes: 6 additions & 7 deletions sycl/source/detail/platform_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,17 @@ static void filterDeviceFilter(std::vector<RT::PiDevice> &PiDevices,
Plugin.setLastDeviceId(Platform, DeviceNum);
}

std::shared_ptr<device_impl> platform_impl::getDeviceImpl(
RT::PiDevice PiDevice, const std::shared_ptr<platform_impl> &PlatformImpl) {
std::shared_ptr<device_impl>
platform_impl::getDeviceImpl(RT::PiDevice PiDevice) {
const std::lock_guard<std::mutex> Guard(MDeviceMapMutex);
return getDeviceImplHelper(PiDevice, PlatformImpl);
return getDeviceImplHelper(PiDevice);
}

std::shared_ptr<device_impl> platform_impl::getOrMakeDeviceImpl(
RT::PiDevice PiDevice, const std::shared_ptr<platform_impl> &PlatformImpl) {
const std::lock_guard<std::mutex> Guard(MDeviceMapMutex);
// If we've already seen this device, return the impl
std::shared_ptr<device_impl> Result =
getDeviceImplHelper(PiDevice, PlatformImpl);
std::shared_ptr<device_impl> Result = getDeviceImplHelper(PiDevice);
if (Result)
return Result;

Expand Down Expand Up @@ -336,8 +335,8 @@ bool platform_impl::has(aspect Aspect) const {
return true;
}

std::shared_ptr<device_impl> platform_impl::getDeviceImplHelper(
RT::PiDevice PiDevice, const std::shared_ptr<platform_impl> &PlatformImpl) {
std::shared_ptr<device_impl>
platform_impl::getDeviceImplHelper(RT::PiDevice PiDevice) {
for (const std::weak_ptr<device_impl> &DeviceWP : MDeviceCache) {
if (std::shared_ptr<device_impl> Device = DeviceWP.lock()) {
if (Device->getHandleRef() == PiDevice)
Expand Down
10 changes: 2 additions & 8 deletions sycl/source/detail/platform_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,8 @@ class platform_impl {
///
/// \param PiDevice is the PiDevice whose impl is requested
///
/// \param PlatormImpl is the Platform for that Device
///
/// \return a shared_ptr<device_impl> corresponding to the device
std::shared_ptr<device_impl>
getDeviceImpl(RT::PiDevice PiDevice,
const std::shared_ptr<platform_impl> &PlatformImpl);
std::shared_ptr<device_impl> getDeviceImpl(RT::PiDevice PiDevice);

/// Queries the device_impl cache to either return a shared_ptr
/// for the device_impl corresponding to the PiDevice or add
Expand Down Expand Up @@ -193,9 +189,7 @@ class platform_impl {
getPlatformFromPiDevice(RT::PiDevice PiDevice, const plugin &Plugin);

private:
std::shared_ptr<device_impl>
getDeviceImplHelper(RT::PiDevice PiDevice,
const std::shared_ptr<platform_impl> &PlatformImpl);
std::shared_ptr<device_impl> getDeviceImplHelper(RT::PiDevice PiDevice);

bool MHostPlatform = false;
RT::PiPlatform MPlatform = 0;
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/usm/usm_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ device get_pointer_device(const void *Ptr, const context &Ctxt) {
// member's descendant instead. Fetch the corresponding device from the cache.
std::shared_ptr<detail::platform_impl> PltImpl = CtxImpl->getPlatformImpl();
std::shared_ptr<detail::device_impl> DevImpl =
PltImpl->getDeviceImpl(DeviceId, PltImpl);
PltImpl->getDeviceImpl(DeviceId);
if (DevImpl)
return detail::createSyclObjFromImpl<device>(DevImpl);
throw runtime_error("Cannot find device associated with USM allocation!",
Expand Down