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
fe3497e7
Commit
fe3497e7
authored
9 years ago
by
James Stevens
Browse files
Options
Downloads
Patches
Plain Diff
removed old ExpressionOpCounter
parent
89a3cdd3
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/statistics.py
+0
-128
0 additions, 128 deletions
loopy/statistics.py
with
0 additions
and
128 deletions
loopy/statistics.py
+
0
−
128
View file @
fe3497e7
...
...
@@ -83,134 +83,6 @@ def stringify_stats_mapping(m):
return
result
class
ExpressionOpCounter_Old
(
CombineMapper
):
def
__init__
(
self
,
knl
):
self
.
knl
=
knl
from
loopy.expression
import
TypeInferenceMapper
self
.
type_inf
=
TypeInferenceMapper
(
knl
)
def
combine
(
self
,
values
):
return
sum
(
values
)
def
map_constant
(
self
,
expr
):
return
ToCountMap
()
map_tagged_variable
=
map_constant
map_variable
=
map_constant
#def map_wildcard(self, expr):
# return 0,0
#def map_function_symbol(self, expr):
# return 0,0
def
map_call
(
self
,
expr
):
return
self
.
rec
(
expr
.
parameters
)
# def map_call_with_kwargs(self, expr): # implemented in CombineMapper
def
map_subscript
(
self
,
expr
):
# implemented in CombineMapper
return
self
.
rec
(
expr
.
index
)
# def map_lookup(self, expr): # implemented in CombineMapper
def
map_sum
(
self
,
expr
):
if
expr
.
children
:
return
ToCountMap
(
{
self
.
type_inf
(
expr
):
len
(
expr
.
children
)
-
1
}
)
+
sum
(
self
.
rec
(
child
)
for
child
in
expr
.
children
)
else
:
return
ToCountMap
()
def
map_product
(
self
,
expr
):
from
pymbolic.primitives
import
is_zero
if
expr
.
children
:
return
sum
(
ToCountMap
({
self
.
type_inf
(
expr
):
1
})
+
self
.
rec
(
child
)
for
child
in
expr
.
children
if
not
is_zero
(
child
+
1
))
+
\
ToCountMap
({
self
.
type_inf
(
expr
):
-
1
})
else
:
return
ToCountMap
()
def
map_quotient
(
self
,
expr
,
*
args
):
return
ToCountMap
({
self
.
type_inf
(
expr
):
1
})
\
+
self
.
rec
(
expr
.
numerator
)
\
+
self
.
rec
(
expr
.
denominator
)
map_floor_div
=
map_quotient
map_remainder
=
map_quotient
# implemented in CombineMapper
def
map_power
(
self
,
expr
):
return
ToCountMap
({
self
.
type_inf
(
expr
):
1
})
\
+
self
.
rec
(
expr
.
base
)
\
+
self
.
rec
(
expr
.
exponent
)
def
map_left_shift
(
self
,
expr
):
# implemented in CombineMapper
return
ToCountMap
({
self
.
type_inf
(
expr
):
1
})
\
+
self
.
rec
(
expr
.
shiftee
)
\
+
self
.
rec
(
expr
.
shift
)
map_right_shift
=
map_left_shift
def
map_bitwise_not
(
self
,
expr
):
# implemented in CombineMapper
return
ToCountMap
({
self
.
type_inf
(
expr
):
1
})
\
+
self
.
rec
(
expr
.
child
)
def
map_bitwise_or
(
self
,
expr
):
# implemented in CombineMapper, maps to map_sum;
return
ToCountMap
(
{
self
.
type_inf
(
expr
):
len
(
expr
.
children
)
-
1
}
)
+
sum
(
self
.
rec
(
child
)
for
child
in
expr
.
children
)
map_bitwise_xor
=
map_bitwise_or
# implemented in CombineMapper, maps to map_sum;
map_bitwise_and
=
map_bitwise_or
# implemented in CombineMapper, maps to map_sum;
def
map_comparison
(
self
,
expr
):
# implemented in CombineMapper
return
self
.
rec
(
expr
.
left
)
+
self
.
rec
(
expr
.
right
)
def
map_logical_not
(
self
,
expr
):
return
self
.
rec
(
expr
.
child
)
def
map_logical_or
(
self
,
expr
):
return
sum
(
self
.
rec
(
child
)
for
child
in
expr
.
children
)
map_logical_and
=
map_logical_or
def
map_if
(
self
,
expr
):
# implemented in CombineMapper, recurses
warnings
.
warn
(
"
ExpressionOpCounter counting DRAM accesses as
"
"
sum of if-statement branches.
"
)
return
self
.
rec
(
expr
.
condition
)
+
self
.
rec
(
expr
.
then
)
+
self
.
rec
(
expr
.
else_
)
def
map_if_positive
(
self
,
expr
):
# implemented in FlopCounter
warnings
.
warn
(
"
ExpressionOpCounter counting DRAM accesses as
"
"
sum of if_pos-statement branches.
"
)
return
self
.
rec
(
expr
.
criterion
)
+
self
.
rec
(
expr
.
then
)
+
self
.
rec
(
expr
.
else_
)
map_min
=
map_bitwise_or
map_max
=
map_min
def
map_common_subexpression
(
self
,
expr
):
raise
NotImplementedError
(
"
ExpressionOpCounter encountered
"
"
common_subexpression,
"
"
map_common_subexpression not implemented.
"
)
def
map_substitution
(
self
,
expr
):
raise
NotImplementedError
(
"
ExpressionOpCounter encountered substitution,
"
"
map_substitution not implemented.
"
)
def
map_derivative
(
self
,
expr
):
raise
NotImplementedError
(
"
ExpressionOpCounter encountered derivative,
"
"
map_derivative not implemented.
"
)
def
map_slice
(
self
,
expr
):
raise
NotImplementedError
(
"
ExpressionOpCounter encountered slice,
"
"
map_slice not implemented.
"
)
class
ExpressionOpCounter
(
CombineMapper
):
def
__init__
(
self
,
knl
):
...
...
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