Task context

Note: For more information, refer to Buffer types.

A task context is used to address the following usage scenarios:

Common persistent data across work blocks

A task context can be used as common persistent referenced data for all work blocks in a task. This is especially useful for static input data, lookup tables, or any other input data that is common to all work blocks. Because the ALF runtime loads the task context to accelerator memory before any work block is processed, you can be assured that the common data is always there for the work blocks to use.

Reducing partial results across work blocks

A task context can be used to incrementally update the final result of a task based on each work block's computation. For these applications, the computational results of separate work blocks are the intermediate results. These intermediate results are stored in the task context. You can update the task context in the computational kernel as part of the work block computation. After all the work blocks have been processed, the ALF runtime applies a reduction step to merge the intermediate results of the task instances into a single final result using the provided alf_accel_task_context_merge function.
For an example about how to apply the concept of task context to find the maximum value or the minimum value of a large data set, see Min-max finder example.