From ec7562d0e8704f993bd6eaf9807e01f9bd60eaba Mon Sep 17 00:00:00 2001 From: James Stevens <jdsteve2@porter.cs.illinois.edu> Date: Thu, 18 Feb 2016 02:52:15 -0600 Subject: [PATCH] added special func counting --- loopy/statistics.py | 4 +++- test/test_statistics.py | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/loopy/statistics.py b/loopy/statistics.py index 9ef292f63..36acbc0bf 100755 --- a/loopy/statistics.py +++ b/loopy/statistics.py @@ -115,7 +115,9 @@ class ExpressionOpCounter(CombineMapper): # return 0,0 def map_call(self, expr): - return self.rec(expr.parameters) + return ToCountMap( + {(self.type_inf(expr), 'call'): 1} + ) + self.rec(expr.parameters) # def map_call_with_kwargs(self, expr): # implemented in CombineMapper diff --git a/test/test_statistics.py b/test/test_statistics.py index 0fc4fd218..a11822f43 100644 --- a/test/test_statistics.py +++ b/test/test_statistics.py @@ -115,7 +115,7 @@ def test_op_counter_specialops(): [ """ c[i, j, k] = (2*a[i,j,k])%(2+b[i,j,k]/3.0) - e[i, k] = (1+g[i,k])**(1+h[i,k+1]) + e[i, k] = (1+g[i,k])**(1+h[i,k+1])+rsqrt(g[i,k]) """ ], name="specialops", assumptions="n,m,l >= 1") @@ -133,10 +133,11 @@ def test_op_counter_specialops(): f64pow = poly[(np.dtype(np.float64), 'pow')].eval_with_dict(params) f64add = poly[(np.dtype(np.float64), 'add')].eval_with_dict(params) i32add = poly[(np.dtype(np.int32), 'add')].eval_with_dict(params) + f64call = poly[(np.dtype(np.float64), 'call')].eval_with_dict(params) assert f32div == 2*n*m*l assert f32mul == f32add == n*m*l - assert f64add == 2*n*m - assert f64pow == i32add == n*m + assert f64add == 3*n*m + assert f64pow == i32add == f64call == n*m def test_op_counter_bitwise(): -- GitLab