Confusing Behavior with Graph Partitioning

Hi @slyubomirsky ,

Please refer to this for further info about annotations : [RFC][BYOC] An extended graph partitioning flow

I guess in your snippet, these compiler_begins should not happen :

let %x: int32 = annotation.compiler_begin(%6, meta[relay.attrs.CompilerAttrs][5]) /* ty=int32 */;
let %y: int32 = annotation.compiler_begin(0 /* ty=int32 */, meta[relay.attrs.CompilerAttrs][6]) /* ty=int32 */;
.
.
.
let %z: int32 = annotation.compiler_begin(%12, meta[relay.attrs.CompilerAttrs][11]) /* ty=int32 */;

I am not aware of any pass that eliminates let bindings.

I feel this might be a potential bug as you noted in your PR. Out of curiosity, is this relay produced from a relay frontend (i.e. reading from ML model) or something you’ve written in Relay ?

One workaround, is if the calls does not have “effect” maybe they dont need the sequencing anymore than the data dependencies (as visible to relay) require it, then you may not need to introduce lets unless they are introduced by a frontend.

thoughts ? cc : @mbaret @dmitriy-arm