-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Hexagon] Add test demonstrating how to utilize a rolling buffer for avoiding repeated loads #13340
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
Conversation
|
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 |
to avoid repeated loads on input rows needed by vertically output rows.
|
Many thanks (!!) to @mbaret @NicolaLancellotti for the initial contribution of rolling buffer [1, 2], and to @liangW-intellif and @wrongtest-intellif for their recent translation of rolling buffer to a TIR schedule primitive [3], as well as all others involved in this work. It is a fantastic example of the benefit of a strong open source community! |
mehrdadh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! just small changes
| return conv2d_2x1_filter | ||
|
|
||
|
|
||
| def test_rolling_buffer_conv2d_2x1(hexagon_session): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add @tvm.testing.requires_hexagon
| a = tvm.nd.array(np.ones((6, 32), dtype=dtype), device=hexagon_session.device) | ||
| b = tvm.nd.array(np.zeros((5, 32), dtype=dtype), device=hexagon_session.device) | ||
| mod(a, b) | ||
| tvm.testing.assert_allclose(b.numpy(), np.full((5, 32), 2, dtype=dtype), atol=1e-3, rtol=1e-3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this to the end:
if __name__ == "__main__":
tvm.testing.main()
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/3876284649 Detailswith response |
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/4008831418 Detailswith response |
This PR shows how to utilize the
sch.rolling_bufferschedule primitive to avoid copying repeated rows when loading to fast memory. The example below is like conv2d with filter=[2, 1] and unit weights.Before applying a rolling buffer to the height axis:
After applying
sch.rolling_bufferto the cache_read block along the height axis: