14
14
#include < mutex>
15
15
#include < optional>
16
16
#include < set>
17
+ #include < unordered_set>
17
18
18
19
#include < detail/pi_utils.hpp>
19
20
#include < sycl/detail/defines_elementary.hpp>
@@ -51,11 +52,11 @@ struct DeviceGlobalMapEntry {
51
52
std::string MUniqueId;
52
53
// Pointer to the device_global on host.
53
54
const void *MDeviceGlobalPtr = nullptr ;
55
+ // Images device_global are used by.
56
+ std::unordered_set<RTDeviceBinaryImage *> MImages;
54
57
// The image identifiers for the images using the device_global used by in the
55
58
// cache.
56
59
std::set<std::uintptr_t > MImageIdentifiers;
57
- // The kernel-set IDs for the images using the device_global.
58
- std::set<KernelSetId> MKSIds;
59
60
// Size of the underlying type in the device_global.
60
61
std::uint32_t MDeviceGlobalTSize = 0 ;
61
62
// True if the device_global has been decorated with device_image_scope.
@@ -68,10 +69,11 @@ struct DeviceGlobalMapEntry {
68
69
69
70
// Constructor for only initializing ID, type size, and device image scope
70
71
// flag. The pointer to the device global will be initialized later.
71
- DeviceGlobalMapEntry (std::string UniqueId, std:: uintptr_t ImgId ,
72
- KernelSetId KSId, std::uint32_t DeviceGlobalTSize,
72
+ DeviceGlobalMapEntry (std::string UniqueId, RTDeviceBinaryImage *Img ,
73
+ std::uint32_t DeviceGlobalTSize,
73
74
bool IsDeviceImageScopeDecorated)
74
- : MUniqueId(UniqueId), MImageIdentifiers{ImgId}, MKSIds{KSId},
75
+ : MUniqueId(UniqueId), MImages{Img},
76
+ MImageIdentifiers{reinterpret_cast <uintptr_t >(Img)},
75
77
MDeviceGlobalTSize (DeviceGlobalTSize),
76
78
MIsDeviceImageScopeDecorated (IsDeviceImageScopeDecorated) {}
77
79
@@ -85,8 +87,7 @@ struct DeviceGlobalMapEntry {
85
87
86
88
// Initialize the device_global's element type size and the flag signalling
87
89
// if the device_global has the device_image_scope property.
88
- void initialize (std::uintptr_t ImgId, KernelSetId KSId,
89
- std::uint32_t DeviceGlobalTSize,
90
+ void initialize (RTDeviceBinaryImage *Img, std::uint32_t DeviceGlobalTSize,
90
91
bool IsDeviceImageScopeDecorated) {
91
92
if (MDeviceGlobalTSize != 0 ) {
92
93
// The device global entry has already been initialized. This can happen
@@ -99,8 +100,8 @@ struct DeviceGlobalMapEntry {
99
100
" Device global intializations disagree on image scope decoration." );
100
101
return ;
101
102
}
102
- MImageIdentifiers .insert (ImgId );
103
- MKSIds .insert (KSId );
103
+ MImages .insert (Img );
104
+ MImageIdentifiers .insert (reinterpret_cast < uintptr_t >(Img) );
104
105
MDeviceGlobalTSize = DeviceGlobalTSize;
105
106
MIsDeviceImageScopeDecorated = IsDeviceImageScopeDecorated;
106
107
}
0 commit comments