Skip to content

Commit

Permalink
SNONLIN: add loki annotation to interchange loops
Browse files Browse the repository at this point in the history
  • Loading branch information
awnawab committed Nov 6, 2024
1 parent a2450db commit d2c67ca
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
13 changes: 9 additions & 4 deletions src/ecwam/ecwam_loki.config
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ block = ['ec_parkind', 'parkind_wave']
allowed_aliases = "IJ"
inline_elementals = false

# Loop transformations
[transformations.TransformLoopsTransformation]
module = "loki.transformations"
[transformations.TransformLoopsTransformation.options]

# Split-read-write transformation
[transformations.SplitReadWriteTransformation]
module = "loki.transformations"
Expand Down Expand Up @@ -73,14 +78,14 @@ block = ['ec_parkind', 'parkind_wave']
# loki pipelines
[pipelines.idem]
transformations = [
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
'IdemTransformation', 'ModuleWrapTransformation', 'DependencyTransformation'
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation',
'InlineTransformation', 'IdemTransformation', 'ModuleWrapTransformation', 'DependencyTransformation'
]

[pipelines.idem-stack]
transformations = [
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation', 'IdemTransformation',
'TemporariesPoolAllocatorTransformation', 'ModuleWrapTransformation', 'DependencyTransformation'
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
'IdemTransformation', 'TemporariesPoolAllocatorTransformation', 'ModuleWrapTransformation', 'DependencyTransformation'
]

# Define entry point for call-tree transformation
Expand Down
20 changes: 14 additions & 6 deletions src/ecwam/ecwam_loki_gpu.config
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ block = ['ec_parkind', 'parkind_wave', 'yowdrvtype']
module = "loki.transformations"
[transformations.GlobalVariableAnalysis.options]

# Loop transformations
[transformations.TransformLoopsTransformation]
module = "loki.transformations"
[transformations.TransformLoopsTransformation.options]

# GlobalVarOffloadTransformation
[transformations.GlobalVarOffloadTransformation]
module = "loki.transformations"
Expand Down Expand Up @@ -105,20 +110,23 @@ block = ['ec_parkind', 'parkind_wave', 'yowdrvtype']
# loki pipelines
[pipelines.scc]
transformations = [
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation', 'GlobalVariableAnalysis',
'GlobalVarOffloadTransformation', 'SCCVectorPipeline', 'ModuleWrapTransformation', 'DependencyTransformation'
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
'GlobalVariableAnalysis', 'GlobalVarOffloadTransformation', 'SCCVectorPipeline', 'ModuleWrapTransformation',
'DependencyTransformation'
]

[pipelines.scc-stack]
transformations = [
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation', 'GlobalVariableAnalysis',
'GlobalVarOffloadTransformation', 'SCCStackPipeline', 'ModuleWrapTransformation', 'DependencyTransformation'
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
'GlobalVariableAnalysis', 'GlobalVarOffloadTransformation', 'SCCStackPipeline', 'ModuleWrapTransformation',
'DependencyTransformation'
]

[pipelines.scc-hoist]
transformations = [
'RemoveCodeTransformation', 'SplitReadWriteTransformation', 'InlineTransformation', 'GlobalVariableAnalysis',
'GlobalVarOffloadTransformation', 'SCCHoistPipeline', 'ModuleWrapTransformation', 'DependencyTransformation'
'RemoveCodeTransformation', 'TransformLoopsTransformation', 'SplitReadWriteTransformation', 'InlineTransformation',
'GlobalVariableAnalysis', 'GlobalVarOffloadTransformation', 'SCCHoistPipeline', 'ModuleWrapTransformation',
'DependencyTransformation'
]

# Define entry point for call-tree transformation
Expand Down
3 changes: 3 additions & 0 deletions src/ecwam/snonlin.F90
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ SUBROUTINE SNONLIN (KIJS, KIJL, FL1, FLD, SL, WAVNUM, DEPTH, AKMEAN)
IF (MC > MFR1STFR .AND. MC < MFRLSTFR ) THEN
! the interactions for MC are all within the fully resolved spectral domain

!$loki loop-interchange
DO KH=1,2
DO K=1,NANG
K1 = K1W (K,KH)
Expand Down Expand Up @@ -309,6 +310,7 @@ SUBROUTINE SNONLIN (KIJS, KIJL, FL1, FLD, SL, WAVNUM, DEPTH, AKMEAN)
ENDDO

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

ELSE

!$loki loop-interchange
DO KH=1,2
DO K=1,NANG
K1 = K1W (K,KH)
Expand Down

0 comments on commit d2c67ca

Please sign in to comment.