Skip to content

Conversation

@Lunderberg
Copy link
Contributor

Prior to this commit, the "ret_void" argument needed to be explicitly provided to CodeGenLLVM::AddFunction and CodeGenLLVM::DeclareFunction. If this was inconsistent with the builtin::ret() usage within the PrimFunc, this could cause the incorrect return type in the generated LLVM-IR, resulting in LLVM IR verification failures.

This commit removes the "ret_void" argument, instead using the type annotation in PrimFunc::ret_type, removing this opportunity for inconsistency.

This PR is intended to fix a ROCm regression reported in #14901 (comment).

Prior to this commit, the `"ret_void"` argument needed to be
explicitly provided to `CodeGenLLVM::AddFunction` and
`CodeGenLLVM::DeclareFunction`.  If this was inconsistent with the
`builtin::ret()` usage within the `PrimFunc`, this could cause
the incorrect return type in the generated LLVM-IR, resulting in LLVM
IR verification failures.

This commit removes the `"ret_void"` argument, instead using the type
annotation in `PrimFunc::ret_type`, removing this opportunity for
inconsistency.

This PR is intended to fix a ROCm regression reported in
apache#14901 (comment).
@tvm-bot
Copy link
Collaborator

tvm-bot commented Jun 20, 2023

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.

  • No users to tag found in teams: llvm See #10317 for details

Generated by tvm-bot

@Lunderberg Lunderberg marked this pull request as draft June 20, 2023 16:47
@Lunderberg Lunderberg changed the title [LLVM] Remove the "ret_void" argument of AddFunction [Draft][LLVM] Remove the "ret_void" argument of AddFunction Jun 20, 2023
@Lunderberg Lunderberg marked this pull request as ready for review June 21, 2023 15:41
@Lunderberg Lunderberg changed the title [Draft][LLVM] Remove the "ret_void" argument of AddFunction [LLVM] Remove the "ret_void" argument of AddFunction Jun 21, 2023
@tqchen tqchen merged commit 7392432 into apache:main Jun 23, 2023
@Lunderberg Lunderberg deleted the codegen_llvm_use_primfunc_ret_type branch July 3, 2023 13:31
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