From a6899fa99585426aae9e8423c61b554116449062 Mon Sep 17 00:00:00 2001 From: mloubout Date: Tue, 31 Oct 2023 12:27:19 -0400 Subject: [PATCH] compiler: prevent invering dtype on empty cluster --- devito/finite_differences/differentiable.py | 3 ++- devito/ir/clusters/cluster.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/devito/finite_differences/differentiable.py b/devito/finite_differences/differentiable.py index 23152053b84..a10c3932d80 100644 --- a/devito/finite_differences/differentiable.py +++ b/devito/finite_differences/differentiable.py @@ -109,7 +109,8 @@ def _fd(self): fd_args = [] for f in self._args_diff: try: - if f.space_order <= self.space_order and f.time_order <= self.time_order: + if f.space_order <= self.space_order and \ + (not f.is_TimeDependent or f.time_order <= self.time_order): fd_args.append(f) except AttributeError: pass diff --git a/devito/ir/clusters/cluster.py b/devito/ir/clusters/cluster.py index 887793e8e7e..69ee00c6c5b 100644 --- a/devito/ir/clusters/cluster.py +++ b/devito/ir/clusters/cluster.py @@ -483,7 +483,7 @@ def dtype(self): If two Clusters perform calculations with different precision, the data type with highest precision is returned. """ - dtypes = {i.dtype for i in self} + dtypes = {i.dtype for i in self} - {None} return infer_dtype(dtypes)