Skip to content

Commit 3dce625

Browse files
author
Alexander Batashev
committed
bug
1 parent 7dc0f98 commit 3dce625

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sycl/source/detail/device_image_impl.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ class device_image_impl {
191191
MBinImage->getSpecConstants();
192192
using SCItTy = pi::DeviceBinaryImage::PropertyRange::ConstIterator;
193193

194+
// This variable is used to calculate spec constant value offset in a
195+
// flat byte array.
196+
unsigned BlobOffset = 0;
194197
for (SCItTy SCIt : SCRange) {
195198
const char *SCName = (*SCIt)->Name;
196199

@@ -211,7 +214,6 @@ class device_image_impl {
211214
auto *It = reinterpret_cast<const std::uint32_t *>(&Descriptors[8]);
212215
auto *End = reinterpret_cast<const std::uint32_t *>(&Descriptors[0] +
213216
Descriptors.size());
214-
unsigned BlobOffset = 0;
215217
while (It != End) {
216218
// The map is not locked here because updateSpecConstSymMap() is only
217219
// supposed to be called from c'tor.
@@ -221,8 +223,8 @@ class device_image_impl {
221223
BlobOffset += /*Size*/ It[2];
222224
It += NumElements;
223225
}
224-
MSpecConstsBlob.resize(BlobOffset);
225226
}
227+
MSpecConstsBlob.resize(BlobOffset);
226228
}
227229
}
228230

0 commit comments

Comments
 (0)