Skip to content
Snippets Groups Projects
Commit ca219931 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Implement operation counting for special loopy functions by delegating

Using the same concept we use for visiting with hasattr.
parent 1076cb5a
No related branches found
No related tags found
No related merge requests found
...@@ -144,6 +144,12 @@ class PrimitiveApproximateOpcounter(FlopCounter): ...@@ -144,6 +144,12 @@ class PrimitiveApproximateOpcounter(FlopCounter):
def map_tagged_variable(self, expr): def map_tagged_variable(self, expr):
return self.map_variable(expr) return self.map_variable(expr)
def map_loopy_function_identifier(self, expr):
if hasattr(expr, "operations"):
return expr.operations()
raise NotImplementedError("The class {} should implement a symbolic flopcounter.".format(type(expr)))
@kernel_cached @kernel_cached
def store_operation_count(expr, count): def store_operation_count(expr, count):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment