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

Comments

@DrTodd13
Copy link
Contributor

@DrTodd13 DrTodd13 commented Mar 23, 2017

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

@yuyichao

This comment has been minimized.

Copy link
Contributor

@yuyichao yuyichao commented Mar 23, 2017

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

@DrTodd13

This comment has been minimized.

Copy link
Contributor Author

@DrTodd13 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

This comment has been minimized.

Copy link
Contributor

@pabloferz pabloferz commented Mar 23, 2017

@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

This comment has been minimized.

Copy link
Contributor

@yuyichao yuyichao commented Mar 23, 2017

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
@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 label Mar 23, 2017
@DrTodd13

This comment has been minimized.

Copy link
Contributor Author

@DrTodd13 DrTodd13 commented Mar 23, 2017

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

@yuyichao

This comment has been minimized.

Copy link
Contributor

@yuyichao yuyichao commented Mar 23, 2017

You mean lowered AST?

@DrTodd13

This comment has been minimized.

Copy link
Contributor Author

@DrTodd13 DrTodd13 commented Mar 23, 2017

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

@JeffBezanson

This comment has been minimized.

Copy link
Member

@JeffBezanson JeffBezanson commented Aug 8, 2017

Implemented by #22440.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.