Followup discussion with @sgrechanik-h on memoization. At the current moment, I have decided instead to avoid memoization as much as possible mainly because memoization can cause problems when we update context information about variable x(and previously computed transformation about x related expression may no longer hold. One way to get around this problem is renaming (we rename the variable to another one every time its context information changes). This might need some thoughts and change in the IR, but it follows the same spirit as SSA.
Alternatively, the strategy is to actively clean up the cache when there is context information change. One of the first analyzer memoization analyzer is common sub-expression folding and canonicalization, which maps two instances of x + y into the same address. In this case, because it is not dependent on the context information, we are fine. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/dmlc/tvm/issues/2588#issuecomment-478357960