Skip to content

Commit e8be632

Browse files
committed
optimize device_impl
Signed-off-by: Byoungro So <[email protected]>
1 parent 8751ad8 commit e8be632

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sycl/source/detail/pi.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,14 +653,13 @@ void fillPlatformAndDeviceCache(plugin &Plugin) {
653653

654654
if (PiDevices.size() != 0) {
655655
std::vector<DeviceImplPtr> DeviceCache;
656+
const std::lock_guard<std::mutex> Guard(
657+
GlobalHandler::instance().getPlatformMapMutex());
656658
for (const RT::PiDevice &PiDevice : PiDevices) {
657659
std::shared_ptr<device_impl> Device =
658-
PlatformImpl->getOrMakeDeviceImpl(PiDevice, PlatformImpl);
659-
const std::lock_guard<std::mutex> Guard(
660-
GlobalHandler::instance().getPlatformMapMutex());
660+
std::make_shared<device_impl>(PiDevice, PlatformImpl);
661661
DeviceCache.emplace_back(Device);
662662
}
663-
664663
PlatformDeviceCache[PlatformImpl] = DeviceCache;
665664
}
666665
DeviceNum += UnfilteredDeviceCount;

0 commit comments

Comments
 (0)