Skip to content

Commit d2c67ca

Browse files
committed
SNONLIN: add loki annotation to interchange loops
1 parent a2450db commit d2c67ca

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

src/ecwam/ecwam_loki.config

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ block = ['ec_parkind', 'parkind_wave']
3838
allowed_aliases = "IJ"
3939
inline_elementals = false
4040

41+
# Loop transformations
42+
[transformations.TransformLoopsTransformation]
43+
module = "loki.transformations"
44+
[transformations.TransformLoopsTransformation.options]
45+
4146
# Split-read-write transformation
4247
[transformations.SplitReadWriteTransformation]
4348
module = "loki.transformations"
@@ -73,14 +78,14 @@ block = ['ec_parkind', 'parkind_wave']
7378
# loki pipelines
7479
[pipelines.idem]
7580
transformations = [
76-
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
77-
'IdemTransformation', 'ModuleWrapTransformation', 'DependencyTransformation'
81+
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation',
82+
'InlineTransformation', 'IdemTransformation', 'ModuleWrapTransformation', 'DependencyTransformation'
7883
]
7984

8085
[pipelines.idem-stack]
8186
transformations = [
82-
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation', 'IdemTransformation',
83-
'TemporariesPoolAllocatorTransformation', 'ModuleWrapTransformation', 'DependencyTransformation'
87+
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
88+
'IdemTransformation', 'TemporariesPoolAllocatorTransformation', 'ModuleWrapTransformation', 'DependencyTransformation'
8489
]
8590

8691
# Define entry point for call-tree transformation

src/ecwam/ecwam_loki_gpu.config

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ block = ['ec_parkind', 'parkind_wave', 'yowdrvtype']
5353
module = "loki.transformations"
5454
[transformations.GlobalVariableAnalysis.options]
5555

56+
# Loop transformations
57+
[transformations.TransformLoopsTransformation]
58+
module = "loki.transformations"
59+
[transformations.TransformLoopsTransformation.options]
60+
5661
# GlobalVarOffloadTransformation
5762
[transformations.GlobalVarOffloadTransformation]
5863
module = "loki.transformations"
@@ -105,20 +110,23 @@ block = ['ec_parkind', 'parkind_wave', 'yowdrvtype']
105110
# loki pipelines
106111
[pipelines.scc]
107112
transformations = [
108-
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation', 'GlobalVariableAnalysis',
109-
'GlobalVarOffloadTransformation', 'SCCVectorPipeline', 'ModuleWrapTransformation', 'DependencyTransformation'
113+
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
114+
'GlobalVariableAnalysis', 'GlobalVarOffloadTransformation', 'SCCVectorPipeline', 'ModuleWrapTransformation',
115+
'DependencyTransformation'
110116
]
111117

112118
[pipelines.scc-stack]
113119
transformations = [
114-
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation', 'GlobalVariableAnalysis',
115-
'GlobalVarOffloadTransformation', 'SCCStackPipeline', 'ModuleWrapTransformation', 'DependencyTransformation'
120+
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
121+
'GlobalVariableAnalysis', 'GlobalVarOffloadTransformation', 'SCCStackPipeline', 'ModuleWrapTransformation',
122+
'DependencyTransformation'
116123
]
117124

118125
[pipelines.scc-hoist]
119126
transformations = [
120-
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation', 'GlobalVariableAnalysis',
121-
'GlobalVarOffloadTransformation', 'SCCHoistPipeline', 'ModuleWrapTransformation', 'DependencyTransformation'
127+
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
128+
'GlobalVariableAnalysis', 'GlobalVarOffloadTransformation', 'SCCHoistPipeline', 'ModuleWrapTransformation',
129+
'DependencyTransformation'
122130
]
123131

124132
# Define entry point for call-tree transformation

src/ecwam/snonlin.F90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ SUBROUTINE SNONLIN (KIJS, KIJL, FL1, FLD, SL, WAVNUM, DEPTH, AKMEAN)
222222
IF (MC > MFR1STFR .AND. MC < MFRLSTFR ) THEN
223223
! the interactions for MC are all within the fully resolved spectral domain
224224

225+
!$loki loop-interchange
225226
DO KH=1,2
226227
DO K=1,NANG
227228
K1 = K1W (K,KH)
@@ -309,6 +310,7 @@ SUBROUTINE SNONLIN (KIJS, KIJL, FL1, FLD, SL, WAVNUM, DEPTH, AKMEAN)
309310
ENDDO
310311

311312
ELSEIF (MC >= MFRLSTFR ) THEN
313+
!$loki loop-interchange
312314
DO KH=1,2
313315
DO K=1,NANG
314316
K1 = K1W (K,KH)
@@ -411,6 +413,7 @@ SUBROUTINE SNONLIN (KIJS, KIJL, FL1, FLD, SL, WAVNUM, DEPTH, AKMEAN)
411413

412414
ELSE
413415

416+
!$loki loop-interchange
414417
DO KH=1,2
415418
DO K=1,NANG
416419
K1 = K1W (K,KH)

0 commit comments

Comments
 (0)