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

Generated functions to allow return of Julia IR instead of julia AST #21146

Closed
DrTodd13 opened this issue Mar 23, 2017 · 8 comments
Closed

Generated functions to allow return of Julia IR instead of julia AST #21146

DrTodd13 opened this issue Mar 23, 2017 · 8 comments

Comments

@DrTodd13
Copy link
Contributor

Right now, generators can only return AST. It would help ParallelAccelerator if generators were also allowed to return IR.

@yuyichao
Copy link
Contributor

You mean generated functions? You can just return a llvmcall.

@DrTodd13
Copy link
Contributor Author

DrTodd13 commented Mar 23, 2017

Here is the gist of what I want to be able to do.

@generated function gf1(some_func, arg_type1, arg_type2, ..., arg_typeN)
    optimized_ir = ParallelAccelerator.optimize(some_func, arg_type1, arg_type2, ..., arg_typeN)
    return optimized_ir
end

The problem is that ParallelAccelerator produces an optimized IR for some function for a given set of argument types and then we need to have a Julia method instance created from that IR. Currently, we do this in a really ugly way. We make a stub function and then replace the stub's IR with the optimized IR. This is very fragile and dependent on lots of internal moving parts of Julia. If a @generated could return an IR, then this problem is mitigated to some degree. We'd only then be dependent on the structure of the IR itself and not other Julia internals.

@pabloferz
Copy link
Contributor

@DrTodd13 please quote code snippets and surround macros by backtics in other to avoid bringing accidentally unrelated people to the conversation. (I edited your post above, but consider this in the future)

@yuyichao
Copy link
Contributor

Still, why can't you just return a llvmcall?

@yuyichao yuyichao changed the title Generators to allow return of IR instead of AST. Generated functions to allow return of LLVM IR instead of julia AST Mar 23, 2017
@yuyichao yuyichao added the won't change Indicates that work won't continue on an issue or pull request label Mar 23, 2017
@vtjnash vtjnash changed the title Generated functions to allow return of LLVM IR instead of julia AST Generated functions to allow return of Julia IR instead of julia AST Mar 23, 2017
@vtjnash vtjnash removed the won't change Indicates that work won't continue on an issue or pull request label Mar 23, 2017
@DrTodd13
Copy link
Contributor Author

Yes, @vtjnash is correct. I want to return Julia IR, not LLVM IR.

@yuyichao
Copy link
Contributor

yuyichao commented Mar 23, 2017

You mean lowered AST?

@DrTodd13
Copy link
Contributor Author

DrTodd13 commented Mar 23, 2017

No, in effect it is an optimized version of typed IR returned from code_typed.

@JeffBezanson
Copy link
Member

Implemented by #22440.

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

No branches or pull requests

5 participants