Skip to content

Commit

Permalink
compiler: Skip avoid_denormals upon recursive compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioLuporini committed Jan 25, 2024
1 parent 7564a04 commit 08d4410
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions devito/core/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _specialize_iet(cls, graph, **kwargs):
sregistry = kwargs['sregistry']

# Flush denormal numbers
avoid_denormals(graph, platform=platform)
avoid_denormals(graph, **kwargs)

# Distributed-memory parallelism
mpiize(graph, **kwargs)
Expand Down Expand Up @@ -260,7 +260,7 @@ def _make_iet_passes_mapper(cls, **kwargs):
parizer = cls._Target.Parizer(sregistry, options, platform, compiler)

return {
'denormals': avoid_denormals,
'denormals': partial(avoid_denormals, **kwargs),
'blocking': partial(relax_incr_dimensions, **kwargs),
'parallel': parizer.make_parallel,
'openmp': parizer.make_parallel,
Expand Down
1 change: 1 addition & 0 deletions devito/operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ def __setstate__(self, state):
# dangerous as some of them (the minority) might break in some circumstances
# if applied in cascade (e.g., `linearization` on top of `linearization`)
rcompile_registry = {
'avoid_denormals': False,
'mpi': False,
'linearize': False,
'place-transfers': False
Expand Down
6 changes: 6 additions & 0 deletions devito/passes/iet/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ def wrapper(*args, **kwargs):
maybe_timed = timed_pass
else:
maybe_timed = lambda func, name: func
try:
# If the pass has been disabled, skip it
if not kwargs['options'][func.__name__]:
return
except KeyError:
pass
try:
# Pure function case
graph, = args
Expand Down
2 changes: 1 addition & 1 deletion devito/passes/iet/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@iet_pass
def avoid_denormals(iet, platform=None):
def avoid_denormals(iet, platform=None, **kwargs):
"""
Introduce nodes in the Iteration/Expression tree that will expand to C
macros telling the CPU to flush denormal numbers in hardware. Denormals
Expand Down

0 comments on commit 08d4410

Please sign in to comment.