From 82fa700f2980cd94ddf6c5eed33bef716c537993 Mon Sep 17 00:00:00 2001 From: Fabio Luporini Date: Tue, 14 Jan 2025 15:05:45 +0000 Subject: [PATCH] compiler: Tweak topo-fusion --- devito/passes/clusters/misc.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/devito/passes/clusters/misc.py b/devito/passes/clusters/misc.py index b26cc6db53..6b59482dd3 100644 --- a/devito/passes/clusters/misc.py +++ b/devito/passes/clusters/misc.py @@ -310,16 +310,14 @@ def choose_element(queue, scheduled): # Process the `strict` part of the key candidates = [i for i in queue if m[i].itintervals == k.itintervals] - if k.guards: - compatible = [i for i in candidates if m[i].guards == k.guards] - candidates = compatible or candidates + compatible = [i for i in candidates if m[i].guards == k.guards] + candidates = compatible or candidates - if k.syncs: - compatible = [i for i in candidates if m[i].syncs == k.syncs] - candidates = compatible or candidates + compatible = [i for i in candidates if m[i].syncs == k.syncs] + candidates = compatible or candidates # Process the `weak` part of the key - for i in reversed(range(len(k.weak) + 1)): + for i in range(len(k.weak), -1, -1): choosable = [e for e in candidates if m[e].weak[:i] == k.weak[:i]] try: # Ensure stability