@@ -220,6 +220,10 @@ static void
register_main_image ()
{
__offload_register_image (&main_target_image);
+
+ /* liboffloadmic will call GOMP_PLUGIN_target_task_completion when
+ asynchronous task on target is completed. */
+ __offload_register_task_callback (GOMP_PLUGIN_target_task_completion);
}
/* liboffloadmic loads and runs offload_target_main on all available devices
@@ -537,13 +541,3 @@ GOMP_OFFLOAD_run (int device, void *tgt_fn, void *tgt_vars)
GOMP_OFFLOAD_async_run (device, tgt_fn, tgt_vars, NULL);
}
-
-/* Called by liboffloadmic when asynchronous function is completed. */
-
-extern "C" void
-__gomp_offload_intelmic_async_completed (const void *async_data)
-{
- TRACE ("(async_data = %p)", async_data);
-
- GOMP_PLUGIN_target_task_completion ((void *) async_data);
-}
@@ -64,8 +64,7 @@ static void __offload_fini_library(void);
#define GET_OFFLOAD_NUMBER(timer_data) \
timer_data? timer_data->offload_number : 0
-extern "C" void
-__gomp_offload_intelmic_async_completed (const void *);
+static void (*task_completion_callback)(void *);
extern "C" {
#ifdef TARGET_WINNT
@@ -2510,7 +2509,7 @@ extern "C" {
const void *info
)
{
- __gomp_offload_intelmic_async_completed (info);
+ task_completion_callback ((void *) info);
}
}
@@ -5672,6 +5671,11 @@ extern "C" void __offload_unregister_image(const void *target_image)
}
}
+extern "C" void __offload_register_task_callback(void (*cb)(void *))
+{
+ task_completion_callback = cb;
+}
+
// Runtime trace interface for user programs
void __offload_console_trace(int level)
@@ -376,6 +376,9 @@ extern "C" bool __offload_target_image_is_executable(const void *target_image);
extern "C" bool __offload_register_image(const void* image);
extern "C" void __offload_unregister_image(const void* image);
+// Registers asynchronous task completion callback
+extern "C" void __offload_register_task_callback(void (*cb)(void *));
+
// Initializes offload runtime library.
DLL_LOCAL extern int __offload_init_library(void);