Skip to content

Commit d4459f9

Browse files
Apply suggestion from @steffenlarsen
Co-authored-by: Steffen Larsen <[email protected]>
1 parent e2ea6ed commit d4459f9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,14 +2469,15 @@ std::vector<DeviceGlobalMapEntry *> ProgramManager::getDeviceGlobalEntries(
24692469
std::vector<DeviceGlobalMapEntry *>
24702470
ProgramManager::getProfileCounterDeviceGlobalEntries(
24712471
const context_impl *CtxImpl) {
2472-
const std::vector<DeviceGlobalMapEntry *> ProfileCounters =
2472+
std::vector<DeviceGlobalMapEntry *> ProfileCounters =
24732473
ProgramManager::getInstance().m_DeviceGlobals.getProfileCounterEntries();
2474-
std::vector<DeviceGlobalMapEntry *> FoundEntries;
2475-
for (const auto &DGEntry : ProfileCounters) {
2476-
if (DGEntry->isAvailableInContext(CtxImpl))
2477-
FoundEntries.push_back(DGEntry);
2478-
}
2479-
return FoundEntries;
2474+
const auto NewEnd = std::remove_if(
2475+
ProfileCounters.begin(), ProfileCounters.end(),
2476+
[CtxImpl](const DeviceGlobalMapEntry *DGEntry) {
2477+
return !DGEntry->isAvailableInContext(CtxImpl);
2478+
});
2479+
ProfileCounters.erase(NewEnd, ProfileCounters.end());
2480+
return ProfileCounters;
24802481
}
24812482

24822483
void ProgramManager::addOrInitHostPipeEntry(const void *HostPipePtr,

0 commit comments

Comments
 (0)