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
0b1f80ec
Commit
0b1f80ec
authored
12 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Implement delete_unused_inames.
parent
276b375c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MEMO
+5
-3
5 additions, 3 deletions
MEMO
loopy/__init__.py
+45
-7
45 additions, 7 deletions
loopy/__init__.py
with
50 additions
and
10 deletions
MEMO
+
5
−
3
View file @
0b1f80ec
...
...
@@ -50,9 +50,7 @@ To-do
- rename iname
- delete unused inames
- link_inames
- when are link_inames, duplicate_inames safe?
- ExpandingIdentityMapper
extract_subst -> needs WalkMapper
...
...
@@ -96,6 +94,8 @@ Fixes:
Future ideas
^^^^^^^^^^^^
- Storage sharing for temporaries?
- Kernel splitting (via what variables get computed in a kernel)
- Put all OpenCL functions into mangler
...
...
@@ -145,6 +145,8 @@ Future ideas
Dealt with
^^^^^^^^^^
- delete unused inames
- Expose iname-duplicate-and-rename as a primitive.
- make sure simple side effects work
...
...
This diff is collapsed.
Click to expand it.
loopy/__init__.py
+
45
−
7
View file @
0b1f80ec
...
...
@@ -183,9 +183,7 @@ def split_iname(kernel, split_iname, inner_length,
s
=
s
.
intersect
(
inner_constraint_set
)
if
within
is
None
:
s
=
(
s
.
eliminate
(
name_dim_type
,
name_idx
,
1
)
.
remove_dims
(
name_dim_type
,
name_idx
,
1
))
s
=
s
.
project_out
(
name_dim_type
,
name_idx
,
1
)
return
s
...
...
@@ -345,8 +343,7 @@ def join_inames(kernel, inames, new_iname=None, tag=None, within=None):
iname_dt
,
iname_idx
=
iname_to_dim
[
iname
]
if
within
is
None
:
new_domain
=
new_domain
.
eliminate
(
iname_dt
,
iname_idx
,
1
)
new_domain
=
new_domain
.
remove_dims
(
iname_dt
,
iname_idx
,
1
)
new_domain
=
new_domain
.
project_out
(
iname_dt
,
iname_idx
,
1
)
def
subst_forced_iname_deps
(
fid
):
result
=
set
()
...
...
@@ -661,8 +658,49 @@ def link_inames(knl, inames, new_iname, within=None, tag=None):
# {{{ delete unused inames
def
delete_unused_inames
(
knl
,
inames
=
None
):
from
warnings
import
warn
warn
(
"
delete_unused_inames is unimplemented
"
)
"""
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
quantified variables.
:arg inames: may be an iterable of inames or a string of comma-separated inames.
"""
# {{{ normalize arguments
if
inames
is
None
:
inames
=
knl
.
all_inames
()
elif
isinstance
(
inames
,
str
):
inames
=
inames
.
split
(
"
,
"
)
# }}}
# {{{ check which inames are unused
inames
=
set
(
inames
)
used_inames
=
set
()
for
insn
in
knl
.
instructions
:
used_inames
.
update
(
knl
.
insn_inames
(
insn
.
id
))
unused_inames
=
inames
-
used_inames
# }}}
# {{{ remove them
from
loopy.kernel
import
DomainChanger
for
iname
in
unused_inames
:
domch
=
DomainChanger
(
knl
,
(
iname
,))
dom
=
domch
.
domain
dt
,
idx
=
dom
.
get_var_dict
()[
iname
]
dom
=
dom
.
project_out
(
dt
,
idx
,
1
)
knl
=
knl
.
copy
(
domains
=
domch
.
get_domains_with
(
dom
))
# }}}
return
knl
# }}}
...
...
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