Giter Club home page Giter Club logo

Comments (6)

angelayi avatar angelayi commented on July 22, 2024 2

Instead of manually updating the graph signature, you can also try wrapping the code that runs the passes with the following context manager, which will automatically update the signature for you

with ep.graph_module._set_replace_hook(ep.graph_signature.get_replace_hook()):
    AddmmToLinearTransform()(ep.graph_module)

Here is an example where we use it: code

But separately, a work item for the executorch team should be to update the passes so that it will do this automatic updating. cc @kimishpatel who wrote the pass

from executorch.

SS-JIA avatar SS-JIA commented on July 22, 2024 1

@mhs4670go recently, #3483 was landed that allows backends to specify certain operators to avoid decomposing; this will make it so that the AddmmToLinearTransform() pass is not necessary as aten.linear will never be decomposed in the first place.

To see an example of how it works please take a look at the NonDecompTestPartitioner in op_partitioner_demo.py. I would recommend going this route instead of using the linear recomposition pass. Please try it out!

cc: @tarun292

from executorch.

guangy10 avatar guangy10 commented on July 22, 2024

@mhs4670go What backend serialization process are you trying to lower the graph to? Is it Vulkan?

from executorch.

mhs4670go avatar mhs4670go commented on July 22, 2024

@guangy10 Ah, it's internal backend of my company. The graph IR follows this schema. Technically speaking, when the outputs are registered in the circle graph, it refers to the name of the output spec in the exported program, which is addmm. But the name of the created linear op in the transformation is aten_linear_default. Then, there is mismatch between them.

So, I think there are two options for this case.

  1. Update the output spec of the exported program after the transformation.
  2. Set the name of the linear op to the name of the existing addmm operator during transformation.

constant_prop_pass updates the input spec according to the propagation. But replace_addmm_mm_with_linear doesn't update the spec. So, I wonder that I should manually update the spec.

from executorch.

mhs4670go avatar mhs4670go commented on July 22, 2024

@SS-JIA @angelayi Thanks for the helps! Both way are very helpful for me.

from executorch.

kimishpatel avatar kimishpatel commented on July 22, 2024

_set_replace_hook

I did not know about that magic context manager. Yeah when I wrote that pass, I definitely missed this case, but also it was a long time ago so I dont know if we even had graph signature. Will follow up on updating the pass, but I wont be surprised if I forget about it. lol.

from executorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.