[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: octave and LLVM google summer of code project
From: |
Eugene I |
Subject: |
Re: octave and LLVM google summer of code project |
Date: |
Sun, 20 Apr 2008 13:56:38 -0700 (PDT) |
John W. Eaton wrote:
>
>
> Does that happen for each statement, or is it required that a full
> function be compiled? Does it work for each invocation of a function
> (i.e., you know the types of the arguments for a given call), or are
> you doing some type inferencing? If so, how where is the code that
> does that part?
>
Right now we simply jit compile loop blocks. Either the whole block is
compiled or it is interpreted. Functions are expanded in jit compiled code
(almost treated like macro) - not ideal, but simplifies everything. For type
inference you can take a look in JITFunc::compile_assignment.
> Can you give an example of the type of operation where you see an
> improvement? What is the difference in the way the two operations
> are handled by the FreeMat interpreter and LLVM?
>
How about something like this:
function tjit1
A = zeros(512,512);
for i=1:512;
for j=1:512
k = i-j;
if ((k<5) && (k>-5))
A(i,j) = k;
else
A(i,j) = 0;
end
end
end
In this case jit compiler can generate code which is almost as fast as
equivalent C code. It even knows how to compile array indexing directly.
With LLVM optimization enabled the resulting executable code is amazingly
short and simple. I believe the only additional work we do is checking array
bounds and expanding the array as needed.
Interpreter on the other hand has to interpret the inner loop 512^2 times.
LLVM jit compiler is quite fast so jit compiling code becomes faster than
interpreting for fairly small arrays.
--
View this message in context:
http://www.nabble.com/octave-and-LLVM-google-summer-of-code-project-tp16565922p16798601.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.
- Re: octave and LLVM google summer of code project, (continued)
- Re: octave and LLVM google summer of code project, Duncan Sands, 2008/04/09
- Re: octave and LLVM google summer of code project, David Bateman, 2008/04/09
- Re: octave and LLVM google summer of code project, Eugene I, 2008/04/19
- Re: octave and LLVM google summer of code project, dbateman, 2008/04/19
- Re: octave and LLVM google summer of code project, Eugene I, 2008/04/19
- Re: octave and LLVM google summer of code project, dbateman, 2008/04/20
- Re: octave and LLVM google summer of code project, John W. Eaton, 2008/04/20
- Re: octave and LLVM google summer of code project, John W. Eaton, 2008/04/20
- Re: octave and LLVM google summer of code project, Eugene I, 2008/04/20
- Re: octave and LLVM google summer of code project, John W. Eaton, 2008/04/20
- Re: octave and LLVM google summer of code project,
Eugene I <=
- Re: octave and LLVM google summer of code project, John W. Eaton, 2008/04/20
- Re: octave and LLVM google summer of code project, Eugene I, 2008/04/22
Re: octave and LLVM google summer of code project, Wolfgang_M, 2008/04/15