Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Looking for a JIT compiler with good vector support

1 view
Skip to first unread message

alex.ru...@gmail.com

unread,
Nov 2, 2006, 9:32:10 PM11/2/06
to
I'm working on a new array language which needs to have stellar vector
performance. Currently the language is interpretted, with a simple
bytecode VM in the works. I would like to JIT-compile the bytecodes.
Are there any opensource JIT libraries for C/C++ which emit
SSE/MMX/Altivec?

Thanks,
Alex

glenn andreas

unread,
Nov 3, 2006, 10:15:51 AM11/3/06
to
In article <1162521130.5...@b28g2000cwb.googlegroups.com>,
alex.ru...@gmail.com wrote:

You might want to check out LLVM <http://www.llvm.org>, which includes
the ability to generate Altivec and SSE code.

It's a pretty amazing beast (it even has the ability to "rewrite" vector
code down to non-vector code so you can target non-vector architectures
"for free"), though still a bit rough around the edges...

alex.ru...@gmail.com

unread,
Nov 3, 2006, 4:41:11 PM11/3/06
to
>
> You might want to check out LLVM <http://www.llvm.org>, which includes
> the ability to generate Altivec and SSE code.
>
> It's a pretty amazing beast (it even has the ability to "rewrite" vector
> code down to non-vector code so you can target non-vector architectures
> "for free"), though still a bit rough around the edges...

Very cool. Thank you for the link. However, I can't find any
information on how to compile a high level language to LLVM bytecode. I
found HLVM, but unfortunately that project doesn't look like it's
gotten very far. Do you know if there any similar (more mature)
projects? Or a tutorial of some sort?

Thanks,
Alex

glenn andreas

unread,
Nov 3, 2006, 6:17:30 PM11/3/06
to
In article <1162590071.7...@i42g2000cwa.googlegroups.com>,
alex.ru...@gmail.com wrote:

There's a gcc front end for an LLVM back end, which pretty much meets
the definition of "how to compile a high level language to LLVM" though
it's far from something that you'd want to delve through to figure out
how to do it.

Start with the "stacker" example, which takes a FORTH-like stack-based
RPN language and produces the corresponding LLVM structures (which can
be recorded as bytecodes or directly executed). It's definitely the
most "tutorialish" of the batch.

It's mostly straightforward once you get into it ("so how do I make a
'switch' statement? Ah, there's a 'switch' instruction"), but it is a
bit of a curve to get started. I was able to rewrite a stack based
virtual machine that evaluated expressions into a JIT in a couple of
days, and added various statement control structures over the next
couple of days after that.

You can also use the gcc front end to compile code snippet and look at
the resulting bytecodes (and there's pretty much a one-to-one
correspondence between them and the various classes you instantiate).
You don't even have to downlood the whole gcc-llvm toolchain - there's a
web front end that lets you type in code snippets and compile it, which
is great for the "how do I make a 'for' loop with a 'break' statement"
sort of problems.

0 new messages