From 0d31c6a8565384d67e7db9f9b536deff865d283f Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Fri, 4 Nov 2011 01:35:19 -0500 Subject: [PATCH] Make it ok to retag l.auto inames. --- MEMO | 10 ++++++++++ loopy/__init__.py | 17 +++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/MEMO b/MEMO index 19e54706d..1866105af 100644 --- a/MEMO +++ b/MEMO @@ -39,6 +39,16 @@ Things to consider To-do ^^^^^ +- dim_max caching + +- Pick not just axis 0, but all axes by lowest available stride + +- Unidirectional unification + +- Unification Wildcards + +- No looking at the lead domain? + - Fix all tests - Deal with equality constraints. diff --git a/loopy/__init__.py b/loopy/__init__.py index a66b9958f..7fd63dff3 100644 --- a/loopy/__init__.py +++ b/loopy/__init__.py @@ -382,17 +382,22 @@ def tag_dimensions(kernel, iname_to_tag, force=False): iname_to_tag = dict((iname, parse_tag(tag)) for iname, tag in iname_to_tag.iteritems()) - from loopy.kernel import ParallelTag + from loopy.kernel import (ParallelTag, AutoLocalIndexTagBase, + LocalIndexTag) new_iname_to_tag = kernel.iname_to_tag.copy() for iname, new_tag in iname_to_tag.iteritems(): old_tag = kernel.iname_to_tag.get(iname) - if old_tag is not None and new_tag is None: - raise ValueError("cannot untag iname '%s'" % iname) + retag_ok = False + + if (isinstance(old_tag, AutoLocalIndexTagBase) + and (new_tag is None + or isinstance(new_tag, LocalIndexTag))): + retag_ok = True - if new_tag is None: - continue + if not retag_ok and old_tag is not None and new_tag is None: + raise ValueError("cannot untag iname '%s'" % iname) if iname not in kernel.all_inames(): raise ValueError("cannot tag '%s'--not known" % iname) @@ -401,7 +406,7 @@ def tag_dimensions(kernel, iname_to_tag, force=False): raise ValueError("cannot tag '%s' as parallel--" "iname requires sequential execution" % iname) - if (not force) and old_tag is not None and (old_tag != new_tag): + if (not retag_ok) and (not force) and old_tag is not None and (old_tag != new_tag): raise RuntimeError("'%s' is already tagged '%s'--cannot retag" % (iname, old_tag)) -- GitLab