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][Hybrid] fold attr&allocate/realize #110

Merged
merged 4 commits into from
Sep 12, 2020
Merged

[TIR][Hybrid] fold attr&allocate/realize #110

merged 4 commits into from
Sep 12, 2020

Conversation

spectrometerHBH
Copy link
Collaborator

@tqchen
Copy link
Contributor

tqchen commented Sep 10, 2020

feedback: use allocate overload

@spectrometerHBH
Copy link
Collaborator Author

I realize a problem when trying overloading, these two different tir.allocate follow different print formats.

# folded allocate
a = tir.allocate("float32", [1024], "global")
with tir.allocate("float32", [1024], "global") as a:
# pure allocate
tir.allocate(a, "float32", [1024])
with tir.allocate(a, "float32", [1024]):

And now the registration mechanism will discriminate these two formats, not allowing one registered function to follow two different sets of formats, and I don't want to break this limit here. Meanwhile, they accept different arguments.

Since tir.allocate() will always have a corresponding tir.attr() above, we may just remove pure tir.allocate() in Hybrid Script.

@tqchen
Copy link
Contributor

tqchen commented Sep 10, 2020

@spectrometerHBH your change sounds good to me. We might want to think about the argument location of tir.allocate and tir.match_buffer. To make things consistent, we might want to move the dtype after the extents

@spectrometerHBH
Copy link
Collaborator Author

@tqchen I see. And it seems that tir.realize is also foldable with tir.attr(..., "realize_scope"). We may also want to fold them together.

@spectrometerHBH
Copy link
Collaborator Author

cc @tqchen @junrushao1994 @Hzfengsy

@junrushao
Copy link
Member

Will review today!

@spectrometerHBH spectrometerHBH changed the title [TIR][Hybrid] fold attr&allocate [TIR][Hybrid] fold attr&allocate/realize Sep 11, 2020
@tqchen tqchen merged commit 6b4b3e6 into tlc-pack:master Sep 12, 2020
@spectrometerHBH spectrometerHBH deleted the hybrid branch September 12, 2020 02:17
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.

3 participants