Skip to content

Commit

Permalink
Add raise_on_domain_mismatch parameter to rename_iname
Browse files Browse the repository at this point in the history
Adds keyword parameter to `rename_iname` so raise_on_domain_mismatch can be passed into the call to `rename_inames`
  • Loading branch information
nchristensen authored Aug 13, 2023
1 parent a4840e0 commit 980060a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions loopy/transform/iname.py
Original file line number Diff line number Diff line change
Expand Up @@ -2504,18 +2504,23 @@ def does_insn_involve_iname(kernel, insn, *args):

@for_each_kernel
def rename_iname(kernel, old_iname, new_iname, existing_ok=False,
within=None, preserve_tags=True):
within=None, preserve_tags=True,
raise_on_domain_mismatch: bool = __debug__):
"""
Single iname version of :func:`loopy.rename_inames`.
:arg existing_ok: execute even if *new_iname* already exists
:arg within: a stack match understood by :func:`loopy.match.parse_stack_match`.
:arg preserve_tags: copy the tags on the old iname to the new iname
:arg raise_on_domain_mismatch: If *True*, raises an error if
:math:`\exists (i_1,i_2) \in \{\text{old\_inames}\}^2 |
\mathcal{D}_{i_1} \neq \mathcal{D}_{i_2}`.
"""
from itertools import product
from loopy import tag_inames

tags = kernel.inames[old_iname].tags
kernel = rename_inames(kernel, [old_iname], new_iname, existing_ok, within)
kernel = rename_inames(kernel, [old_iname], new_iname, existing_ok,
within, raise_on_domain_mismatch)
if preserve_tags:
kernel = tag_inames(kernel, product([new_iname], tags))
return kernel
Expand Down

0 comments on commit 980060a

Please sign in to comment.