Skip to content

Conversation

@zxy844288792
Copy link

If unused function presents like a cond branch never been accessed, memory allocation pass will throw erros since it is not presented in context_analysis map like errors shows below:

TVMError: Check failed: (it != context_analysis_map_.end()) is false: Cannot find expr in the context analysis map:
E           #[version = "0.0.5"]
E           free_var %x2: Tensor[(2, 2), float32];
E           %0 = fn (%p0: Tensor[(2, 2), float32], Primitive=1) -> Tensor[(2, 2), float32] {
E             multiply(%p0, 3f /* ty=float32 */) /* ty=Tensor[(2, 2), float32] */
E           };
E           %0(%x2) /* ty=Tensor[(2, 2), float32] */

Add RemoveUnusedFunctions pass before memory allocation to avoid this issue.

Thanks for contributing to TVM! Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.

@comaniac
Copy link
Contributor

@jroesch @icemelon9 @zhiics could you guys help review this PR?

@zhiics zhiics merged commit 7c732af into apache:main May 20, 2021
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Jun 17, 2021
* add removeUnusedFunctions pass in vm memoryopt

* fix lint
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Jun 17, 2021
* add removeUnusedFunctions pass in vm memoryopt

* fix lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants