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

[TensorIR] Support for match_buffer from subregion #8585

Merged
merged 6 commits into from
Jul 31, 2021

Conversation

Hzfengsy
Copy link
Member

match_buffer inside a block allow users to mark a subregion of the source buffer into a new target buffer. In the following example it does the same job as A[i, j] = 1

with block([128, 128]) as [i, j]:
    A0 = tir.match_buffer(A[i, j], ())
    A0[()] = 1

A further step, it is useful for opaque access (e.g. Tensor intrinsic). It can narrow the access region, also provide some additional information, such as strides and shape for buffer after the pass CompactBuffer. Please see details at a Tensorcore demo with match_buffer in file tests/python/integration/test_lower.py

Please take a look. thanks a lot. @vinx13 @junrushao1994 @tqchen

include/tvm/tir/stmt.h Outdated Show resolved Hide resolved
include/tvm/tir/stmt.h Outdated Show resolved Hide resolved
Hzfengsy and others added 6 commits July 30, 2021 01:32
* support match_buffer_region

(cherry picked from commit 682ca84cf44d1c0aaf98440effc13e12141cf8e0)

* some fix

* change match_buffer_region to match_buffer

* fix printer and parser

* update testcase

* Apply suggestions from code review

Co-authored-by: Wuwei Lin <wuwei@apache.org>
* add match_buffer support to access ditector

(cherry picked from commit b93a593c39a56ebb22c1dce70bfbd4484e581750)

* add match_buffer support to lca ditector

* tensorcore script

* finish e2e tensorcore script

* finish e2e tensorcore script
Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

LGTM

@junrushao junrushao merged commit 2a8950b into apache:main Jul 31, 2021
@Hzfengsy Hzfengsy deleted the subregion branch August 25, 2021 05:23
ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
Co-authored-by: Junru Shao <junrushao1994@gmail.com>
Co-authored-by: Bohan Hou <32121147+spectrometerHBH@users.noreply.github.com>
Co-authored-by: Ruihang Lai <lairuihangdongdong@qq.com>
Co-authored-by: Hongyi Jin <3231950289@qq.com>
Co-authored-by: Wuwei Lin <wuwei@apache.org>
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.

4 participants