Skip to content

Commit a5f3aca

Browse files
[SYCL] Initialize members of device_global map entries (#8451)
This commit adds default initializers to select members of DeviceGlobalMapEntry to avoid cases where bogus values would confuse late initialization of the entries. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent f3b5fad commit a5f3aca

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sycl/source/detail/device_global_map_entry.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ struct DeviceGlobalMapEntry {
8282
// The unique identifier of the device_global.
8383
std::string MUniqueId;
8484
// Pointer to the device_global on host.
85-
const void *MDeviceGlobalPtr;
85+
const void *MDeviceGlobalPtr = nullptr;
8686
// The image identifiers for the images using the device_global used by in the
8787
// cache.
8888
std::set<std::uintptr_t> MImageIdentifiers;
8989
// The kernel-set IDs for the images using the device_global.
9090
std::set<KernelSetId> MKSIds;
9191
// Size of the underlying type in the device_global.
92-
std::uint32_t MDeviceGlobalTSize;
92+
std::uint32_t MDeviceGlobalTSize = 0;
9393
// True if the device_global has been decorated with device_image_scope.
94-
bool MIsDeviceImageScopeDecorated;
94+
bool MIsDeviceImageScopeDecorated = false;
9595

9696
// Constructor for only initializing ID and pointer. The other members will
9797
// be initialized later.
@@ -103,8 +103,7 @@ struct DeviceGlobalMapEntry {
103103
DeviceGlobalMapEntry(std::string UniqueId, std::uintptr_t ImgId,
104104
KernelSetId KSId, std::uint32_t DeviceGlobalTSize,
105105
bool IsDeviceImageScopeDecorated)
106-
: MUniqueId(UniqueId), MDeviceGlobalPtr(nullptr),
107-
MImageIdentifiers{ImgId}, MKSIds{KSId},
106+
: MUniqueId(UniqueId), MImageIdentifiers{ImgId}, MKSIds{KSId},
108107
MDeviceGlobalTSize(DeviceGlobalTSize),
109108
MIsDeviceImageScopeDecorated(IsDeviceImageScopeDecorated) {}
110109

0 commit comments

Comments
 (0)