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

[TVMC] Add option to dump TIR code to file #14186

Merged
merged 2 commits into from
Mar 6, 2023

Conversation

lhutton1
Copy link
Contributor

@lhutton1 lhutton1 commented Mar 3, 2023

Currently dumps the TIR code after the final phase of lowering (phase 3 from

# Here are the essential transformations done by each phase:
) before codegen. This is done by running a pass to capture the TIR module as it is not saved during the build. The result is saved to file similar to the other code dumps.

In the future it seems good to have more granularity in the IR that is being dumped, e.g. print IR before/after named pass. I thought this might be helpful in the meantime.

cc @ekalda @ashutosh-arm @neildhickey

Currently dumps the TIR code after the final phase of lowering (phase
3 from https://github.com/apache/tvm/blob/665dd413bc85d14f7836324daf7cc0dd9281c85a/gallery/how_to/extend_tvm/low_level_custom_pass.py#L152)
before codegen. This is done by running a pass to capture the TIR
module as it is not saved during the build. The result is saved to
file similar to the other code dumps.

Change-Id: I6da7df8f87ba4d91215adc679d926d4f0ca89019
@tvm-bot
Copy link
Collaborator

tvm-bot commented Mar 3, 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

@github-actions github-actions bot requested review from ashutosh-arm and ekalda March 3, 2023 10:37
Change-Id: I0d1dc761b66c9f41592992580e2ccc0bad8f4769
Copy link
Contributor

@ashutosh-arm ashutosh-arm left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you 😄

@neildhickey
Copy link
Contributor

LGTM too. Thanks

Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@ashutosh-arm ashutosh-arm merged commit a15ade3 into apache:main Mar 6, 2023
@ashutosh-arm
Copy link
Contributor

Thanks @lhutton1, @neildhickey and @echuraev for the commits and the reviews 😄

@lhutton1 lhutton1 deleted the tvmc-dump-tir branch March 6, 2023 21:13
@PhilippvK
Copy link
Contributor

In the future it seems good to have more granularity in the IR that is being dumped, e.g. print IR before/after named pass. I thought this might be helpful in the meantime.

@lhutton1 I really like these changes. Are you going to do a followup for this soon? If not it would be great if we could open up an issue to collect some ideas. I plan to do something similar for the RelayIR dump (allow dumping post/pre-partitioning IR) and would like to follow a similar approach.

@lhutton1
Copy link
Contributor Author

Hi @PhilippvK, thanks for the interest! I'm hoping to have a follow-up soon (~1wk) but I have another commitment I need to work on first. I'll summarise the thoughts I have in a discuss post - it would be good to see if they align to your thoughts/requirements before diving in

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