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
6875ff0d
Commit
6875ff0d
authored
12 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Perform reduction iname duplication also in substitution rules.
parent
476d1165
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loopy/creation.py
+26
-8
26 additions, 8 deletions
loopy/creation.py
with
26 additions
and
8 deletions
loopy/creation.py
+
26
−
8
View file @
6875ff0d
...
...
@@ -209,11 +209,11 @@ def duplicate_reduction_inames(kernel):
for
iname
in
reduction_expr
.
inames
:
if
iname
.
startswith
(
"
@
"
):
new_iname
=
kernel
.
make_unique_var_name
(
iname
[
1
:]
+
"
_
"
+
insn
.
id
,
new_iname
=
kernel
.
make_unique_var_name
(
iname
[
1
:]
+
"
_
"
+
name_base
,
newly_created_vars
)
old_
insn_
inames
.
append
(
iname
.
lstrip
(
"
@
"
))
new_
insn_
inames
.
append
(
new_iname
)
old_inames
.
append
(
iname
.
lstrip
(
"
@
"
))
new_inames
.
append
(
new_iname
)
newly_created_vars
.
add
(
new_iname
)
new_red_inames
.
append
(
new_iname
)
did_something
=
True
...
...
@@ -241,28 +241,46 @@ def duplicate_reduction_inames(kernel):
# }}}
from
loopy.symbolic
import
ReductionCallbackMapper
from
loopy.isl_helpers
import
duplicate_axes
new_domains
=
kernel
.
domains
new_insns
=
[]
new_iname_to_tag
=
kernel
.
iname_to_tag
.
copy
()
for
insn
in
kernel
.
instructions
:
old_insn_inames
=
[]
new_insn_inames
=
[]
old_inames
=
[]
new_inames
=
[]
name_base
=
insn
.
id
from
loopy.symbolic
import
ReductionCallbackMapper
new_insns
.
append
(
insn
.
copy
(
expression
=
ReductionCallbackMapper
(
duplicate_reduction_inames
)
(
insn
.
expression
)))
from
loopy.isl_helpers
import
duplicate_axes
for
old
,
new
in
zip
(
old_insn_inames
,
new_insn_inames
):
for
old
,
new
in
zip
(
old_inames
,
new_inames
):
new_domains
=
duplicate_axes
(
new_domains
,
[
old
],
[
new
])
if
old
in
kernel
.
iname_to_tag
:
new_iname_to_tag
[
new
]
=
kernel
.
iname_to_tag
[
old
]
new_substs
=
{}
for
sub_name
,
sub_rule
in
kernel
.
substitutions
.
iteritems
():
old_inames
=
[]
new_inames
=
[]
name_base
=
sub_name
new_substs
[
sub_name
]
=
sub_rule
.
copy
(
expression
=
ReductionCallbackMapper
(
duplicate_reduction_inames
)
(
sub_rule
.
expression
))
for
old
,
new
in
zip
(
old_inames
,
new_inames
):
new_domains
=
duplicate_axes
(
new_domains
,
[
old
],
[
new
])
if
old
in
kernel
.
iname_to_tag
:
new_iname_to_tag
[
new
]
=
kernel
.
iname_to_tag
[
old
]
return
kernel
.
copy
(
instructions
=
new_insns
,
substitutions
=
new_substs
,
domains
=
new_domains
,
iname_to_tag
=
new_iname_to_tag
)
...
...
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