-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A couple of extensions to rewriter (#1912)
A couple of extensions to the rewriter, motivated by fusion optimization experimentation with SmoLLM. * Support list of constants in match-pattern. * One multi-output scenario is easy to handle with the single-output pattern-matcher (eg. defining a fusion rule for SkipNormalization): namely when the extra outputs are intermediate values used in the computation of the first value. Extend algorithm to handle this scenario using the efficient single-output matching-algorithm. An example for the second point is the following pattern: ```py def skip_norm_pattern(op, input, skip, gamma, epsilon, stash_type): skip_sum = op.Add(input, skip) normalized = op.SimplifiedLayerNormalization( skip_sum, gamma, axis=-1, epsilon=epsilon, stash_type=stash_type, _domain="com.microsoft") return normalized, skip_sum ``` If we successfully find a match for `normalized` (which transitively finds a match for all of the pattern subgraph that leads up to `normalized`), we have also found a successful match for `skip_sum`, so no need for a multi-output match. (Will add test-cases later, as I work through the fusion optimizations I am experimenting with.)
- Loading branch information
1 parent
3016daa
commit f18dadc
Showing
1 changed file
with
75 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters