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
Wiki
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
Ben Sepanski
loopy
Commits
be4aba12
Commit
be4aba12
authored
9 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Add find_unused_axis_tag
parent
37eb5a8b
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
doc/reference.rst
+2
-0
2 additions, 0 deletions
doc/reference.rst
loopy/__init__.py
+2
-2
2 additions, 2 deletions
loopy/__init__.py
loopy/transform/iname.py
+48
-0
48 additions, 0 deletions
loopy/transform/iname.py
with
52 additions
and
2 deletions
doc/reference.rst
+
2
−
0
View file @
be4aba12
...
...
@@ -442,6 +442,8 @@ Wrangling inames
.. autofunction:: realize_ilp
.. autofunction:: find_unused_axis_tag
Dealing with Parameters
^^^^^^^^^^^^^^^^^^^^^^^
...
...
This diff is collapsed.
Click to expand it.
loopy/__init__.py
+
2
−
2
View file @
be4aba12
...
...
@@ -57,7 +57,7 @@ from loopy.transform.iname import (
assume
,
set_loop_priority
,
split_iname
,
chunk_iname
,
join_inames
,
tag_inames
,
duplicate_inames
,
rename_iname
,
link_inames
,
remove_unused_inames
,
affine_map_inames
)
affine_map_inames
,
find_unused_axis_tag
)
from
loopy.transform.instruction
import
(
find_instructions
,
map_instructions
,
...
...
@@ -131,7 +131,7 @@ __all__ = [
"
split_iname
"
,
"
chunk_iname
"
,
"
join_inames
"
,
"
tag_inames
"
,
"
duplicate_inames
"
,
"
rename_iname
"
,
"
link_inames
"
,
"
remove_unused_inames
"
,
"
affine_map_inames
"
,
"
affine_map_inames
"
,
"
find_unused_axis_tag
"
,
"
add_prefetch
"
,
"
change_arg_to_image
"
,
"
tag_data_axes
"
,
"
set_array_dim_names
"
,
"
remove_unused_arguments
"
,
...
...
This diff is collapsed.
Click to expand it.
loopy/transform/iname.py
+
48
−
0
View file @
be4aba12
...
...
@@ -1173,4 +1173,52 @@ def affine_map_inames(kernel, old_inames, new_inames, equations):
# }}}
# {{{ find unused axes
def
find_unused_axis_tag
(
kernel
,
kind
,
insn_match
=
None
):
"""
For one of the hardware-parallel execution tags, find an unused
axis.
:arg insn_match: An instruction match as understood by
:func:`loopy.context_matching.parse_match`.
:arg kind: may be
"
l
"
or
"
g
"
, or the corresponding tag class name
:returns: an :class:`GroupIndexTag` or :class:`LocalIndexTag`
that is not being used within the instructions matched by
*insn_match*.
"""
used_axes
=
set
()
from
looopy.kernel.data
import
GroupIndexTag
,
LocalIndexTag
if
isinstance
(
kind
,
str
):
found
=
False
for
cls
in
[
GroupIndexTag
,
LocalIndexTag
]:
if
kind
==
cls
.
print_name
:
kind
=
cls
found
=
True
break
if
not
found
:
raise
LoopyError
(
"
invlaid tag kind: %s
"
%
kind
)
from
loopy.context_matching
import
parse_match
match
=
parse_match
(
insn_match
)
insns
=
[
insn
for
insn
in
kernel
.
instructions
if
match
(
kernel
,
insn
)]
for
insn
in
insns
:
for
iname
in
kernel
.
insn_inames
(
insn
):
dim_tag
=
kernel
.
iname_to_tag
.
get
(
iname
)
if
isinstance
(
dim_tag
,
kind
):
used_axes
.
add
(
kind
.
axis
)
i
=
0
while
i
in
used_axes
:
i
+=
1
return
kind
(
i
)
# }}}
# vim: foldmethod=marker
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