Skip to content
Snippets Groups Projects

Refactor Field Modelling

Merged Frederik Hennig requested to merge fhennig/field-buffers into v2.0-dev
All threads resolved!
Viewing commit ce3fb3e8
Show latest version
1 file
+ 8
2
Preferences
Compare changes
@@ -132,7 +132,7 @@ def create_kernel(
f"Code generation for target {target} not implemented"
)
# Simplifying transformations
# Fold and extract constants
elim_constants = EliminateConstants(ctx, extract_constant_exprs=True)
kernel_ast = cast(PsBlock, elim_constants(kernel_ast))
@@ -151,10 +151,16 @@ def create_kernel(
select_functions = SelectFunctions(platform)
kernel_ast = cast(PsBlock, select_functions(kernel_ast))
# Lowering introduces new symbols, which have to be canonicalized
# Late canonicalization and constant elimination passes
# * Since lowering introduces new index calculations and indexing symbols into the AST,
# * these need to be handled here
canonicalize = CanonicalizeSymbols(ctx, True)
kernel_ast = cast(PsBlock, canonicalize(kernel_ast))
late_fold_constants = EliminateConstants(ctx, extract_constant_exprs=False)
kernel_ast = cast(PsBlock, late_fold_constants(kernel_ast))
if config.target.is_cpu():
return create_cpu_kernel_function(
ctx,