Skip to content

Commit

Permalink
compiler: autotuning
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Jun 11, 2021
1 parent f655d86 commit b75e1ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions devito/core/autotuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,16 @@ def autotune(operator, args, level, mode):

# Perform autotuning
timings = {}
processed = []
for n, tree in enumerate(trees):

blockable = [i.dim for i in tree if not is_integer(i.step)]
# Drop dimensions that have been already tested
# Encountered in cases where blockable appear more than once under a tree
if all(i in processed for i in blockable):
continue

processed.extend(blockable)
# Tunable arguments
try:
tunable = []
Expand Down Expand Up @@ -250,8 +257,9 @@ def finalize_time_bounds(stepper, at_args, args, mode):


def calculate_nblocks(tree, blockable):
pos = [n for n, i in enumerate(tree) if i.dim in blockable]
collapsed = tree[:(tree[pos[0]].ncollapsed or 1)]
block_indices = [n for n, i in enumerate(tree) if i.dim in blockable]
index = block_indices[0]
collapsed = tree[index:(tree[index].ncollapsed or index+1)]
blocked = [i.dim for i in collapsed if i.dim in blockable]
remainders = [(d.root.symbolic_max-d.root.symbolic_min+1) % d.step for d in blocked]
niters = [d.root.symbolic_max - i for d, i in zip(blocked, remainders)]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_autotuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def test_mixed_blocking_w_skewing(openmp, expected):
assert 'nthreads' not in op._state['autotuning'][0]['tuned']


@pytest.mark.parametrize('opt, expected', [('advanced', 60),
@pytest.mark.parametrize('opt, expected', [('advanced', 30),
(('blocking', {'skewing': True}), 30)])
def test_tti_aggressive(opt, expected):
from test_dse import TestTTI
Expand Down

0 comments on commit b75e1ca

Please sign in to comment.