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

[Backend] Support multiple return values in LLVM #24

Closed
chhzh123 opened this issue Mar 2, 2022 · 2 comments
Closed

[Backend] Support multiple return values in LLVM #24

chhzh123 opened this issue Mar 2, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@chhzh123
Copy link
Member

chhzh123 commented Mar 2, 2022

A related test can be seen here. We need to find a way to support multiple return values in LLVM.

@chhzh123 chhzh123 added this to the Integration tests milestone Mar 2, 2022
@chhzh123 chhzh123 added the enhancement New feature or request label Mar 2, 2022
@zzzDavid
Copy link
Collaborator

zzzDavid commented Mar 6, 2022

According the MLIR documentation on ExecutionEngine: https://mlir.llvm.org/doxygen/classmlir_1_1ExecutionEngine.html

Assumes the module can be converted to LLVM IR. For each function, creates a wrapper function with the fixed interface
void _mlir_funcName(void **)
where the only argument is interpreted as a list of pointers to the actual arguments of the function, followed by a pointer to the result.

This description is consistent with the execution engine invoke method in python binding: it supports only one return value, although the return statement in IR can have multiple return values.

I think we should put return values in the input argument list during IR building.

@zzzDavid
Copy link
Collaborator

I added a MoveReturnToInput pass to move all return values to input arg list, and now we can support multiple return values. The test passed at this commit point:
bfa76c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants