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

[CODEGEN] Add support for extern prologue/epilogue functions #5050

Closed
wants to merge 1 commit into from

Conversation

KireinaHoro
Copy link

This commmit adds support for adding prologue and/or epilogue function calls for a code block via the pragma schedule. A dummy use can be found here: https://gist.github.com/KireinaHoro/c959170557d75d81c52c116c3750d78a

The addition is proposed to support better control in the generated code when using the tensorize and inline asm flows to do codegen for something like Gemmini, which requires explicit fence instructions to block the execution flow until data has been fully flushed back to DRAM. With this change an external function that does the fence can be placed in the epilogue of a computation. The prologue pragma may be useful in similar situations when a device needs some sort of initialization, and is added for symmetry.

This commmit adds support for adding prologue and/or epilogue function
calls for a code block via the pragma schedule.

Signed-off-by: KireinaHoro <i@jsteward.moe>
@KireinaHoro
Copy link
Author

Newcomer here, not sure who to @ for review...

@tqchen
Copy link
Member

tqchen commented Mar 12, 2020

Thanks for the contribution. It would be great if we can add an testcase to cover this usecase. In terms of implementations, such intrinsic is better to be lowered before the codegen phase, since they can be lowered to Call blocks, so that we can make use of most codegens(e.g. CodeGenC will work as well).

Given that this is a new feature, it would be useful to open a RFC thread on the https://discuss.tvm.ai/ to let the folks know about it is coming and discuss the API choices. For example I can see quite a few alternatives:

  • Since this is more like a call_at_epilogue and call_at_prologue.
  • It can be viewed as a context enter exit calls for a context

@tqchen tqchen added the status: need RFC need RFC discussion label Mar 12, 2020
@tqchen
Copy link
Member

tqchen commented Mar 20, 2020

ping @KireinaHoro :)

@KireinaHoro
Copy link
Author

KireinaHoro commented Mar 21, 2020 via email

@KireinaHoro
Copy link
Author

I guess I'd create an RFC on the forum first and see what the community says. Thanks for the attention!

@KireinaHoro
Copy link
Author

KireinaHoro commented Mar 21, 2020

An RFC thread has been created here.

@tqchen
Copy link
Member

tqchen commented Oct 11, 2020

Closed due to inactive status (to make sure every PR get visited instead of being forgotten). The RFC and proposal still makes sense. Thank you @KireinaHoro for bringing this up intially, and a separate PR is more than welcomed.

@tqchen tqchen closed this Oct 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants