Target optimization

If I compile an application for a specific target, let's say xtarget=ultra3iplus (v8plusa), this compiled application will work on all UltraSPARC CPUs, as they are in the same family, right?

And the application will have better performance on UltraSPARC IIIi CPUs as it's optimized for this architecture, but will the application be slower on the other UltraSPARC CPUs compared to compiling the application for a generic architecture? Or will a generic compilation yield the same run-time performance on UltraSPARC II as it will when I compile for a UltraSPARC IIIi but executes the application on a UltraSPARC II?

hope you understand my confusing question :)

Regards,

Nergal

[708 byte] By [Nergal] at [2007-11-26 10:22:49]
# 1

The SPARC chips from oldest to newest form an almost linear hierarchy. Newer chips oftenintroduce new instruction sets, and usually have different instruction timings.

If you compile for the oldest chip of interest, the code will run on all newer chips, but might not be optimum for the actual chip.

But if you compile for a newer chip, the code might not run at all on an older chip. For example, if you specify US IV+, the generated code will not run on US I.

The exception to the linear hierarchy is the T1 ("Niagara") chip, which has an instruction set similar to US II.

The compiler by default generates code that will run on all UltraSparc chips. If you tell the compiler to generate code for a particular architecture (-xarch) or chip (-xchip), you limit the range of systems on which the code will run.

clamage45 at 2007-7-7 2:23:31 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2
Here is an article that discusses choosing optimization options: http://developers.sun.com/prodtech/cc/articles/options.html
clamage45 at 2007-7-7 2:23:31 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

On that page it says the following....

"For UltraSPARC processors, a generally good option pair to use is -xtarget=ultra3 with -xarch=v8plusa. These options allow the compiler to generate 32-bit code that can run on all the members of the UltraSPARC family and their follow-ons (UltraSPARC I, UltraSPARC II, UltraSPARC III, UltraSPARC IV). The compiler will also schedule the code especially for the UltraSPARC III. "

As I interpret that, is that it is possible to compile for a specific US and it will still run on all CPUs in the US family. Is it just that specific combination that makes this possible?

/Nergal

Nergal at 2007-7-7 2:23:31 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

By default, the current compiler releases generate code targeted for all US processors.

As explained in the article, the option -xtarget=ultra3 sets the -xarch, -xchip, and -xcache options for US III. Such code will not run on, for example, US I. But by adding the option -xarch=v8plusa [i]]after[/i] the -xtarget option, you tell the compiler to use only the basic US instruction set. The code will run better on US III. On other US processors, the code might run more slowly than if you did not specify the -xtarget option.

clamage45 at 2007-7-7 2:23:31 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5
In general the -xarch option controls where your program will run (similar to gcc's -mcpu) and the -xchip option controls where it will get the very best performance (similar to gcc's -mtune).
ChrisQuenelle at 2007-7-7 2:23:31 > top of Java-index,Development Tools,Solaris and Linux Development Tools...