Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIR] [Analysis] Calculate allocated memory at module level #14711

Merged
merged 2 commits into from
Apr 25, 2023

Conversation

quic-sanirudh
Copy link
Contributor

This patch modifies the existing analysis pass
tir.calculate_allocated_bytes to accept an IRModule as an argument and return allocated bytes for all prim_funcs in the IRModule.

This patch modifies the existing analysis pass
`tir.calculate_allocated_bytes` to accept an IRModule as an argument and
return allocated bytes for all prim_funcs in the IRModule.
@tvm-bot
Copy link
Collaborator

tvm-bot commented Apr 24, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@quic-sanirudh
Copy link
Contributor Author

cc @Icemist @masahi @junrushao

} else {
LOG(FATAL) << "TypeError: Expect the input to be either PrimFunc or IRModule, but gets: "
<< obj->GetTypeKey();
throw;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether "throw" is required here? LogFatal throws InternalError.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I actually saw multiple places within the codebase which had throw after a LOG(FATAL). I looked into the code and see that the InternalError is thrown from the call to LogFatalImpl.

As far as I can tell, LogFatalImpl can be overridden by targets, so maybe that's why the throws are needed as we can't know for sure whether all implementations of LOG(FATAL) would throw InternalError. I'm not completely sure about this, but this is my understanding from looking at the code.

Would love to know if you had any more insights and am happy to remove the throw if you think it's not needed, thanks.

Copy link
Contributor

@Icemist Icemist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a couple of comments.

python/tvm/tir/analysis/analysis.py Show resolved Hide resolved
python/tvm/tir/analysis/analysis.py Outdated Show resolved Hide resolved
@masahi masahi merged commit f5ab3f0 into apache:main Apr 25, 2023
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.

6 participants