JIT: Difference between revisions

Jump to navigation Jump to search
301 bytes added ,  11 May 2015
no edit summary
m (moved Jit devel to JIT)
No edit summary
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
== JIT development in octave ==
This page should help interested persons which want to start hacking on the current JIT implementation in octave. It's '''NOT''' intended for octave users.
This page should help interested persons which want to start hacking on the current JIT implementation in octave. It's '''NOT''' intended for octave users.


Last year, thanks to Max Brister's work, an initial implement of a just-in-time compiler (JITC) in LLVM for GSoC 2012. [http://planet.octave.org/octconf2012/jit.pdf Here] is Max's OctConf 2012 presentation about his current implementation.
Last year, thanks to Max Brister's work, an initial implement of a just-in-time compiler (JITC) in LLVM for GSoC 2012. [http://planet.octave.org/octconf2012/jit.pdf Here] is Max's [[OctConf 2012]] presentation about his current implementation.


=== recommended reading ===
=== Recommended reading ===
* [http://en.wikipedia.org/wiki/Abstract_syntax_tree AST (Abstract Syntax Tree)]
* [http://en.wikipedia.org/wiki/Abstract_syntax_tree AST (Abstract Syntax Tree)]
* [http://en.wikipedia.org/wiki/Static_single_assignment_form SSA form (Static single assignment form)]
* [http://en.wikipedia.org/wiki/Static_single_assignment_form SSA form (Static single assignment form)]
Line 15: Line 13:
If the conversion fails at any stage, we give up and use the interpreter. Normally, this is done by throwing a jit_fail_exception. The reason why we can't go directly to the LLVM IR, is because Octave's AST does not contain any type information, but LLVM's IR requires it. For example, A = B+C. If B and C are matrices, this has as a drastically different meaning than if B and C are scalars. We use the current types of variables to determine the types of the rest of the variables in the loop.
If the conversion fails at any stage, we give up and use the interpreter. Normally, this is done by throwing a jit_fail_exception. The reason why we can't go directly to the LLVM IR, is because Octave's AST does not contain any type information, but LLVM's IR requires it. For example, A = B+C. If B and C are matrices, this has as a drastically different meaning than if B and C are scalars. We use the current types of variables to determine the types of the rest of the variables in the loop.


=== source code entries ===
=== Source code entries ===


* libinterp/parse-tree/pt-eval.cc line 317
* libinterp/parse-tree/pt-eval.cc line 317
Line 33: Line 31:
To be fair my impressions/opinions are that of a beginner level user and you are welcome to have a look and post your own comments.
To be fair my impressions/opinions are that of a beginner level user and you are welcome to have a look and post your own comments.


=== LLVM Compatibility ===
It seems that LLVM APIs change on a fairly regular basis and this creates build issues for Octave. See [https://savannah.gnu.org/bugs/?41061 Octave fails to build with LLVM 3.5]
{| class="wikitable"
|-
! Octave Version
! LLVM Version
! Successful Build (Y/N)
|-
| 3.8
| 3.3
| Y
|-
| 3.8
| 3.4.2
| N
|}
[[Category:Development]]
[[Category:Development]]
1

edit

Navigation menu