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
51c2369e
Commit
51c2369e
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Add a preemptive check for write races to realize_cse().
parent
e413c8ca
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/__init__.py
+21
-4
21 additions, 4 deletions
loopy/__init__.py
with
21 additions
and
4 deletions
loopy/__init__.py
+
21
−
4
View file @
51c2369e
...
...
@@ -204,7 +204,7 @@ def realize_cse(kernel, cse_tag, dtype, duplicate_inames=[], parallel_inames=Non
target_var_name
=
kernel
.
make_unique_var_name
(
cse_tag
)
from
loopy.kernel
import
(
LocalIndexTagBase
,
GroupIndexTag
)
from
loopy.kernel
import
(
LocalIndexTagBase
,
GroupIndexTag
,
IlpTag
)
target_var_is_local
=
any
(
isinstance
(
tag
,
LocalIndexTagBase
)
for
tag
in
dup_iname_to_tag
.
itervalues
())
...
...
@@ -249,17 +249,34 @@ def realize_cse(kernel, cse_tag, dtype, duplicate_inames=[], parallel_inames=Non
kind
=
"
l
"
elif
isinstance
(
tag
,
GroupIndexTag
):
kind
=
"
g
"
elif
isinstance
(
tag
,
IlpTag
):
kind
=
"
i
"
else
:
kind
=
"
o
"
if
iname
not
in
duplicate_inames
and
iname
in
dependencies
:
if
(
(
target_var_is_local
and
kind
in
"
li
"
)
or
(
not
target_var_is_local
and
kind
in
"
i
"
)):
raise
RuntimeError
(
"
When realizing CSE with tag
'
%s
'
, encountered iname
"
"'
%s
'
which is depended upon by the CSE and tagged
"
"'
%s
'
, but not duplicated. The CSE would
"
"
inherit this iname, which would lead to a write race.
"
"
A likely solution of this problem is to also duplicate this
"
"
iname.
"
%
(
expr
.
prefix
,
iname
,
tag
))
if
iname
in
duplicate_inames
and
kind
==
"
g
"
:
raise
RuntimeError
(
"
duplicating iname
s
into
"
raise
RuntimeError
(
"
duplicating
the
iname
'
%s
'
into
"
"
group index axes is not helpful, as they cannot
"
"
collaborate in computing a local variable
"
)
"
collaborate in computing a local variable
"
%
iname
)
if
iname
in
dependencies
:
if
not
target_var_is_local
and
iname
in
duplicate_inames
and
kind
==
"
l
"
:
raise
RuntimeError
(
"
invalid: parallelized
"
raise
RuntimeError
(
"
invalid:
hardware-
parallelized
"
"
fetch into private variable
"
)
# otherwise: all happy
...
...
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