Intel® C++ Compiler 16.0 User and Reference Guide
Puts the task into the in-order offload queue. This topic only applies to Intel® 64 and IA-32 architectures targeting Intel® Graphics Technology. This function replaces the deprecated function _GFX_enqueue.
C/C++ API
GfxTaskId _GFX_offload(const void *ptr, arg_list);
C++ API with Variadic Template Support
template <typename T, typename ... ArgType> GFX_RT_API GfxTaskId _GFX_offload(T ptr, ArgType ... arg_list);
C++ API without Variadic Template Support
template <typename T, typename ArgT1> GFX_RT_API GfxTaskId _GFX_offload(T ptr, ArgT1 arg1); template <typename T, typename ArgT1, typename ArgT2> GFX_RT_API GfxTaskId _GFX_offload(T ptr, ArgT1 arg1, ArgT2 arg2); ... template <typename T, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, typename ArgT7, typename ArgT8> GFX_RT_API GfxTaskId _GFX_offload(T ptr, ArgT1 arg1, ArgT2 arg2, ArgT3 arg3, ArgT4 arg4, ArgT5 arg5, ArgT6 arg6, ArgT7 arg7, ArgT8 arg8);
*ptr |
A pointer to a function representing a kernel. The function must be declared with the attribute __declspec(target(gfx_kernel)). |
arg_list |
The argument list for the kernel as variable argument list. The list must match the kernel parameter list. The runtime knows which arguments to expect from kernel attributes. |
T |
A function pointer type denoting the type of the offloaded kernel. |
ArgType |
The argument list for the kernel as variable argument list. The list must match the kernel parameter list. The runtime knows which arguments to expect from kernel attributes. |
T1, ..., T8 |
Types of kernel parameters. |
This function performs all necessary operations to put an offload task into the queue. Specify the kernel using the given kernel entry function pointer. This function passes the parameters to the kernel entry function, with necessary preparation operations for some special data types, such as 2D images or pointers.
The template variants of this function with and without variadic template support enforce actual and formal parameter matching between offload calls and the invoked kernel. With the variadic template only, the compiler enforces type checking using a special prolog in the beginning of the implementation of the function: if (false) ptr(args...);. Use this variant unless you specifically do not want variadic templates.
No extra general runtime initialization is necessary. The function performs all necessary initialization operations if they are not already done earlier.
This function is non-blocking. It does not wait for the completion of incoming tasks.
Dispatching and task splitting between the CPU and the processor graphics is not in the scope of this function, so you should organize these explicitly. The compiler assists you by generating host and target versions for all target functions, including the kernel entry function, and by providing compatible semantics for _Cilk_for loops in the kernel entry point.
The Intel® Graphics Technology runtime maintains only one default queue, for simplicity.
Use the _GFX_wait function wait for completion of a task that _GFX_offload created and enqueued.
This function is thread safe; it can be accessed from different host threads without extra synchronization effort on your part.
task id |
The task id for the enqueued offload task. You can pass this value to _GFX_wait to wait for task completion. The task id is an incremental 64 bit integer value assigned to each new task. It provides for safe usage in a multithreaded environment, without relying on the user to explicitly close and destroy each enqueued task. |
0 |
An error has occurred. Use the function _GFX_get_last_error() to get the specific error code. |