loki.transformations.data_offload.field_offload
Functions
|
|
|
Add a set of data pointer declarations to a given |
|
Finds the sets of array variable symbols for which we can generate Field API offload code. |
|
Classes
|
Transformation to offload arrays owned by Field API fields to the device. |
- class FieldOffloadTransformation(devptr_prefix=None, field_group_types=None, offload_index=None)
Bases:
Transformation
Transformation to offload arrays owned by Field API fields to the device.
This transformation is IFS specific.
The transformation assumes that fields are wrapped in derived types specified in
field_group_types
and will only offload arrays that are members of such derived types. In the process this transformation removes calls to Field APIupdate_view
and adds declarations for the device pointers to the driver subroutine.The transformation acts on
!$loki data
regions and offloads allArray
symbols that satisfy the following conditions:The array is a member of an object that is of type specified in
field_group_types
.The array is passed as a parameter to at least one of the kernel targets passed to
transform_subroutine
.
- Parameters:
devptr_prefix (str, optional) – The prefix of device pointers added by this transformation (defaults to
'loki_devptr_'
).field_group_types (list or tuple of str, optional) – Names of the field group types with members that may be offloaded (defaults to
['']
).offload_index (str, optional) – Names of index variable to inject in the outmost dimension of offloaded arrays in the kernel calls (defaults to
'IBL'
).
- transform_subroutine(routine, **kwargs)
Defines the transformation to apply to
Subroutine
items.For transformations that modify
Subroutine
objects, this method should be implemented. It gets called via the dispatch methodapply()
.- Parameters:
routine (
Subroutine
) – The subroutine to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- process_driver(driver)
- find_offload_variables(driver, region, field_group_types)
Finds the sets of array variable symbols for which we can generate Field API offload code.
Note
This method requires Loki’s dataflow analysis to be run on the
region
viadataflow_analysis_attached()
.- Parameters:
region (
PragmaRegion
) – Code region object for which to determine offload variablesfield_group_types (list or tuple of str, optional) – Names of the field group types with members that may be offloaded (defaults to
['']
).
- Returns:
(inargs, inoutargs, outargs) – The sets of array symbols split into three tuples according to access type.
- Return type:
- add_field_offload_calls(driver, region, offload_map)
- replace_kernel_args(driver, offload_map, offload_index)