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] Refactor BlockScope outside schedule #15034

Merged
merged 1 commit into from Jun 8, 2023

Conversation

quic-sanirudh
Copy link
Contributor

@quic-sanirudh quic-sanirudh commented Jun 6, 2023

This PR does 2 major changes to TIR.

  1. Move stage_pipeline member into BlockInfo from BlockScope
  2. Extract BlockScope outside schedule

This is the first step of a change to expose block level dependence analysis to TIR passes. This PR moves BlockScope to be outside schedules so that it can be used in a follow-up analysis pass to compute block level dependences if needed for a transformation pass.

There is some extra discussion about this change in this discussion forum post

This PR does 2 major changes to TIR.

1. Move stage_pipeline member into `BlockInfo` from `BlockScope`
2. Extract `BlockScope` outside schedule

This is the first step of a change to expose block level dependence
analysis to TIR passes. This PR moves BlockScope to be outside schedules
so that it can be used in a follow-up analysis pass to compute block
level dependences if needed for a transformation pass.

There is some extra discussion about this change in
[this discussion forum post](https://discuss.tvm.apache.org/t/why-is-block-dependency-info-attached-to-schedules/14975)
@tvm-bot
Copy link
Collaborator

tvm-bot commented Jun 6, 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 @Hzfengsy @junrushao

@Hzfengsy Hzfengsy merged commit e5c1a24 into apache:main Jun 8, 2023
19 checks passed
junrushao pushed a commit to junrushao/tvm that referenced this pull request Jun 22, 2023
This PR does 2 major changes to TIR.

1. Move stage_pipeline member into `BlockInfo` from `BlockScope`
2. Extract `BlockScope` outside schedule

This is the first step of a change to expose block level dependence
analysis to TIR passes. This PR moves BlockScope to be outside schedules
so that it can be used in a follow-up analysis pass to compute block
level dependences if needed for a transformation pass.

There is some extra discussion about this change in
[this discussion forum post](https://discuss.tvm.apache.org/t/why-is-block-dependency-info-attached-to-schedules/14975)
quic-sanirudh added a commit to quic-sanirudh/tvm that referenced this pull request Jun 23, 2023
This work introduces a new object called `BlockDependenceInfo` that
computes and returns block dependences. The idea is to be able to expose
block level dependences to TIR passes without having to create an
explicit schedules.

The patch introduces 2 main classes:
1. `SRefTreeCreator` - This creates and returns a new SRefTree and
   returns a map from original statements to corresponding srefs
2. `BlockDependenceInfo` - This object computes the actual dependences
   between blocks within a block scope and returns it for access in TIR
passes

This is a continuation to
[PR apache#15034](apache#15034) and completes the work
started there to expose block level dependences to TIR passes

Note: One major difference between the SRef Tree created for dependence
analysis here versus the one already present in schedules is that this
SRef tree only contains block nodes and not loops. This makes it easier
to find the parent blocks (by just accessing `parent` member)
Hzfengsy pushed a commit that referenced this pull request Jun 24, 2023
* [TIR] Block dependence analysis without schedules

This work introduces a new object called `BlockDependenceInfo` that
computes and returns block dependences. The idea is to be able to expose
block level dependences to TIR passes without having to create an
explicit schedules.

The patch introduces 2 main classes:
1. `SRefTreeCreator` - This creates and returns a new SRefTree and
   returns a map from original statements to corresponding srefs
2. `BlockDependenceInfo` - This object computes the actual dependences
   between blocks within a block scope and returns it for access in TIR
passes

This is a continuation to
[PR #15034](#15034) and completes the work
started there to expose block level dependences to TIR passes

Note: One major difference between the SRef Tree created for dependence
analysis here versus the one already present in schedules is that this
SRef tree only contains block nodes and not loops. This makes it easier
to find the parent blocks (by just accessing `parent` member)

* 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.

None yet

3 participants