@@ -1208,130 +1208,141 @@ struct GenericPluginTy {
1208
1208
1209
1209
// / Returns non-zero if the \p Image is compatible with the plugin. This
1210
1210
// / function does not require the plugin to be initialized before use.
1211
- int32_t is_plugin_compatible (__tgt_device_image *Image);
1211
+ virtual int32_t is_plugin_compatible (__tgt_device_image *Image);
1212
1212
1213
1213
// / Returns non-zero if the \p Image is compatible with the device.
1214
- int32_t is_device_compatible (int32_t DeviceId, __tgt_device_image *Image);
1214
+ virtual int32_t is_device_compatible (int32_t DeviceId,
1215
+ __tgt_device_image *Image);
1215
1216
1216
1217
// / Returns non-zero if the plugin device has been initialized.
1217
- int32_t is_device_initialized (int32_t DeviceId) const ;
1218
+ virtual int32_t is_device_initialized (int32_t DeviceId) const ;
1218
1219
1219
1220
// / Initialize the device inside of the plugin.
1220
- int32_t init_device (int32_t DeviceId);
1221
+ virtual int32_t init_device (int32_t DeviceId);
1221
1222
1222
1223
// / Return the number of devices this plugin can support.
1223
- int32_t number_of_devices ();
1224
+ virtual int32_t number_of_devices ();
1224
1225
1225
1226
// / Returns non-zero if the data can be exchanged between the two devices.
1226
- int32_t is_data_exchangable (int32_t SrcDeviceId, int32_t DstDeviceId);
1227
+ virtual int32_t is_data_exchangable (int32_t SrcDeviceId, int32_t DstDeviceId);
1227
1228
1228
1229
// / Initializes the record and replay mechanism inside the plugin.
1229
- int32_t initialize_record_replay (int32_t DeviceId, int64_t MemorySize,
1230
- void *VAddr, bool isRecord, bool SaveOutput,
1231
- uint64_t &ReqPtrArgOffset);
1230
+ virtual int32_t initialize_record_replay (int32_t DeviceId, int64_t MemorySize,
1231
+ void *VAddr, bool isRecord,
1232
+ bool SaveOutput,
1233
+ uint64_t &ReqPtrArgOffset);
1232
1234
1233
1235
// / Loads the associated binary into the plugin and returns a handle to it.
1234
- int32_t load_binary (int32_t DeviceId, __tgt_device_image *TgtImage,
1235
- __tgt_device_binary *Binary);
1236
+ virtual int32_t load_binary (int32_t DeviceId, __tgt_device_image *TgtImage,
1237
+ __tgt_device_binary *Binary);
1236
1238
1237
1239
// / Allocates memory that is accessively to the given device.
1238
- void *data_alloc (int32_t DeviceId, int64_t Size, void *HostPtr, int32_t Kind);
1240
+ virtual void *data_alloc (int32_t DeviceId, int64_t Size, void *HostPtr,
1241
+ int32_t Kind);
1239
1242
1240
1243
// / Deallocates memory on the given device.
1241
- int32_t data_delete (int32_t DeviceId, void *TgtPtr, int32_t Kind);
1244
+ virtual int32_t data_delete (int32_t DeviceId, void *TgtPtr, int32_t Kind);
1242
1245
1243
1246
// / Locks / pins host memory using the plugin runtime.
1244
- int32_t data_lock (int32_t DeviceId, void *Ptr, int64_t Size,
1245
- void **LockedPtr);
1247
+ virtual int32_t data_lock (int32_t DeviceId, void *Ptr, int64_t Size,
1248
+ void **LockedPtr);
1246
1249
1247
1250
// / Unlocks / unpins host memory using the plugin runtime.
1248
- int32_t data_unlock (int32_t DeviceId, void *Ptr);
1251
+ virtual int32_t data_unlock (int32_t DeviceId, void *Ptr);
1249
1252
1250
1253
// / Notify the runtime about a new mapping that has been created outside.
1251
- int32_t data_notify_mapped (int32_t DeviceId, void *HstPtr, int64_t Size);
1254
+ virtual int32_t data_notify_mapped (int32_t DeviceId, void *HstPtr,
1255
+ int64_t Size);
1252
1256
1253
1257
// / Notify t he runtime about a mapping that has been deleted.
1254
- int32_t data_notify_unmapped (int32_t DeviceId, void *HstPtr);
1258
+ virtual int32_t data_notify_unmapped (int32_t DeviceId, void *HstPtr);
1255
1259
1256
1260
// / Copy data to the given device.
1257
- int32_t data_submit (int32_t DeviceId, void *TgtPtr, void *HstPtr,
1258
- int64_t Size);
1261
+ virtual int32_t data_submit (int32_t DeviceId, void *TgtPtr, void *HstPtr,
1262
+ int64_t Size);
1259
1263
1260
1264
// / Copy data to the given device asynchronously.
1261
- int32_t data_submit_async (int32_t DeviceId, void *TgtPtr, void *HstPtr,
1262
- int64_t Size, __tgt_async_info *AsyncInfoPtr);
1265
+ virtual int32_t data_submit_async (int32_t DeviceId, void *TgtPtr,
1266
+ void *HstPtr, int64_t Size,
1267
+ __tgt_async_info *AsyncInfoPtr);
1263
1268
1264
1269
// / Copy data from the given device.
1265
- int32_t data_retrieve (int32_t DeviceId, void *HstPtr, void *TgtPtr,
1266
- int64_t Size);
1270
+ virtual int32_t data_retrieve (int32_t DeviceId, void *HstPtr, void *TgtPtr,
1271
+ int64_t Size);
1267
1272
1268
1273
// / Copy data from the given device asynchornously.
1269
- int32_t data_retrieve_async (int32_t DeviceId, void *HstPtr, void *TgtPtr,
1270
- int64_t Size, __tgt_async_info *AsyncInfoPtr);
1274
+ virtual int32_t data_retrieve_async (int32_t DeviceId, void *HstPtr,
1275
+ void *TgtPtr, int64_t Size,
1276
+ __tgt_async_info *AsyncInfoPtr);
1271
1277
1272
1278
// / Exchange memory addresses between two devices.
1273
- int32_t data_exchange (int32_t SrcDeviceId, void *SrcPtr, int32_t DstDeviceId,
1274
- void *DstPtr, int64_t Size);
1279
+ virtual int32_t data_exchange (int32_t SrcDeviceId, void *SrcPtr,
1280
+ int32_t DstDeviceId, void *DstPtr,
1281
+ int64_t Size);
1275
1282
1276
1283
// / Exchange memory addresses between two devices asynchronously.
1277
- int32_t data_exchange_async (int32_t SrcDeviceId, void *SrcPtr,
1278
- int DstDeviceId, void *DstPtr, int64_t Size,
1279
- __tgt_async_info *AsyncInfo);
1284
+ virtual int32_t data_exchange_async (int32_t SrcDeviceId, void *SrcPtr,
1285
+ int DstDeviceId, void *DstPtr,
1286
+ int64_t Size,
1287
+ __tgt_async_info *AsyncInfo);
1280
1288
1281
1289
// / Begin executing a kernel on the given device.
1282
- int32_t launch_kernel (int32_t DeviceId, void *TgtEntryPtr, void **TgtArgs,
1283
- ptrdiff_t *TgtOffsets, KernelArgsTy *KernelArgs,
1284
- __tgt_async_info *AsyncInfoPtr);
1290
+ virtual int32_t launch_kernel (int32_t DeviceId, void *TgtEntryPtr,
1291
+ void **TgtArgs, ptrdiff_t *TgtOffsets,
1292
+ KernelArgsTy *KernelArgs,
1293
+ __tgt_async_info *AsyncInfoPtr);
1285
1294
1286
1295
// / Synchronize an asyncrhonous queue with the plugin runtime.
1287
- int32_t synchronize (int32_t DeviceId, __tgt_async_info *AsyncInfoPtr);
1296
+ virtual int32_t synchronize (int32_t DeviceId, __tgt_async_info *AsyncInfoPtr);
1288
1297
1289
1298
// / Query the current state of an asynchronous queue.
1290
- int32_t query_async (int32_t DeviceId, __tgt_async_info *AsyncInfoPtr);
1299
+ virtual int32_t query_async (int32_t DeviceId, __tgt_async_info *AsyncInfoPtr);
1291
1300
1292
1301
// / Prints information about the given devices supported by the plugin.
1293
- void print_device_info (int32_t DeviceId);
1302
+ virtual void print_device_info (int32_t DeviceId);
1294
1303
1295
1304
// / Creates an event in the given plugin if supported.
1296
- int32_t create_event (int32_t DeviceId, void **EventPtr);
1305
+ virtual int32_t create_event (int32_t DeviceId, void **EventPtr);
1297
1306
1298
1307
// / Records an event that has occurred.
1299
- int32_t record_event (int32_t DeviceId, void *EventPtr,
1300
- __tgt_async_info *AsyncInfoPtr);
1308
+ virtual int32_t record_event (int32_t DeviceId, void *EventPtr,
1309
+ __tgt_async_info *AsyncInfoPtr);
1301
1310
1302
1311
// / Wait until an event has occurred.
1303
- int32_t wait_event (int32_t DeviceId, void *EventPtr,
1304
- __tgt_async_info *AsyncInfoPtr);
1312
+ virtual int32_t wait_event (int32_t DeviceId, void *EventPtr,
1313
+ __tgt_async_info *AsyncInfoPtr);
1305
1314
1306
1315
// / Syncrhonize execution until an event is done.
1307
- int32_t sync_event (int32_t DeviceId, void *EventPtr);
1316
+ virtual int32_t sync_event (int32_t DeviceId, void *EventPtr);
1308
1317
1309
1318
// / Remove the event from the plugin.
1310
- int32_t destroy_event (int32_t DeviceId, void *EventPtr);
1319
+ virtual int32_t destroy_event (int32_t DeviceId, void *EventPtr);
1311
1320
1312
1321
// / Remove the event from the plugin.
1313
1322
void set_info_flag (uint32_t NewInfoLevel);
1314
1323
1315
1324
// / Creates an asynchronous queue for the given plugin.
1316
- int32_t init_async_info (int32_t DeviceId, __tgt_async_info **AsyncInfoPtr);
1325
+ virtual int32_t init_async_info (int32_t DeviceId,
1326
+ __tgt_async_info **AsyncInfoPtr);
1317
1327
1318
1328
// / Creates device information to be used for diagnostics.
1319
- int32_t init_device_info (int32_t DeviceId, __tgt_device_info *DeviceInfo,
1320
- const char **ErrStr);
1329
+ virtual int32_t init_device_info (int32_t DeviceId,
1330
+ __tgt_device_info *DeviceInfo,
1331
+ const char **ErrStr);
1321
1332
1322
1333
// / Sets the offset into the devices for use by OMPT.
1323
1334
int32_t set_device_identifier (int32_t UserId, int32_t DeviceId);
1324
1335
1325
1336
// / Returns if the plugin can support auotmatic copy.
1326
- int32_t use_auto_zero_copy (int32_t DeviceId);
1337
+ virtual int32_t use_auto_zero_copy (int32_t DeviceId);
1327
1338
1328
1339
// / Look up a global symbol in the given binary.
1329
- int32_t get_global (__tgt_device_binary Binary, uint64_t Size,
1330
- const char *Name, void **DevicePtr);
1340
+ virtual int32_t get_global (__tgt_device_binary Binary, uint64_t Size,
1341
+ const char *Name, void **DevicePtr);
1331
1342
1332
1343
// / Look up a kernel function in the given binary.
1333
- int32_t get_function (__tgt_device_binary Binary, const char *Name,
1334
- void **KernelPtr);
1344
+ virtual int32_t get_function (__tgt_device_binary Binary, const char *Name,
1345
+ void **KernelPtr);
1335
1346
1336
1347
private:
1337
1348
// / Indicates if the platform runtime has been fully initialized.
0 commit comments