inducer / pytato

Lazily evaluated arrays in Python
Other
9 stars 16 forks source link

`NodeCountMapper` doesn't count nodes inside functions #513

Open majosm opened 3 months ago

majosm commented 3 months ago

Comparing my concatenation changes with main reminded me that NodeCountMapper doesn't currently accumulate node counts from functions into the overall count. It should be given a map_function_definition method that does something similar to CallSiteCountMapper: https://github.com/inducer/pytato/blob/78b43c197390d7aee1ec86357660d833223ddb69/pytato/analysis/__init__.py#L435-L446 I wonder if the default map_function_definition implementation in CachedWalkMapper should be disabled, to avoid bugs like this? Maybe a default implementation could be provided in a separate method, e.g. _basic_map_function_definition, for convenience in mappers that don't need special behavior.