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

more complex examples? #2

Closed
dotnwat opened this issue Dec 20, 2017 · 5 comments
Closed

more complex examples? #2

dotnwat opened this issue Dec 20, 2017 · 5 comments

Comments

@dotnwat
Copy link

dotnwat commented Dec 20, 2017

the idea behind his project is really cool. very nice work.

i've been looking at some of the examples, and i'm wondering if you have any more complex examples of the functions that can be jit compiled. it looks like all the examples (maybe im missing some?) are all just doing basic variable value substitution before the jit compile step. i'm wondering about loop unrolling (e.g. if a vector is the parameter), or perhaps changing control flow to build expressions.

@dotnwat dotnwat changed the title combining functions? more complex examples? Dec 20, 2017
@jmmartinez
Copy link
Owner

Hi Noa,
Thank you for your interest! The project is on its early-beginning, so the examples are rather small unit tests. I'm currently looking for some real-world cases that I could use as a strong motivation for the project. I've been checking Octave and Pythran. If you have any use case in mind please let me know.

i'm wondering about loop unrolling (e.g. if a vector is the parameter)

I will add a small test covering this case, with a vector trying to trigger loop unrolling depending on the vector's size. Thanks!

or perhaps changing control flow to build expressions

I did not understand. What do you mean? I would like to add a mechanism to specify a function to transform the IR (code below). Is it something like this that you had in mind?

void instrument_edges(TerminatorInst* Term) { /*add instrumentation calls*/ }

easy::jit(foo, _2, _1, 
             easy::after_optimization([](BasicBlock* B) {
                 instrument_edges(B->getTerminator()); 
                 return true; 
             }))

Thanks,
Juan

@dotnwat
Copy link
Author

dotnwat commented Dec 21, 2017

Hi Juan,

It would be great to have the loop unrolling example, thanks!

As for the other example I mentioned, I think I was not very clear at all. Let me give an example:

Let's say that I have a method that iterates over a set of elements:

void apply(...) {
for (auto elem : container)
// do something
}

then I have a set of functions, for example add, subtract, divide. the examples in your jit seems to let me create new functions like add5(x), etc... could I jit a method that had semantics in which, say, 5, was added to each element in the container.

e.g. apply(add5);

?

@jmmartinez
Copy link
Owner

I really like this idea. I think I know how to implement it. I will add it to the TODO.md .

@jmmartinez
Copy link
Owner

Hello Noah,
I added the test simple/unroll.cpp covering the unroll case.
For some reason, it's not being vectorized. Hope it's ok.

Cheers,
Juan

@jmmartinez
Copy link
Owner

The composition of the generated functions is now supported!

Cheers!

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