You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by masahi via Apache TVM Discuss <no...@discuss.tvm.ai> on 2020/10/25 23:36:01 UTC

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?


Hi, the model I'm working on has the following output:

```
  ...
  %1562 = (%1550, %1551, %1552, %1553, %1554, %1555, %1556, %1557, %1558, %1559, %1560, %1561);
  (%1549, %1562)
}
```
i.e., the output is a tuple where the second element is another tuple with 12 elements.

`relay.build(...)` errors on this model with the following message:
```
  [bt] (0) /mnt/2e797a66-fd2b-44fc-a3ba-24d7d65f2780/projects/dev/tvm/build/libtvm.so(+0x104245b) [0x7f30ec71a45b]
  File "/mnt/2e797a66-fd2b-44fc-a3ba-24d7d65f2780/projects/dev/tvm/src/relay/backend/graph_plan_memory.cc", line 86
TVMError: Check failed: tok.size() == 1U (12 vs. 1) : 
```

The error is happening when memory planner is visiting `TupleNode`:
https://github.com/apache/incubator-tvm/blob/main/src/relay/backend/graph_plan_memory.cc#L82-L87

So it seems to me the memory planner is complaining about tuple of tuples? @tqchen do you have an idea what's going on?





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/50452266183cb4265397624472879a0e67bd0648db32fa949ea3448e817b505e).

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?

Posted by Jared Roesch via Apache TVM Discuss <no...@discuss.tvm.ai>.

@masahi there is code for doing this mapping inside of the VM, if you message me on Slack we can probably figure out how to update the code, might require a bit of debugging





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/4) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/bf19040c41b0a311b987875b6e96ee1078cf58bb3a9c129a51f7061f5d4a6ebf).

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?

Posted by tqchen via Apache TVM Discuss <no...@discuss.tvm.ai>.

Yes, we will need to update the code if we want to support nested tuple. Perhaps we can pass he token around also in nested tuples and unpack them.





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/3) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/f2a881a2a92cca36fd061eb062098936c0fd345f62c03be16d61c46252ca6c23).

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?

Posted by Matt Barrett via Apache TVM Discuss <no...@discuss.tvm.ai>.

We (@manupa-arm) ran into this in the graph partitioner. I think in the end we were forced to introduce logic to flatten such tuples, so if a more fundamental solution can be found that would simplify our logic.





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/2) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/d0db2bb10a151c1ca453c30522438a9d29c285d80dc68a3007efaccc47a6d5e2).

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?

Posted by Jared Roesch via Apache TVM Discuss <no...@discuss.tvm.ai>.

@masahi FromTupleType is the one you probably want it takes a Type representing the layout of `expr` and returns a sequence of expressions which correspond to the linearized view of the tuple, i.e it will handle projecting nested tuples out.





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/9) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/eb2255210af9de48fbdff2e6a772700fe80241308c748a2849c1340db59f38bb).

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?

Posted by masahi via Apache TVM Discuss <no...@discuss.tvm.ai>.

thanks, I'll take a look





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/8) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/974366e0e93c322889903ca84a622faed4f0ab76c0532ee3040e1edb4cca6292).

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?

Posted by Zhi via Apache TVM Discuss <no...@discuss.tvm.ai>.

The helpers are here:

https://github.com/apache/incubator-tvm/blob/98c2096f4944bdbdbbb2b7b20ccd35c6c11dfbf6/src/relay/op/memory/memory.cc#L287-L300





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/7) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/40f0b7631dcb729048da691d41ce9ecd29a09803c8ef956d56c91ca4f1027b11).

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?

Posted by Jared Roesch via Apache TVM Discuss <no...@discuss.tvm.ai>.

There is a C++ helper called Linearize or FlattenTuple (can look later)





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/6) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/956f8474a4a847d7175b4af218ab70c259098a6ff0977cd4e3392bf3b1eb3d23).

[Apache TVM Discuss] [Questions] Graph_plan_memory doesn't support nested tuples?

Posted by masahi via Apache TVM Discuss <no...@discuss.tvm.ai>.

Ok, thanks! I found the code Jared was probably referring to (t`ransform/memory_plan.py`, `transform/memory_alloc.py`, not sure why they are written in python). I'm going to learn about memory planning and see what I can do.





---
[Visit Topic](https://discuss.tvm.apache.org/t/graph-plan-memory-doesnt-support-nested-tuples/8278/5) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/4f0d8e7d48f88fa2edaaf07decdea7d73d1155699c8100d7114a19216987fb01).