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][PASS][M1c] PlanUpdateBufferAllocationLocation #7873

Merged
merged 1 commit into from
Apr 19, 2021

Conversation

Hzfengsy
Copy link
Member

This PR is part of the TensorIR upstreaming effort (#7527) as one of the M1c stages, introducing the pass PlanUpdateBufferAllocationLocation.

This Pass will Locate the buffer allocation to the exact position (usually is the lca of buffer access) and inject opaque block
with alloc_buffers to annotate the buffer allocation site.

cc @tqchen @comaniac @jroesch @junrushao1994

@junrushao
Copy link
Member

Shall we find a shorter name this this pass 😆

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.

Shall we find a short name for this pass? What about RealizeBufferAlloc?

Co-authored-by: Tianqi Chen <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
Comment on lines +48 to +52
for i_0 in range(0, 16):
with tir.block([]):
tir.reads([A[i_0, 0:16]])
tir.writes([C[i_0, 0:16]])
B = tir.alloc_buffer([16, 16])
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this test case means that the buffer defined outside this block(the original element_func) will be transformed to a buffer inside the block?
What if the for i_0 in range(0, 16) is a axis with parallel, this will turns a thread common buffer to a thread local buffer?

Copy link
Member

Choose a reason for hiding this comment

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

@jcf94 i believe your understanding is correct in this case

@tqchen
Copy link
Member

tqchen commented Apr 19, 2021

The current naming is fine given it is a pass only used internally. Realize may also may not best describe it, as this pass
"moves"(aka updates) the location of buffer allocation

Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Just chatted with TQ but either of us found no better name... :-(

So let's just stick to PlanUpdateBufferAllocationLocation then...

@junrushao junrushao merged commit 5ae0ef0 into apache:main Apr 19, 2021
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Apr 22, 2021
Co-authored-by: Tianqi Chen <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
echuraev pushed a commit to echuraev/tvm that referenced this pull request Apr 29, 2021
Co-authored-by: Tianqi Chen <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
Co-authored-by: Tianqi Chen <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
Co-authored-by: Tianqi Chen <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
Co-authored-by: Tianqi Chen <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
Co-authored-by: Tianqi Chen <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants