Facing issues with Octave build with JIT Compiler Option

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Facing issues with Octave build with JIT Compiler Option

Prasad K
Hi all,

I am using Ubuntu 16.04, Octave 4.2.1 and LLVM 3.4.2.

Below are the steps that i followed:
1. ./configure --enable-jit
2. make -j8

Step 1 seems fine as it is not giving any errors. Step 2 stops making octave
binary with errors.
I have attached the output logs for both step1 and step2.

step1: configure.log
<http://octave.1599824.n4.nabble.com/file/t372789/configure.log>  
step2: make.log <http://octave.1599824.n4.nabble.com/file/t372789/make.log>  

Please help as i was struck in this state since 2 days.

Best Regards,
Prasad



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html

Reply | Threaded
Open this post in threaded view
|

Re: Facing issues with Octave build with JIT Compiler Option

jbect
Le 19/03/2018 à 08:07, Prasad K a écrit :

> I am using Ubuntu 16.04, Octave 4.2.1 and LLVM 3.4.2.
>
> Below are the steps that i followed:
> 1. ./configure --enable-jit
> 2. make -j8
>
> Step 1 seems fine as it is not giving any errors. Step 2 stops making octave
> binary with errors.
> I have attached the output logs for both step1 and step2.
>
> step1: configure.log
> <http://octave.1599824.n4.nabble.com/file/t372789/configure.log>
> step2: make.log <http://octave.1599824.n4.nabble.com/file/t372789/make.log>
>
> Please help as i was struck in this state since 2 days.

Dear Prasad,


First : why do you want to compile with --enable-jit ?  Do you really
need it ?

The JIT in its current form does do much and has several known issues,
and thus is not of much practical use.

*****

Now, if you really want to do this: I think that currently --enable-jit
should work out-of-the-box for LLVM 3.8 and perhaps 3.6 and 3.7.

For earlier versions (3.x with x <= 5) some autoconf macros need to be
written, if i remember correctly.

So, your options are:

a) either use LLVM 3.8, which is the default on Xenial anyway (I assume
you have compiled LLVM 3.4.2 manually ?).

b) or modify manually some parts of the source code to get it working in
LLVM 3.4...  I would need some time to tell you exactly what to modify,
which I do not have currently, so please don't expect any fast answer on
this.


@++
Julien



Reply | Threaded
Open this post in threaded view
|

Re: Facing issues with Octave build with JIT Compiler Option

Prasad K
Dear Julien,

Thanks for the quick reply.

I have successfully built the Octave 4.2.1 with JIT compiler option
(--enable-jit). The problem seems to be with the LLVM toolkit. All the
versions of LLVM that I tried between v3.5 to v6.0.0 have failed. The only
version that worked for me is LLVM v3.3.

Question: why do you want to compile with --enable-jit ?  Do you really need
it ?
Ans: I have a program of simple for loop with matrix multiplication. Just
wanted to know how much time that i can save with JIT.

FYI, with LLVM v3.3, I have not found any significant difference in
execution times with and without JIT.

Thank you,
Prasad



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html

Reply | Threaded
Open this post in threaded view
|

Re: Facing issues with Octave build with JIT Compiler Option

jbect
Le 20/03/2018 à 10:02, Prasad K a écrit :
> I have successfully built the Octave 4.2.1 with JIT compiler option
> (--enable-jit). The problem seems to be with the LLVM toolkit. All the
> versions of LLVM that I tried between v3.5 to v6.0.0 have failed. The only
> version that worked for me is LLVM v3.3.

Sorry but I have mislead you with my previous email :

1) The latest changes on the JIT code were indeed meant to make it work
with LLVM 3.8 (and perhaps 3.5 and 3.6, I should check).   But they have
been applied to the development branch, which means that they will be
available in Octave 4.4.x.

2) In Octave 4.2.x you still have the original JIT code written by Max
Brister, untouched, which means that LLVM 3.3 (perhaps also 3.2 ? 3.1 ?)
is expected as you have noticed.


If you are interested to contribute on this aspect, some work needs to
be done to extend (in both directions !) the range of LLVM versions that
will be supported by the next Octave release (4.4.x).


> Question: why do you want to compile with --enable-jit ?  Do you really need it ?
> Ans: I have a program of simple for loop with matrix multiplication. Just
> wanted to know how much time that i can save with JIT.
>
> FYI, with LLVM v3.3, I have not found any significant difference in
> execution times with and without JIT.

Are you sure that the number of iterations is high enough to trigger the
jit (see jit_startcnt ()) ?

Does your loop actually get jitted or not ?  You can check that using
jit_failcnt ().

@++
Julien

Reply | Threaded
Open this post in threaded view
|

Re: Facing issues with Octave build with JIT Compiler Option

Prasad K
Thanks for the clarifications.

I have attached my code snippet below for your reference.
sgemm.m <http://octave.1599824.n4.nabble.com/file/t372789/sgemm.m>  

As per the suggestion, observed the jit_startcnt(), jit_enable() and
jit_failcnt() as 1000, 1 and 1 respectively. Are they correct?

Thank you,
Prasad





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html

Reply | Threaded
Open this post in threaded view
|

Re: Facing issues with Octave build with JIT Compiler Option

jbect
Le 20/03/2018 à 10:35, Prasad K a écrit :
> Thanks for the clarifications.
>
> I have attached my code snippet below for your reference.
> sgemm.m <http://octave.1599824.n4.nabble.com/file/t372789/sgemm.m>
>
> As per the suggestion, observed the jit_startcnt(), jit_enable() and
> jit_failcnt() as 1000, 1 and 1 respectively. Are they correct?

jit_startcnt = 1000 is ok, since your loop has 102400 it should trigger
the JIT.

jit_failcnt = 1 means that for some reason the JIT has failed to compile
your loop, which is why you don't observe any improvement in performance.


Reply | Threaded
Open this post in threaded view
|

Re: Facing issues with Octave build with JIT Compiler Option

Prasad K
This post was updated on .
I have enabled debug_jit option and my program gave this error for first run: "jit fail:
Missing overload in type inference for #17 = call  (#unknown_function: #9,
matrix: #15)". Any help?
For the second run i don't see any errors.

Thank you,
Prasad






--
Sent from: http://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html

Reply | Threaded
Open this post in threaded view
|

Re: Facing issues with Octave build with JIT Compiler Option

jbect
Le 20/03/2018 à 10:46, Prasad K a écrit :
> I have enabled debug_jit option and my program gives this error: "jit fail:
> Missing overload in type inference for #17 = call  (#unknown_function: #9,
> matrix: #15)". Any help?

Just like this : no.

I would more time (which I do not have right now) to investigate this
issue, looking at what the JIT does on this loop step by step...

Try some variations to see if it helps, for instance : remove the cast
to single and/or comment the final multiplication.

You should open a bug report and attach your cde snippet there if you
don't want this issue to be forgotten.

@++

Reply | Threaded
Open this post in threaded view
|

Re: Facing issues with Octave build with JIT Compiler Option

Prasad K
Thank you. I will try as you suggested.



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html