| 1 |
|
| 2 |
ORC - The Oil Runtime Compiler |
| 3 |
============================== |
| 4 |
|
| 5 |
(and OIL stands for Optimized Inner Loops) |
| 6 |
|
| 7 |
Orc is the successor to Liboil - The Library of Optimized Inner Loops. |
| 8 |
|
| 9 |
Orc is a library and set of tools for compiling and executing |
| 10 |
very simple programs that operate on arrays of data. The "language" |
| 11 |
is a generic assembly language that represents many of the features |
| 12 |
available in SIMD architectures, including saturated addition and |
| 13 |
subtraction, and many arithmetic operations. |
| 14 |
|
| 15 |
At this point, developers interested in using Orc should look at the |
| 16 |
examples and try out a few Orc programs in an experimental branch |
| 17 |
of their own projects. And provide feedback on how it works. There |
| 18 |
will likely be some major changes in ease of use from a developer's |
| 19 |
perspective over the next few releases. |
| 20 |
|
| 21 |
The 0.4 series of Orc releases will be API and ABI compatible, and |
| 22 |
will be incompatible with the 0.5 series when it comes out. |
| 23 |
|
| 24 |
|
| 25 |
Features: |
| 26 |
|
| 27 |
- Users can create, compile, and run simple programs that use the |
| 28 |
vector extensions of the CPU, all directly from an application. |
| 29 |
|
| 30 |
- Users can compile Orc programs to assembly source code to be |
| 31 |
compiled and used without linking against the Orc library. |
| 32 |
|
| 33 |
- The generic assembly language can be extended by an application |
| 34 |
by adding new opcodes. |
| 35 |
|
| 36 |
- An application can add rules for converting existing or new opcodes |
| 37 |
to binary code for a specific target. |
| 38 |
|
| 39 |
- Current targets: SSE, MMX, MIPS, Altivec, NEON, and TI C64x+. |
| 40 |
(The c64x target only produces source code.) |
| 41 |
|
| 42 |
- Programs can optionally be emulated, which is useful for testing, or |
| 43 |
if no rules are available to convert Orc opcodes to executable code. |
| 44 |
|
| 45 |
|
| 46 |
More information: |
| 47 |
|
| 48 |
Web : http://gstreamer.freedesktop.org/modules/orc.html |
| 49 |
Download : http://gstreamer.freedesktop.org/data/src/orc/ |
| 50 |
Documentation : http://gstreamer.freedesktop.org/data/doc/orc/ |
| 51 |
|
| 52 |
|
| 53 |
Questions and Answers: |
| 54 |
|
| 55 |
- Q: Why not let gcc vectorize my code? |
| 56 |
|
| 57 |
A: Two reasons: first, since Orc's assembly language is much more |
| 58 |
restrictive than C, Orc can generate better code than gcc, and |
| 59 |
second, Orc can generate code for functions you define at runtime. |
| 60 |
Many algorithms require gluing together several stages of operations, |
| 61 |
and if each stage has several options, the total amount of code to |
| 62 |
cover all combinations could be inconveniently large. |
| 63 |
|
| 64 |
- Q: Why not use compiler intrinsics for SIMD code? |
| 65 |
|
| 66 |
A: Compiler intrinsics only work for one target, and need to be |
| 67 |
hand written. Plus, some compilers are very picky about source |
| 68 |
code that uses intrinsics, and will silently produce slow code. |
| 69 |
And, of course, you can't compile intrinsics at runtime. |
| 70 |
|
| 71 |
- Q: How big is the Orc library? |
| 72 |
|
| 73 |
A: For embedded users, the orc-backend meson option can |
| 74 |
be used to disable irrelvant targets. Compiled with only one target |
| 75 |
(SSE), the library size is about 150 kB uncompressed, or 48 kB |
| 76 |
compressed. The goal was to keep the uncompressed size under |
| 77 |
about 100 kB (but that failed!). A typical build with all targets |
| 78 |
and the full ABI is around 350 kB. |
| 79 |
|
| 80 |
|
| 81 |
Caveats (Known Bugs): |
| 82 |
|
| 83 |
- ? |
| 84 |
|
| 85 |
|
| 86 |
Future directions (Possibly outdated): |
| 87 |
|
| 88 |
- Addition of more complex loop control and array structures. |
| 89 |
|
| 90 |
- Addition of an option to compile the Orc library with only the |
| 91 |
runtime features for a single target, e.g., for embedded systems. |
| 92 |
|
| 93 |
- Addition of rewrite rules, which convert an instruction that cannot |
| 94 |
be converted to binary code into a series of instructions that can. |
| 95 |
This is necessary since assembly instructions on most targets do |
| 96 |
not cover all the features of the Orc assembly language. |