Skip to content

[Docs] Add operator fusion architecture documentation#19394

Merged
MasterJH5574 merged 1 commit intoapache:mainfrom
tlopex:doc220
Apr 12, 2026
Merged

[Docs] Add operator fusion architecture documentation#19394
MasterJH5574 merged 1 commit intoapache:mainfrom
tlopex:doc220

Conversation

@tlopex
Copy link
Copy Markdown
Member

@tlopex tlopex commented Apr 12, 2026

as per title

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive architectural document for Operator Fusion in TVM Relax, detailing the automatic fusion mechanism using post-dominator analysis, pattern-based fusion for external backends, and the TIR merging process. The documentation covers operator pattern classification, the multi-phase fusion algorithm, and provides a source code map for developers. A review comment suggests enhancing the documentation by mentioning that the maximum fusion depth limit is configurable via pass options.

- **Reduction** (``kCommReduce``) ops never initiate fusion — they act as sinks only. Elementwise
and broadcast producers can fuse *into* a reduction, but a reduction cannot fuse forward.
- **Opaque** ops are fusion barriers.
- A group cannot exceed ``kMaxFusedOps`` (256) nodes or the maximum function argument count.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

It would be beneficial to mention that the kMaxFusedOps limit is configurable via the relax.FuseOps.max_depth pass configuration option, as this provides users with control over the fusion granularity.

@MasterJH5574 MasterJH5574 merged commit 481aa6e into apache:main Apr 12, 2026
10 checks passed
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.

2 participants