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

inlining and recursive processing #46

Open
ninegua opened this issue Nov 16, 2017 · 1 comment
Open

inlining and recursive processing #46

ninegua opened this issue Nov 16, 2017 · 1 comment

Comments

@ninegua
Copy link

ninegua commented Nov 16, 2017

I feel that the code in get_ir_of_code is becoming a re-implementation of Pipeline in compiler.py.

I believe we had this function because we want the result IR to be inlined. There are two places where we need inlining:

  1. before type inference. The primary reason for doing this is that the code to be inlined comes untyped, and will get type inference for free once inlined.
  2. after type inference. The primary reason for doing this is when we need type information before we can be sure which code to inline.

So instead of doing recursive processing on demand, which is similar to invoking the most of the pipeline on a function up to a certain point (like rewrite, or array analysis, or even after parfor), I would suggest we add a post-inference inline pass instead, which is what replace_parallel_functions currently does. This should cut down on the complexity of having to do recursive processing, and simplify things quite a bit. (I actually had already implemented it in a separate branch, which works out great)

Now this is getting awfully similar to what rewrite pass is about, which unfortunately only gives access to things on a per-block basis. But I think a solution to merge inline with rewrite can come in the future.

What do you think? @ehsantn @DrTodd13

@ehsantn
Copy link

ehsantn commented Nov 16, 2017

I think having a separate typed inline pass can be cleaner, but handling all the use cases of get_ir_of_code and compile_to_numba_ir can be challenging since fine-grained control might be required. For example, HPAT replaces some functions based on conditions such as input values, and this logic can't be passed as parameter to a separate pass easily. We can have a meeting to discuss the specifics.

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

2 participants