Skip to main content

Java Tuning of specific processors. AMD APL ... ACML etc. ?

6 replies [Last post]
codingnet
Offline
Joined: 2006-09-27

Hello...

there are some Questions I can't answer myself. Maybe this is the right place :-)

I have found special Libraries for Intel and AMD CPU's incl. a set of software routines that 'accelerate app development and optimization' with massive performance gain's in special routines. The Intel Lib's seems to have a special Licence (?) and the AMD Lib's seems to be free to use.

- AMD Performance Library (APL) (..ACML)
http://developer.amd.com/assets/APL-1.0-GDC-Overview.pdf
http://developer.amd.com/apl.jsp

- Intel (IPP) Integrated Performance Primitives (..Intel MKL etc)

OK i can use the Intel IPP via native Interface ... the JNI Classes are included. I can write my own JNI to the AMD's lib but ..

How can Java use this special routines ?
The interesting lib for me is the AMD APL because it is free to use.

Is it possible that the JVM and some routines that were implemented in Java can use these special routines to get the performance gain internal ?

Maybe this would be an interesting part for "Out of Box Performance" [David Dagastine's Weblog]

... little dream ;-) speeding up the Java native Lib's ... jpeg encoding/decoding, zlib twice as fast

string processing ... colorcode conversion .. java 2d .. media framework OpenCV in Java blub blub

Best Regards

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
codingnet
Offline
Joined: 2006-09-27

Thank you for the comments,

i just will see what is possible if high optimized code is used. I'm primarily not interested in using other lib's. But I'm interested to see what is possible with high optimized code and if there is a way Java deliver this performance by special Hotspot routines or whatever.

The libraries by intel and amd are special routines coded in assembler for there special CPU's.
The other way to do that (not using special libs) is to put the special optimized assem. code in my c or c++ code.
The Lib's have some extras: CPU Type detection to use the available Features of this CPU Type etc.

So if a Java, Hotspot, c, assembler professional or just a pro. knows this special code, would it be possible to integrate it in the Hotspot Compiler ?

------------ >
The Math class in java was native before 1.3 or 1.4 ....converted it to pure java.... better than the JNI "hand optimized" version.
------------ >
A very interesting part I have not known before ..

regards

tom

linuxhippy
Offline
Joined: 2004-01-07

> So if a Java, Hotspot, c, assembler professional or
> just a pro. knows this special code, would it be
> possible to integrate it in the Hotspot Compiler ?
This has nothing to do with HotSpot, search for the native library sources on openjdk.org, these could be enhanced with the libraries you mention.

lg Clemens

linuxhippy
Offline
Joined: 2004-01-07

Well you would have to download openjdk and rewrite the native implementations of the parts you are interrested in. But as far as I know a lot of native stuff is already quite hand-optimized.
So its not just as easy as throwing the lib to java and say "eat that" ;)

The JNI piece is different ... for primitive data types and complex operations you can get significant gains, for small pieces the JNI overhead is much larger than the saved cycles.

Furthermore take such libs with a grain of salt - these libs are optimized to specific processors with specific features and specific performance characteristics. (especially to outperform competitors CPUs). Hand-optimized code or opensource-performace-libs are often much better optimized for different CPUs.

lg Clemens

codingnet
Offline
Joined: 2006-09-27

Yip your right...

"a lot of native stuff is already quite hand-optimized." But for example take a look at the "optimized" IJG Reference JPEG encoder/decoder vs. the high assembly optimized Intel IPP Jpeg codec. [b]It is twice as fast - a 100% Performance Gain.[/b] Take a look at Marks Blog http://marknelson.us/2002/07/01/intels-jpeg-library

I think the JVM is exact the right place to use this high optimized libs. Writing my OO Javacode and get the maximum possible Performance out of any CPU without knowing the caches and registers and special instruction in my CPU.
(found some links .. "that the ipp libs also boost up the performance on AMD CPU's")

Take a look at the Performance Gain, it is not just about 1 to 9% !
OK most of the Benchmarks with max Performance Gain are only for very very special routines but let's just bring 25% of this Performance to Java would be a big win.

Some Examples:

- IPP String Processing: "Incorporate text database management, search and retrieval, or document indexing processing into your applications using: RDBMS engines, XML parsers". Average Performance Gain [b]300%[/b] ...
OK it says nothing ! We need the Realworld Benchmarks !
Intel IPP included some sample code called ippgrep. It is a small regexp demo code. So anyone who is good c coder [I'am not :-( ] can build a Demo to run a Benchmark vs. Java ?
Or is able to bring up JNI to clever code using the IPP String Functions.

Maybe with help of a friend [c-pro] i'am able to benchmark it ?

- There are much more routines that are optimized in this lib's and that we have in Java.
Found another interesting Benchmark in zlib compression lib. There is again a big perf. gain. Compress the Calgary Corpus dataset with double speed...

- There are many more routines that if the performance win is not a fake we need in Java. Colorcode conversion in BufferedImage and many others for Java 2D or 3D.

Take a look at http://www.intel.com/cd/software/products/asmo-na/eng/perflib/302910.htm for some Benchmarks by intel.

If there are routines that only can be used in special areas, it ist maybe a part for the HotSpot Compiler (JIT) to use the optimized routines if it's possible. ?!

So this would be a nice Performance Project ?!

OK my last Line ... found another Link http://www.ddj.com/dept/64bit/184405996 AMD Core Math Library .. ups the performance gain for double precision floating-point operations per second is unbelievably.

Where is the Thruth ? ( anywhere in the middle ;-)

Best Regards
Tom

linuxhippy
Offline
Joined: 2004-01-07

> I think the JVM is exact the right place to use this
> high optimized libs. Writing my OO Javacode and get
> the maximum possible Performance out of any CPU
> without knowing the caches and registers and special
> instruction in my CPU.
> (found some links .. "that the ipp libs also boost up
> the performance on AMD CPU's")
And why do you think the intel-libs should be better than the libraries delivered with Java?
You compare apples with peaches.

> - IPP String Processing: "Incorporate text database
> management, search and retrieval, or document
> indexing processing into your applications using:
> RDBMS engines, XML parsers". Average Performance
> Gain [b]300%[/b] ...
This stuff can't be used for Java. Really....

> If there are routines that only can be used in
> special areas, it ist maybe a part for the HotSpot
> Compiler (JIT) to use the optimized routines if it's
> possible. ?!
Its really not that easy, believe me.

> So this would be a nice Performance Project ?!
Well, java is now open-source, and I think everybody would be happy if you succeed or generate usefuln results.

> Library .. ups the performance gain for double
> precision floating-point operations per second is
> unbelievably.
And how do you plan to use it?

lg Clemens

PS: The Math class in java was native bevore 1.3 or 1.4 and then they converted it to pure java.
The pure java implementation in conjunction with HotSpot performed better than the JNI "hand optimized" version.

linuxhippy
Offline
Joined: 2004-01-07

by the way this link is even wrong:

http://marknelson.us/2002/07/01/intels-jpeg-library
[quote]
Intel added the MMX instruction sets to their CPU chips starting with their 486 line.
[/quote]

MMX was introduced with the Pentium-MMX to the P5-Line, and to the Pentium-2 to the P6-Line.

lg Clemens