Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loopy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
loopy
Commits
65f6d419
Commit
65f6d419
authored
12 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Implement rename_iname.
parent
0b1f80ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
MEMO
+2
-2
2 additions, 2 deletions
MEMO
doc/reference.rst
+2
-2
2 additions, 2 deletions
doc/reference.rst
loopy/__init__.py
+20
-3
20 additions, 3 deletions
loopy/__init__.py
with
24 additions
and
7 deletions
MEMO
+
2
−
2
View file @
65f6d419
...
...
@@ -48,8 +48,6 @@ To-do
- Kernel fusion
- rename iname
- when are link_inames, duplicate_inames safe?
- ExpandingIdentityMapper
...
...
@@ -145,6 +143,8 @@ Future ideas
Dealt with
^^^^^^^^^^
- rename iname
- delete unused inames
- Expose iname-duplicate-and-rename as a primitive.
...
...
This diff is collapsed.
Click to expand it.
doc/reference.rst
+
2
−
2
View file @
65f6d419
...
...
@@ -165,9 +165,9 @@ Wrangling inames
.. autofunction:: link_inames
.. autofunction:: rename_iname
s
.. autofunction:: rename_iname
.. autofunction::
delet
e_unused_inames
.. autofunction::
remov
e_unused_inames
Dealing with Substitution Rules
-------------------------------
...
...
This diff is collapsed.
Click to expand it.
loopy/__init__.py
+
20
−
3
View file @
65f6d419
...
...
@@ -550,6 +550,23 @@ def duplicate_inames(knl, inames, within, new_inames=None, suffix=None,
# }}}
def
rename_iname
(
knl
,
old_iname
,
new_iname
,
within
):
"""
:arg within: a stack match as understood by
:func:`loopy.context_matching.parse_stack_match`.
"""
var_name_gen
=
knl
.
get_var_name_generator
()
if
var_name_gen
.
is_name_conflicting
(
new_iname
):
raise
ValueError
(
"
iname
'
%s
'
conflicts with an existing identifier
"
"
--cannot rename
"
%
new_iname
)
knl
=
duplicate_inames
([
old_iname
],
within
,
[
new_iname
])
knl
=
remove_unused_inames
(
knl
,
[
old_iname
])
return
knl
# {{{ link inames
def
link_inames
(
knl
,
inames
,
new_iname
,
within
=
None
,
tag
=
None
):
...
...
@@ -646,7 +663,7 @@ def link_inames(knl, inames, new_iname, within=None, tag=None):
# }}}
knl
=
delet
e_unused_inames
(
knl
,
inames
)
knl
=
remov
e_unused_inames
(
knl
,
inames
)
if
tag
is
not
None
:
knl
=
tag_inames
(
knl
,
{
new_iname
:
tag
})
...
...
@@ -655,9 +672,9 @@ def link_inames(knl, inames, new_iname, within=None, tag=None):
# }}}
# {{{
delet
e unused inames
# {{{
remov
e unused inames
def
delet
e_unused_inames
(
knl
,
inames
=
None
):
def
remov
e_unused_inames
(
knl
,
inames
=
None
):
"""
Delete those among *inames* that are unused, i.e. project them
out of the domain. If these inames pose implicit restrictions on
other inames, these restrictions will persist as existentially
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment