@@ -1208,130 +1208,141 @@ struct GenericPluginTy {
12081208
12091209 // / Returns non-zero if the \p Image is compatible with the plugin. This
12101210 // / 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);
12121212
12131213 // / 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);
12151216
12161217 // / 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 ;
12181219
12191220 // / Initialize the device inside of the plugin.
1220- int32_t init_device (int32_t DeviceId);
1221+ virtual int32_t init_device (int32_t DeviceId);
12211222
12221223 // / Return the number of devices this plugin can support.
1223- int32_t number_of_devices ();
1224+ virtual int32_t number_of_devices ();
12241225
12251226 // / 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);
12271228
12281229 // / 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);
12321234
12331235 // / 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);
12361238
12371239 // / 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);
12391242
12401243 // / 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);
12421245
12431246 // / 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);
12461249
12471250 // / 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);
12491252
12501253 // / 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);
12521256
12531257 // / 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);
12551259
12561260 // / 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);
12591263
12601264 // / 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);
12631268
12641269 // / 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);
12671272
12681273 // / 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);
12711277
12721278 // / 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);
12751282
12761283 // / 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);
12801288
12811289 // / 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);
12851294
12861295 // / 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);
12881297
12891298 // / 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);
12911300
12921301 // / 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);
12941303
12951304 // / 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);
12971306
12981307 // / 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);
13011310
13021311 // / 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);
13051314
13061315 // / 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);
13081317
13091318 // / 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);
13111320
13121321 // / Remove the event from the plugin.
13131322 void set_info_flag (uint32_t NewInfoLevel);
13141323
13151324 // / 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);
13171327
13181328 // / 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);
13211332
13221333 // / Sets the offset into the devices for use by OMPT.
13231334 int32_t set_device_identifier (int32_t UserId, int32_t DeviceId);
13241335
13251336 // / 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);
13271338
13281339 // / 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);
13311342
13321343 // / 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);
13351346
13361347private:
13371348 // / Indicates if the platform runtime has been fully initialized.
0 commit comments