Skip to content

[TIR][Compute-at] Enable complex floordiv/floormod expressions in compute_at#14854

Merged
quic-sanirudh merged 6 commits intoapache:mainfrom
abhikran-quic:compute_at_floordivmod
Jun 14, 2023
Merged

[TIR][Compute-at] Enable complex floordiv/floormod expressions in compute_at#14854
quic-sanirudh merged 6 commits intoapache:mainfrom
abhikran-quic:compute_at_floordivmod

Conversation

@abhikran-quic
Copy link
Copy Markdown
Contributor

@abhikran-quic abhikran-quic commented May 15, 2023

Right now, compute_at is not able to handle movement of blocks if the indices of tensors contain complex floordiv/floormod operations. For ex. if a layout of tensor contains (width % 2) // 2, compute_at fails with an error.

Check failed: (dom_var.defined()) is false: ValueError: BufferRegion pattern match failed: v2 % T.int64(2) // T.int64(2)

This change is to handle complex expressions in compute_at.

@tvm-bot
Copy link
Copy Markdown
Collaborator

tvm-bot commented May 15, 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

…pute_at

Right now, compute_at is not able to handle movement of blocks if the indices
of tensors contain complex floordiv/floormod operations.
For ex. if a layout of tensor contains (width % 2) // 2,
compute_at fails with an error.
This change is to handle complex expressions.
@abhikran-quic abhikran-quic force-pushed the compute_at_floordivmod branch from 73813d6 to 3371722 Compare May 15, 2023 14:13
@abhikran-quic
Copy link
Copy Markdown
Contributor Author

abhikran-quic commented May 15, 2023

cc @Hzfengsy , @junrushao , @quic-sanirudh , @shingjan

Copy link
Copy Markdown
Contributor

@quic-sanirudh quic-sanirudh left a comment

Choose a reason for hiding this comment

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

LGTM, but I'll prefer if someone else also reviews this as I'm not too familiar with arith pattern matching.

@Hzfengsy
Copy link
Copy Markdown
Member

cc @wrongtest-intellif

Comment thread tests/python/unittest/test_tir_schedule_compute_at.py Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
@abhikran-quic
Copy link
Copy Markdown
Contributor Author

Thank you @wrongtest-intellif for the review. Currently, I'm working on fixing your comments.

Copy link
Copy Markdown
Contributor Author

@abhikran-quic abhikran-quic left a comment

Choose a reason for hiding this comment

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

Thank you @wrongtest-intellif for the review comments. Apologies for replying late. I have fixed the review comments.

Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
@abhikran-quic abhikran-quic force-pushed the compute_at_floordivmod branch from 22c41d5 to fff360b Compare May 29, 2023 15:00
Copy link
Copy Markdown
Contributor Author

@abhikran-quic abhikran-quic left a comment

Choose a reason for hiding this comment

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

Thank you @wrongtest-intellif for sharing more details. Sorry for coming back late but I was trying to fix your review comments and finding an appropriate test case to verify the LOC changed. I have updated the PR with new changes. Request you to please review the PR for any additional feedback.

Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread tests/python/unittest/test_tir_schedule_compute_at.py Outdated
@abhikran-quic abhikran-quic force-pushed the compute_at_floordivmod branch 3 times, most recently from 17090e9 to c2e7c5e Compare June 7, 2023 08:11
@abhikran-quic
Copy link
Copy Markdown
Contributor Author

Hi @wrongtest-intellif , Could you please review this PR ?

Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
@abhikran-quic abhikran-quic force-pushed the compute_at_floordivmod branch from c2e7c5e to 34ba225 Compare June 12, 2023 11:56
Copy link
Copy Markdown
Contributor Author

@abhikran-quic abhikran-quic left a comment

Choose a reason for hiding this comment

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

Thank you @wrongtest-intellif for the comments. I have fixed them. Please review the PR for any more feedback.

Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
Comment thread src/tir/schedule/primitive/compute_at.cc Outdated
@abhikran-quic abhikran-quic force-pushed the compute_at_floordivmod branch 2 times, most recently from b2db447 to 5b4f145 Compare June 12, 2023 14:31
- Merge conditions for floordiv and floormods respectively to handle recursion
- Update test case to handle non-bijective index map
- Update new_required to be in between [required_min, +inf]
@abhikran-quic abhikran-quic force-pushed the compute_at_floordivmod branch from 5b4f145 to dec82f8 Compare June 12, 2023 14:51
Copy link
Copy Markdown
Contributor

@wrongtest-intellif wrongtest-intellif left a comment

Choose a reason for hiding this comment

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

Thanks, now it looks good to me.

@abhikran-quic
Copy link
Copy Markdown
Contributor Author

@tvm-bot rerun

@quic-sanirudh quic-sanirudh merged commit bd24133 into apache:main Jun 14, 2023
@abhikran-quic abhikran-quic deleted the compute_at_floordivmod branch June 14, 2023 06:45
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.

5 participants