@@ -1866,17 +1866,19 @@ void ProgramManager::addImages(sycl_device_binaries DeviceBinary) {
1866
1866
1867
1867
m_BinImg2KernelIDs[Img.get ()].reset (new std::vector<kernel_id>);
1868
1868
1869
- sycl_offload_entry EntriesIt;
1869
+ sycl_offload_entry EntriesIt = EntriesB;
1870
+ // Assuming that there isn't a mix of new and old offload entry types in the
1871
+ // image.
1872
+ bool isNewOffloadEntryType = EntriesIt->IsNewOffloadEntryType ();
1870
1873
auto IncrementEntriesIt = [&]() {
1871
- if (EntriesIt-> IsNewOffloadEntryType () )
1874
+ if (isNewOffloadEntryType )
1872
1875
return reinterpret_cast <sycl_offload_entry>(
1873
1876
reinterpret_cast <sycl_offload_entry_new>(EntriesIt) + 1 );
1874
1877
else
1875
1878
return EntriesIt + 1 ;
1876
1879
};
1877
1880
1878
- for (EntriesIt = EntriesB; EntriesIt != EntriesE;
1879
- EntriesIt = IncrementEntriesIt ()) {
1881
+ for (; EntriesIt != EntriesE; EntriesIt = IncrementEntriesIt ()) {
1880
1882
1881
1883
auto name = EntriesIt->GetName ();
1882
1884
@@ -2028,18 +2030,20 @@ void ProgramManager::removeImages(sycl_device_binaries DeviceBinary) {
2028
2030
// Acquire lock to modify maps for kernel bundles
2029
2031
std::lock_guard<std::mutex> KernelIDsGuard (m_KernelIDsMutex);
2030
2032
2031
- sycl_offload_entry EntriesIt;
2033
+ sycl_offload_entry EntriesIt = EntriesB;
2034
+ // Assuming that there isn't a mix of new and old offload entry types in the
2035
+ // image.
2036
+ bool isNewOffloadEntryType = EntriesIt->IsNewOffloadEntryType ();
2032
2037
auto IncrementEntriesIt = [&]() {
2033
- if (EntriesIt-> IsNewOffloadEntryType () )
2038
+ if (isNewOffloadEntryType )
2034
2039
return reinterpret_cast <sycl_offload_entry>(
2035
2040
reinterpret_cast <sycl_offload_entry_new>(EntriesIt) + 1 );
2036
2041
else
2037
2042
return EntriesIt + 1 ;
2038
2043
};
2039
2044
2040
2045
// Unmap the unique kernel IDs for the offload entries
2041
- for (EntriesIt = EntriesB; EntriesIt != EntriesE;
2042
- EntriesIt = IncrementEntriesIt ()) {
2046
+ for (; EntriesIt != EntriesE; EntriesIt = IncrementEntriesIt ()) {
2043
2047
2044
2048
// Drop entry for service kernel
2045
2049
if (std::strstr (EntriesIt->GetName (), " __sycl_service_kernel__" )) {
0 commit comments