From 3fd9a70178a508728a3728363de5e21c92ff38c5 Mon Sep 17 00:00:00 2001
From: James Stevens <jdsteve2@porter.cs.illinois.edu>
Date: Thu, 10 Mar 2016 12:16:12 -0600
Subject: [PATCH] changed call type to func:name in op counting

---
 loopy/statistics.py     | 2 +-
 test/test_statistics.py | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/loopy/statistics.py b/loopy/statistics.py
index 5aa251dc9..c273edd54 100755
--- a/loopy/statistics.py
+++ b/loopy/statistics.py
@@ -131,7 +131,7 @@ class ExpressionOpCounter(CombineMapper):
 
     def map_call(self, expr):
         return ToCountMap(
-                    {(self.type_inf(expr), 'call'): 1}
+                    {(self.type_inf(expr), 'func:'+str(expr.function)): 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 476639520..2cf537f5e 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])+rsqrt(g[i,k])
+                e[i, k] = (1+g[i,k])**(1+h[i,k+1])+rsqrt(g[i,k])*sin(g[i,k])
                 """
             ],
             name="specialops", assumptions="n,m,l >= 1")
@@ -133,11 +133,12 @@ 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)
+    f64rsqrt = poly[(np.dtype(np.float64), 'func:rsqrt')].eval_with_dict(params)
+    f64sin = poly[(np.dtype(np.float64), 'func:sin')].eval_with_dict(params)
     assert f32div == 2*n*m*l
     assert f32mul == f32add == n*m*l
     assert f64add == 3*n*m
-    assert f64pow == i32add == f64call == n*m
+    assert f64pow == i32add == f64rsqrt == f64sin == n*m
 
 
 def test_op_counter_bitwise():
-- 
GitLab