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
32d5c889
Commit
32d5c889
authored
11 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
PEP8 loopy.kernel.tools.
parent
bd84ce7b
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/kernel/tools.py
+10
-7
10 additions, 7 deletions
loopy/kernel/tools.py
with
10 additions
and
7 deletions
loopy/kernel/tools.py
+
10
−
7
View file @
32d5c889
...
@@ -25,14 +25,10 @@ THE SOFTWARE.
...
@@ -25,14 +25,10 @@ THE SOFTWARE.
"""
"""
import
numpy
as
np
import
numpy
as
np
from
islpy
import
dim_type
from
islpy
import
dim_type
# {{{ add and infer argument dtypes
# {{{ add and infer argument dtypes
def
add_argument_dtypes
(
knl
,
dtype_dict
):
def
add_argument_dtypes
(
knl
,
dtype_dict
):
...
@@ -65,10 +61,12 @@ def add_argument_dtypes(knl, dtype_dict):
...
@@ -65,10 +61,12 @@ def add_argument_dtypes(knl, dtype_dict):
return
knl
.
copy
(
args
=
new_args
)
return
knl
.
copy
(
args
=
new_args
)
def
get_arguments_with_incomplete_dtype
(
knl
):
def
get_arguments_with_incomplete_dtype
(
knl
):
return
[
arg
.
name
for
arg
in
knl
.
args
return
[
arg
.
name
for
arg
in
knl
.
args
if
arg
.
dtype
is
None
]
if
arg
.
dtype
is
None
]
def
add_and_infer_argument_dtypes
(
knl
,
dtype_dict
):
def
add_and_infer_argument_dtypes
(
knl
,
dtype_dict
):
knl
=
add_argument_dtypes
(
knl
,
dtype_dict
)
knl
=
add_argument_dtypes
(
knl
,
dtype_dict
)
...
@@ -77,6 +75,7 @@ def add_and_infer_argument_dtypes(knl, dtype_dict):
...
@@ -77,6 +75,7 @@ def add_and_infer_argument_dtypes(knl, dtype_dict):
# }}}
# }}}
# {{{ find_all_insn_inames fixed point iteration
# {{{ find_all_insn_inames fixed point iteration
def
find_all_insn_inames
(
kernel
):
def
find_all_insn_inames
(
kernel
):
...
@@ -181,6 +180,7 @@ def find_all_insn_inames(kernel):
...
@@ -181,6 +180,7 @@ def find_all_insn_inames(kernel):
# }}}
# }}}
# {{{ set operation cache
# {{{ set operation cache
class
SetOperationCacheManager
:
class
SetOperationCacheManager
:
...
@@ -192,7 +192,7 @@ class SetOperationCacheManager:
...
@@ -192,7 +192,7 @@ class SetOperationCacheManager:
hashval
=
hash
(
set
)
hashval
=
hash
(
set
)
bucket
=
self
.
cache
.
setdefault
(
hashval
,
[])
bucket
=
self
.
cache
.
setdefault
(
hashval
,
[])
for
bkt_set
,
bkt_op
,
bkt_args
,
result
in
bucket
:
for
bkt_set
,
bkt_op
,
bkt_args
,
result
in
bucket
:
if
set
.
plain_is_equal
(
bkt_set
)
and
op
==
bkt_op
and
args
==
bkt_args
:
if
set
.
plain_is_equal
(
bkt_set
)
and
op
==
bkt_op
and
args
==
bkt_args
:
return
result
return
result
...
@@ -233,6 +233,7 @@ class SetOperationCacheManager:
...
@@ -233,6 +233,7 @@ class SetOperationCacheManager:
# }}}
# }}}
# {{{ domain change helper
# {{{ domain change helper
class
DomainChanger
:
class
DomainChanger
:
...
@@ -268,6 +269,7 @@ class DomainChanger:
...
@@ -268,6 +269,7 @@ class DomainChanger:
# }}}
# }}}
# {{{ graphviz / dot export
# {{{ graphviz / dot export
def
get_dot_dependency_graph
(
kernel
,
iname_cluster
=
False
,
iname_edge
=
True
):
def
get_dot_dependency_graph
(
kernel
,
iname_cluster
=
False
,
iname_edge
=
True
):
...
@@ -291,6 +293,7 @@ def get_dot_dependency_graph(kernel, iname_cluster=False, iname_edge=True):
...
@@ -291,6 +293,7 @@ def get_dot_dependency_graph(kernel, iname_cluster=False, iname_edge=True):
# }}}
# }}}
# {{{ domain parameter finder
# {{{ domain parameter finder
class
DomainParameterFinder
:
class
DomainParameterFinder
:
...
@@ -323,8 +326,8 @@ class DomainParameterFinder:
...
@@ -323,8 +326,8 @@ class DomainParameterFinder:
try
:
try
:
# friggin' overkill :)
# friggin' overkill :)
param_expr
=
solve_affine_equations_for
(
param_expr
=
solve_affine_equations_for
(
[
dep
.
name
],
[(
shape_i
,
var
(
"
shape_i
"
))]
)
\
[
dep
.
name
],
[(
shape_i
,
var
(
"
shape_i
"
))]
[
dep
.
name
]
)
[
dep
.
name
]
except
:
except
:
# went wrong? oh well
# went wrong? oh well
pass
pass
...
...
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