@@ -86,57 +86,64 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
86
86
87
87
const plugin &getPlugin () const ;
88
88
89
- size_t getSize () const override { return MSizeInBytes; }
90
- size_t get_count () const {
89
+ DLL_LOCAL size_t getSize () const override { return MSizeInBytes; }
90
+ DLL_LOCAL size_t get_count () const {
91
91
size_t AllocatorValueSize = MAllocator->getValueSize ();
92
92
return (getSize () + AllocatorValueSize - 1 ) / AllocatorValueSize;
93
93
}
94
94
95
- template <typename propertyT> bool has_property () const {
95
+ template <typename propertyT> DLL_LOCAL bool has_property () const {
96
96
return MProps.has_property <propertyT>();
97
97
}
98
98
99
- template <typename propertyT> propertyT get_property () const {
99
+ template <typename propertyT> DLL_LOCAL propertyT get_property () const {
100
100
return MProps.get_property <propertyT>();
101
101
}
102
102
103
- template <typename AllocatorT> AllocatorT get_allocator () const {
103
+ template <typename AllocatorT> DLL_LOCAL AllocatorT get_allocator () const {
104
104
return MAllocator->getAllocator <AllocatorT>();
105
105
}
106
106
107
- void *allocateHostMem () override { return MAllocator->allocate (get_count ()); }
107
+ DLL_LOCAL void *allocateHostMem () override {
108
+ return MAllocator->allocate (get_count ());
109
+ }
108
110
109
- void releaseHostMem (void *Ptr) override {
111
+ DLL_LOCAL void releaseHostMem (void *Ptr) override {
110
112
if (Ptr)
111
113
MAllocator->deallocate (Ptr, get_count ());
112
114
}
113
115
114
116
void releaseMem (ContextImplPtr Context, void *MemAllocation) override ;
115
117
116
- void *getUserPtr () const {
118
+ DLL_LOCAL void *getUserPtr () const {
117
119
return MOpenCLInterop ? static_cast <void *>(MInteropMemObject) : MUserPtr;
118
120
}
119
121
120
- void set_write_back (bool NeedWriteBack) { MNeedWriteBack = NeedWriteBack; }
122
+ DLL_LOCAL void set_write_back (bool NeedWriteBack) {
123
+ MNeedWriteBack = NeedWriteBack;
124
+ }
121
125
122
- void set_final_data (std::nullptr_t ) { MUploadDataFunctor = nullptr ; }
126
+ DLL_LOCAL void set_final_data (std::nullptr_t ) {
127
+ MUploadDataFunctor = nullptr ;
128
+ }
123
129
124
130
template <template <typename T> class PtrT , typename T>
125
- enable_if_t <std::is_convertible<PtrT<T>, weak_ptr_class<T>>::value>
131
+ DLL_LOCAL enable_if_t <std::is_convertible<PtrT<T>, weak_ptr_class<T>>::value>
126
132
set_final_data (PtrT<T> FinalData) {
127
133
weak_ptr_class<T> TempFinalData (FinalData);
128
134
set_final_data (TempFinalData);
129
135
}
130
136
131
- template <typename T> void set_final_data (weak_ptr_class<T> FinalData) {
137
+ template <typename T>
138
+ DLL_LOCAL void set_final_data (weak_ptr_class<T> FinalData) {
132
139
MUploadDataFunctor = [this , FinalData]() {
133
140
if (shared_ptr_class<T> LockedFinalData = FinalData.lock ()) {
134
141
updateHostMemory (LockedFinalData.get ());
135
142
}
136
143
};
137
144
}
138
145
139
- void set_final_data_from_storage () {
146
+ DLL_LOCAL void set_final_data_from_storage () {
140
147
MUploadDataFunctor = [this ]() {
141
148
if (!MSharedPtrStorage.unique ()) {
142
149
void *FinalData = const_cast <void *>(MSharedPtrStorage.get ());
@@ -146,7 +153,8 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
146
153
}
147
154
148
155
template <typename Destination>
149
- EnableIfOutputPointerT<Destination> set_final_data (Destination FinalData) {
156
+ DLL_LOCAL EnableIfOutputPointerT<Destination>
157
+ set_final_data (Destination FinalData) {
150
158
if (!FinalData)
151
159
MUploadDataFunctor = nullptr ;
152
160
else
@@ -156,7 +164,8 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
156
164
}
157
165
158
166
template <typename Destination>
159
- EnableIfOutputIteratorT<Destination> set_final_data (Destination FinalData) {
167
+ DLL_LOCAL EnableIfOutputIteratorT<Destination>
168
+ set_final_data (Destination FinalData) {
160
169
MUploadDataFunctor = [this , FinalData]() {
161
170
using DestinationValueT = iterator_value_type_t <Destination>;
162
171
// TODO if Destination is ContiguousIterator then don't create
@@ -179,18 +188,18 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
179
188
// members must be alive.
180
189
void updateHostMemory ();
181
190
182
- bool useHostPtr () {
191
+ DLL_LOCAL bool useHostPtr () {
183
192
return has_property<property::buffer::use_host_ptr>() ||
184
193
has_property<property::image::use_host_ptr>();
185
194
}
186
195
187
- bool canReuseHostPtr (void *HostPtr, const size_t RequiredAlign) {
196
+ DLL_LOCAL bool canReuseHostPtr (void *HostPtr, const size_t RequiredAlign) {
188
197
bool Aligned =
189
198
(reinterpret_cast <std::uintptr_t >(HostPtr) % RequiredAlign) == 0 ;
190
199
return Aligned || useHostPtr ();
191
200
}
192
201
193
- void handleHostData (void *HostPtr, const size_t RequiredAlign) {
202
+ DLL_LOCAL void handleHostData (void *HostPtr, const size_t RequiredAlign) {
194
203
if (!MHostPtrReadOnly)
195
204
set_final_data (reinterpret_cast <char *>(HostPtr));
196
205
@@ -204,14 +213,15 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
204
213
}
205
214
}
206
215
207
- void handleHostData (const void *HostPtr, const size_t RequiredAlign) {
216
+ DLL_LOCAL void handleHostData (const void *HostPtr,
217
+ const size_t RequiredAlign) {
208
218
MHostPtrReadOnly = true ;
209
219
handleHostData (const_cast <void *>(HostPtr), RequiredAlign);
210
220
}
211
221
212
222
template <typename T>
213
- void handleHostData (const shared_ptr_class<T> &HostPtr,
214
- const size_t RequiredAlign) {
223
+ DLL_LOCAL void handleHostData (const shared_ptr_class<T> &HostPtr,
224
+ const size_t RequiredAlign) {
215
225
MSharedPtrStorage = HostPtr;
216
226
MHostPtrReadOnly = std::is_const<T>::value;
217
227
if (HostPtr) {
@@ -230,8 +240,8 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
230
240
}
231
241
232
242
template <class InputIterator >
233
- void handleHostData (InputIterator First, InputIterator Last,
234
- const size_t RequiredAlign) {
243
+ DLL_LOCAL void handleHostData (InputIterator First, InputIterator Last,
244
+ const size_t RequiredAlign) {
235
245
MHostPtrReadOnly = iterator_to_const_type_t <InputIterator>::value;
236
246
setAlign (RequiredAlign);
237
247
if (useHostPtr ())
@@ -254,23 +264,24 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
254
264
static_cast <IteratorPointerToNonConstValueType>(MUserPtr));
255
265
}
256
266
257
- void setAlign (size_t RequiredAlign) {
267
+ DLL_LOCAL void setAlign (size_t RequiredAlign) {
258
268
MAllocator->setAlignment (RequiredAlign);
259
269
}
260
270
261
271
static size_t getBufSizeForContext (const ContextImplPtr &Context,
262
272
cl_mem MemObject);
263
273
264
- void *allocateMem (ContextImplPtr Context, bool InitFromUserData,
265
- void *HostPtr, RT::PiEvent &InteropEvent) override {
274
+ DLL_LOCAL void *allocateMem (ContextImplPtr Context, bool InitFromUserData,
275
+ void *HostPtr,
276
+ RT::PiEvent &InteropEvent) override {
266
277
(void )Context;
267
278
(void )InitFromUserData;
268
279
(void )HostPtr;
269
280
(void )InteropEvent;
270
281
throw runtime_error (" Not implemented" , PI_INVALID_OPERATION);
271
282
}
272
283
273
- MemObjType getType () const override { return UNDEFINED; }
284
+ DLL_LOCAL MemObjType getType () const override { return UNDEFINED; }
274
285
275
286
protected:
276
287
// Allocator used for allocation memory on host.
0 commit comments