diff --git a/loopy/transform/loop_fusion.py b/loopy/transform/loop_fusion.py index b86be517f..fcd4ab50b 100644 --- a/loopy/transform/loop_fusion.py +++ b/loopy/transform/loop_fusion.py @@ -753,24 +753,26 @@ def get_kennedy_unweighted_fusion_candidates( # {{{ sanitary checks _nest_tree_id_to_candidate = {} + _fusable_candidates = set() for iname in candidates: loop_nest_tree_node_id = iname_to_tree_node_id[iname] if loop_nest_tree_node_id not in _nest_tree_id_to_candidate: _nest_tree_id_to_candidate[loop_nest_tree_node_id] = iname + _fusable_candidates.add(iname) else: conflict_iname = _nest_tree_id_to_candidate[loop_nest_tree_node_id] - raise LoopyError(f"'{iname}' and '{conflict_iname}' " - "cannot fused be fused as they can be nested " - "within one another.") + from warnings import warn + warn(f"'{iname}' and '{conflict_iname}' " + "cannot be fused as they can be nested within one another.") - for iname in candidates: + for iname in _fusable_candidates: outer_loops = reduce(frozenset.union, tree.ancestors(iname_to_tree_node_id[iname]), frozenset()) - if outer_loops & candidates: + if outer_loops & _fusable_candidates: raise LoopyError(f"Cannot fuse '{iname}' with" - f" '{outer_loops & candidates}' as they" + f" '{outer_loops & _fusable_candidates}' as they" " maybe nesting within one another.") del _nest_tree_id_to_candidate @@ -782,7 +784,7 @@ def get_kennedy_unweighted_fusion_candidates( just_outer_loop_nest = {tree.parent(iname_to_tree_node_id[iname]): set() for iname in candidates} - for iname in candidates: + for iname in _fusable_candidates: just_outer_loop_nest[tree.parent(iname_to_tree_node_id[iname])].add(iname) for outer_inames, inames in just_outer_loop_nest.items():