pymc-devs / pymc-devs/pytensor
Infer flops and memory usage of each Op
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
Description
We could add a method to the Ops, similar to infer_shape that infers the number of flops and memory usage of an Op given its inputs and input shapes.
This could be useful for some meta optimization that tries different rewrite orderings or subsets (or non eager rewrites) to arrive at a more compact graph.
For instance a simple Elemwise addition would have output_size flops and memory, but once inplace it would have 0 memory cost.
Dot instead of sum of mul would have slightly less flops (due to fused multiply add) and much smaller memory cost
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Ops' existing infer_shape implementation and reviewing how individual operations receive inputs and shapes. Define the scope of the proposed FLOP and memory estimates, including the Elemwise, inplace, and Dot examples, then add coverage demonstrating the expected estimates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100