Simplify TensorStats Inheritance#540
Conversation
…ritance, remove copy_stats, generalize from_def
Merging this PR will degrade performance by 11.38%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | test_ops_binary[interpret_galley-add] |
787 ms | 899 ms | -12.47% |
| ❌ | WallTime | test_ops_binary[interpret_galley-multiply] |
786.2 ms | 888 ms | -11.47% |
| ❌ | WallTime | test_ops_reduction[interpret_galley-sum] |
419.5 ms | 471.4 ms | -11% |
| ❌ | WallTime | test_f1_jit[interpret_galley] |
11.2 s | 12.6 s | -10.56% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing kbd-refactor-tensor-stats (c322bda) with main (64775fa)
willow-ahrens
left a comment
There was a problem hiding this comment.
Some of these methods seem like they should be calling super(), but instead they're passing around the parent where the def used to be, which is a little bit of a mismatch in the programming pattern
|
|
||
| def _mapjoin_union( | ||
| self, new_def: TensorDef, op: FinchOperator, union_args: list[DummyStats] | ||
| self, new_def: BaseTensorStats, op: FinchOperator, union_args: list[DummyStats] |
There was a problem hiding this comment.
This part seems a little strange? I think we should just call super().mapjoin_union?
There was a problem hiding this comment.
It's a bit tricky because the class is a factory not a statistic, so calling super().mapjoin creates a BaseTensorStats object. We essentially do this within the BaseTensorStatsFactory.mapjoin implementation, then pass it to the _mapjoin_union/_mapjoin_join functions in the child classes. We can instead do that call within every _mapjoin_union/_mapjoin_join implementation though (and I think that may be cleaner).
There was a problem hiding this comment.
Just made that change
…tats' of github.com:finch-tensor/finch-tensor-lite into kbd-refactor-tensor-stats
This PR is a small cleanup within the TensorStats folder. The goal is to remove TensorDef and instead use inheritance to manage the shared functionality.