Commit 7595c329 authored by Michael Kuron's avatar Michael Kuron
Browse files

create_staggered_kernel: ignore inapplicable CreateKernelConfig defaults

parent 9bad685f
...@@ -333,7 +333,15 @@ def create_staggered_kernel(assignments, target: Target = Target.CPU, gpu_exclus ...@@ -333,7 +333,15 @@ def create_staggered_kernel(assignments, target: Target = Target.CPU, gpu_exclus
Returns: Returns:
AST, see `create_kernel` AST, see `create_kernel`
""" """
assert 'iteration_slice' not in kwargs and 'ghost_layers' not in kwargs and 'omp_single_loop' not in kwargs if 'ghost_layers' in kwargs:
assert kwargs['ghost_layers'] is None
del kwargs['ghost_layers']
if 'iteration_slice' in kwargs:
assert kwargs['iteration_slice'] is None
del kwargs['iteration_slice']
if 'omp_single_loop' in kwargs:
assert kwargs['omp_single_loop'] is False
del kwargs['omp_single_loop']
if isinstance(assignments, AssignmentCollection): if isinstance(assignments, AssignmentCollection):
subexpressions = assignments.subexpressions + [a for a in assignments.main_assignments subexpressions = assignments.subexpressions + [a for a in assignments.main_assignments
...@@ -437,6 +445,9 @@ def create_staggered_kernel(assignments, target: Target = Target.CPU, gpu_exclus ...@@ -437,6 +445,9 @@ def create_staggered_kernel(assignments, target: Target = Target.CPU, gpu_exclus
remove_start_conditional = any([gl[0] == 0 for gl in ghost_layers]) remove_start_conditional = any([gl[0] == 0 for gl in ghost_layers])
prepend_optimizations = [lambda ast: remove_conditionals_in_staggered_kernel(ast, remove_start_conditional), prepend_optimizations = [lambda ast: remove_conditionals_in_staggered_kernel(ast, remove_start_conditional),
move_constants_before_loop] move_constants_before_loop]
if 'cpu_prepend_optimizations' in kwargs:
prepend_optimizations += kwargs['cpu_prepend_optimizations']
del kwargs['cpu_prepend_optimizations']
ast = create_kernel(final_assignments, ghost_layers=ghost_layers, target=target, omp_single_loop=False, ast = create_kernel(final_assignments, ghost_layers=ghost_layers, target=target, omp_single_loop=False,
cpu_prepend_optimizations=prepend_optimizations, **kwargs) cpu_prepend_optimizations=prepend_optimizations, **kwargs)
return ast return ast
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment