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
6f164091
Commit
6f164091
authored
9 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Fix nesting safety of loop_insn_dep_map
parent
70852f98
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loopy/schedule.py
+24
-6
24 additions, 6 deletions
loopy/schedule.py
with
24 additions
and
6 deletions
loopy/schedule.py
+
24
−
6
View file @
6f164091
...
@@ -171,7 +171,7 @@ def find_used_inames_within(kernel, sched_index):
...
@@ -171,7 +171,7 @@ def find_used_inames_within(kernel, sched_index):
return
result
return
result
def
loop_nest_map
(
kernel
):
def
find_
loop_nest_map
(
kernel
):
"""
Returns a dictionary mapping inames to other inames that are
"""
Returns a dictionary mapping inames to other inames that are
always nested around them.
always nested around them.
"""
"""
...
@@ -212,7 +212,7 @@ def loop_nest_map(kernel):
...
@@ -212,7 +212,7 @@ def loop_nest_map(kernel):
return
result
return
result
def
loop_insn_dep_map
(
kernel
):
def
find_
loop_insn_dep_map
(
kernel
,
loop_nest_map
):
"""
Returns a dictionary mapping inames to other instruction ids that need to
"""
Returns a dictionary mapping inames to other instruction ids that need to
be scheduled before the iname should be eligible for scheduling.
be scheduled before the iname should be eligible for scheduling.
"""
"""
...
@@ -230,10 +230,27 @@ def loop_insn_dep_map(kernel):
...
@@ -230,10 +230,27 @@ def loop_insn_dep_map(kernel):
dep_insn_inames
=
kernel
.
insn_inames
(
dep_insn
)
dep_insn_inames
=
kernel
.
insn_inames
(
dep_insn
)
if
iname
in
dep_insn_inames
:
if
iname
in
dep_insn_inames
:
# Nothing to be learened, dependency is in loop over iname.
# Nothing to be learned, dependency is in loop over iname
# already.
continue
continue
result
.
setdefault
(
iname
,
set
()).
add
(
dep_insn_id
)
# To make sure dep_insn belongs outside of iname, we must prove
# (via loop_nest_map) that all inames that dep_insn will be
# executed inside are nested *around* iname.
if
not
dep_insn_inames
<=
loop_nest_map
[
iname
]:
continue
iname_dep
=
result
.
setdefault
(
iname
,
set
())
if
dep_insn_id
not
in
iname_dep
:
logger
.
debug
(
"
{knl}: loop dependency map: iname
'
{iname}
'
"
"
depends on
'
{dep_insn}
'
via
'
{insn}
'"
.
format
(
knl
=
kernel
.
name
,
iname
=
iname
,
dep_insn
=
dep_insn_id
,
insn
=
insn
.
id
))
iname_dep
.
add
(
dep_insn_id
)
return
result
return
result
...
@@ -1226,10 +1243,11 @@ def generate_loop_schedules(kernel, debug_args={}):
...
@@ -1226,10 +1243,11 @@ def generate_loop_schedules(kernel, debug_args={}):
iname
for
iname
in
kernel
.
all_inames
()
iname
for
iname
in
kernel
.
all_inames
()
if
isinstance
(
kernel
.
iname_to_tag
.
get
(
iname
),
ParallelTag
))
if
isinstance
(
kernel
.
iname_to_tag
.
get
(
iname
),
ParallelTag
))
loop_nest_map
=
find_loop_nest_map
(
kernel
)
sched_state
=
SchedulerState
(
sched_state
=
SchedulerState
(
kernel
=
kernel
,
kernel
=
kernel
,
loop_nest_map
=
loop_nest_map
(
kernel
)
,
loop_nest_map
=
loop_nest_map
,
loop_insn_dep_map
=
loop_insn_dep_map
(
kernel
),
loop_insn_dep_map
=
find_
loop_insn_dep_map
(
kernel
,
loop_nest_map
),
breakable_inames
=
ilp_inames
,
breakable_inames
=
ilp_inames
,
ilp_inames
=
ilp_inames
,
ilp_inames
=
ilp_inames
,
vec_inames
=
vec_inames
,
vec_inames
=
vec_inames
,
...
...
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