Skip to content

Conversation

@zoecarver
Copy link
Contributor

Adds fusion support for chains of elementwise tensor ops (like exp(a) + sqrt(b)) into a single ttl.compute block. When elementwise ops are not directly attached to circular buffers, the pass traces backwards through the op chain to find CB-attached roots, then emits all the tile-level ops inside a single fused compute body.

  • Recursive tracing supports arbitrary depth chains (tested up to 20 ops)
  • Uses existing TTLElementwiseOps.def to automatically support all unary/binary ops
  • Strict fusion heuristics: all intermediate values must have single use, all roots must be CB-attached
  • Clear diagnostic errors when fusion fails (e.g., "intermediate value has multiple uses", "cannot trace through non-elementwise op")

This does not fuse or merge multiple ttl.compute ops together; it only places elementwise ops inside a single compute block when strict heuristics are met.

@zoecarver zoecarver requested a review from a team as a code owner January 6, 2026 18:20
@zoecarver zoecarver force-pushed the zoecarver/dynamic-tensor-subscript branch 3 times, most recently from e925932 to e91abda Compare January 8, 2026 21:29
@zoecarver zoecarver force-pushed the zoecarver/ttl-compute-fusion branch from 263d72d to 2b4bd68 Compare January 8, 2026 21:31
Copy link
Contributor

@brnorris03 brnorris03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, feel free to ignore. Could use some negative lit tests - multiple uses of an intermediate or other things that cause the expected errors.

@zoecarver
Copy link
Contributor Author

Thank you Boyana! Will fix all :)

@zoecarver zoecarver force-pushed the zoecarver/ttl-compute-fusion branch from f9e4280 to 2d9a80b Compare January 9, 2026 21:02
@zoecarver zoecarver force-pushed the zoecarver/ttl-compute-fusion branch from 2d9a80b to a652dcb Compare January 9, 2026 21:25
@phizalev-TT
Copy link
Contributor

Tested--LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants