Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[microNPU] Refactor Relay to TIR hook #10599

Merged
merged 4 commits into from
Mar 21, 2022

Commits on Mar 17, 2022

  1. [microNPU] Refactor Relay to TIR hook

    Refactors the Relay to TIR python hook for the NPU so that optimizations
    can be applied across the whole module and not just functions that will
    be offloaded to the NPU. A pass `OutlineCompilerFunctions` is introduced
    to outline NPU functions, which now happens before optimization passes
    are run (this previously happened after the prim_func had been created).
    
    In addition, optimization passes that should only run on NPU functions
    are now limited to running on outlined functions for the NPU (by
    checking the "Compiler" attribute). To help avoid code duplication, a
    helpful decorator `create_npu_function_pass` has been created for python
    passes that should only run on NPU functions.
    
    This refactor helps move a number of passes in the microNPU codegen to
    use an IRModule -> IRModule philosophy.
    
    Change-Id: Icdea9ba43da0157d5ee17529d2b23b761396d112
    lhutton1 committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    c0a03b7 View commit details
    Browse the repository at this point in the history
  2. add mixed compilers to test

    Change-Id: I3ca48738e096bb0f4dc362f0e9550317fc0d5afd
    lhutton1 committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    0b79771 View commit details
    Browse the repository at this point in the history
  3. Address comments including renaming both npu_pass and RelayToTIR

    This commit renames `npu_pass` -> `create_npu_function_pass`.
    
    It also renames the `RelayToTIR` pass created in Python to `LowerToTIR`,
    along with moving it to compiler.py to make it clear that this pass is a
    wrapper around the `_lower_to_tir` function. In addition, to make it
    explicit that the `lower_to_tir` func->func pass should not be used
    directly it has been renamed to `_lower_to_tir` - it is being maintained
    since it is used in many tests.
    
    Change-Id: I3a0a06801f029aeaa4a51c2d86d8703bb0d7afbb
    lhutton1 committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    92dee34 View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2022

  1. address nit and small fix to example

    Change-Id: I44c64de15fa8680cc89ce0440ffa6c9e0ec62a50
    lhutton1 committed Mar 21, 2022
    Configuration menu
    Copy the full SHA
    94fd3cd View commit details
    Browse the repository at this point in the history