loki.transformations.split_read_write
Classes
|
When accumulating values to multiple components of an array, a compiler cannot rule out the possibility that the indices alias the same address. |
|
A |
- class SplitReadWriteTransformation(dimensions)
Bases:
TransformationWhen accumulating values to multiple components of an array, a compiler cannot rule out the possibility that the indices alias the same address. Consider for example the following code:
!$loki split-read-write do jlon=1,nproma var(jlon, n1) = var(jlon, n1) + 1. var(jlon, n2) = var(jlon, n2) + 1. enddo !$loki end split-read-write
In the above example, there is no guarantee that
n1andn2do not in fact point to the same location. Therefore the load and store instructions forvarhave to be executed in order.For cases where the user knows
n1andn2indeed represent distinct locations, this transformation provides a pragma assisted mechanism to split the reads and writes, and therefore make the loads independent from the stores. The above code would therefore be transformed to:!$loki split-read-write do jlon=1,nproma loki_temp_0(jlon) = var(jlon, n1) + 1. loki_temp_1(jlon) = var(jlon, n2) + 1. enddo do jlon=1,nproma var(jlon, n1) = loki_temp_0(jlon) var(jlon, n2) = loki_temp_1(jlon) enddo !$loki end split-read-write
- Parameters:
dimensions (list) – A list of
Dimensionobjects corresponding to allLoop`s in the `!$loki split-read-write`` region.
- item_filter = (<class 'loki.batch.item.ProcedureItem'>,)
- transform_subroutine(routine, **kwargs)
Defines the transformation to apply to
Subroutineitems.For transformations that modify
Subroutineobjects, 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.