Skip to content

Improving inductor pattern matcher's replacement graph assumptions #134363

@zou3519

Description

@zou3519

The pattern matcher assumes by default that it is safe to run functional passes on the replacement graph. The ones it runs are DCE and remove_noop_ops. We should try to change it to be more automatic and determine if those passes are safe to run (or add invariants if this is too hard, see also #133250).

This is non-trivial:

  • For DCE we can check if there are any mutable ops. If there are, then it's probably a bad idea to DCE
  • For remove_noop_ops -- this is trickier. We cannot remove intermediate clones if they end up changing the alias relationship between the outputs and the inputs of the replacement graph.

cc @ezyang @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: inductoroncall: pt2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions