Skip to contentSkip to conversation

altivec

DISCUSSION Sacha Varma 6 participants 8 messages Jul 9, 1999 – Jul 14, 1999

lore
Share & tools
lore
#0 lore raw

Some questions about altivec & LinuxPPC:

1. is there a free C compiler supporting altivec instructions for linuxPPC?

2. would it be possible to trap altivec instructions on a non-altivec processor and reroute them through code using generic instructions? (I believe this is how Apple's MacOS altivec simulator does it). Presumably there is a bad instruction interrupt or something and code in the kernel to trap these interrupts? (Excuse my naivety; I'm more of a kernel user than hacker - for now!)

3. has anyone written a C library to simulate the altivec instructions?

--
sacha varma : system simulation ltd : [email protected]

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#1 lore raw
Quoted 6 lines · Sacha Varma

Some questions about altivec & LinuxPPC:

1. is there a free C compiler supporting altivec instructions for linuxPPC?

Possibly. Someone from Cygnus (the maintainers of egcs/gcc) mentioned he'd gotten source patches from Motorola that add AltiVec support to gcc.

Since MacOS X is a descendant of NeXTStep, and since NeXT always used gcc, and since Apple is going to embrace AltiVec, one can reasonably expect that at least Apple will use an AltiVec-aware variant of gcc. In an ideal world, AltiVec support would make it into the main gcc tree.

Quoted 2 lines

2. would it be possible to trap altivec instructions on a non-altivec processor and reroute them through code using generic instructions?

Possible - yes. Dead slow - absolutely. (Apple's simulator is strictly a development tool, nothing more.)

Quoted 1 line

(I believe this is how Apple's MacOS altivec simulator does it).

I don't know.

Quoted 4 lines

Presumably there is a bad instruction interrupt or something and code in the kernel to trap these interrupts? (Excuse my naivety; I'm more of a kernel user than hacker - for now!)

Yes, such exceptions are supported by PPC hardware.

Quoted 2 lines

3. has anyone written a C library to simulate the altivec instructions?

Apple's simulator is the only such program I know of.

Holger

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#2 lore raw
Quoted 6 lines
Quoted 3 lines

2. would it be possible to trap altivec instructions on a non-altivec processor and reroute them through code using generic instructions?

Possible - yes. Dead slow - absolutely. (Apple's simulator is strictly a development tool, nothing more.)

It shouldn't be dead slow, but it will be much slower than it would be on Altivec processors (esp. since cache pipelining won't work nearly the same). Basically, most Altivec instructions can be replaced with for loops. So long as the iteration count of the loop is high, the overhead from the illegal instruction trap activity should be minimized, so it should boil down to about the same time as an assembly-coded loop.

Quoted 3 lines
Quoted 2 lines

3. has anyone written a C library to simulate the altivec instructions?

Apple's simulator is the only such program I know of.

Something like this wouldn't be a library, it would have to be a kernel addition. A SIGILL handler just doesn't tell you enough to be able to trap, analyze, and execute the instruction, then adjust the return pointer and resume at the next instruction (and what about multiple Altivec instructions in sequence?).

Personally, I'm looking for a LINPACK/CLASSPACK-like library that has an Altivec and a non-Altivec version, so you can install whatever one is appropriate on the machine. ^_^

I'm also wondering what has been done on this issue on the Intel side of the fence, since KNI and 3Dnow! are similar to Altivec in concept and, at least for 3Dnow!, implementation.
_________________________________________________________________________

                                __________
##   ##   ###   #####   #####   \********/   #####    ###    ##### ######
### ###  ## ##  ##  ## ##        \*/\/\*/    ##  ##  ## ##  ##     ##
#######  ## ##  #####   ####       /\/\      #####   ## ##   ####  ####
## # ## ####### ##  ##     ##      \**/      ##  ## #######     ## ##
##   ## ##   ## ##  ## #####        \/       #####  ##   ## #####  ######

_________________________________________________________________________
### Mike DeSimone ### [email protected] ### ares.marsbase.mars ###

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#3 lore raw
Quoted 8 lines · Mike DeSimone
Quoted 7 lines
Quoted 4 lines

2. would it be possible to trap altivec instructions on a non-altivec processor and reroute them through code using generic instructions?

Possible - yes. Dead slow - absolutely. (Apple's simulator is strictly a development tool, nothing more.)

Quoted 7 lines

It shouldn't be dead slow, but it will be much slower than it would be on Altivec processors (esp. since cache pipelining won't work nearly the same). Basically, most Altivec instructions can be replaced with for loops. So long as the iteration count of the loop is high, the overhead from the illegal instruction trap activity should be minimized, so it should boil down to about the same time as an assembly-coded loop.

Well, if you do instruction-by-instruction emulation, the iteration count is at most 16 (16 bytes in a vector). Furthermore, the overhead of a context switch into privileged mode and back again is not negligible (at the very least a pipeline flush and some saving/restoring of registers). Finally, keeping the emulated vector registers somewhere in memory means that you will quite often be limited by the availability of 'only' one load/store unit.

[...]

Quoted 5 lines

I'm also wondering what has been done on this issue on the Intel side of the fence, since KNI and 3Dnow! are similar to Altivec in concept and, at least for 3Dnow!, implementation.

Similar? Please forgive my ranting, but AltiVec is feature-complete, orthogonal, and implemented without compromises. MMX, 3DNow!, and ISSE have none of the above three qualities. They were available sooner, but that's about it.

Holger

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#4 lore raw
Quoted 7 lines

Well, if you do instruction-by-instruction emulation, the iteration count is at most 16 (16 bytes in a vector). Furthermore, the overhead of a context switch into privileged mode and back again is not negligible (at the very least a pipeline flush and some saving/restoring of registers). Finally, keeping the emulated vector registers somewhere in memory means that you will quite often be limited by the availability of 'only' one load/store unit.

That's true, I forgot about the 16 byte limit. That will really make the overhead significant. Kind of annoying to me (my typical vector length is over 900). Maybe having two libraries is the way to go, then...

Quoted 8 lines
Quoted 4 lines

I'm also wondering what has been done on this issue on the Intel side of the fence, since KNI and 3Dnow! are similar to Altivec in concept and, at least for 3Dnow!, implementation.

Similar? Please forgive my ranting, but AltiVec is feature-complete, orthogonal, and implemented without compromises. MMX, 3DNow!, and ISSE have none of the above three qualities. They were available sooner, but that's about it.

That's why I said "similar in concept" ... not execution. And I said KNI (the PIII new instructions), not MMX, which is integers only. (Also why I didn't mention Sun's VIS).
_________________________________________________________________________

                                __________
##   ##   ###   #####   #####   \********/   #####    ###    ##### ######
### ###  ## ##  ##  ## ##        \*/\/\*/    ##  ##  ## ##  ##     ##
#######  ## ##  #####   ####       /\/\      #####   ## ##   ####  ####
## # ## ####### ##  ##     ##      \**/      ##  ## #######     ## ##
##   ## ##   ## ##  ## #####        \/       #####  ##   ## #####  ######

_________________________________________________________________________
### Mike DeSimone ### [email protected] ### ares.marsbase.mars ###

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#5 lore raw

I would love to work with Altivec, does anyone have any idea where to get the hardware preferably cheap =)?

Quoted 24 lines
Quoted 6 lines

Well, if you do instruction-by-instruction emulation, the iteration count is at most 16 (16 bytes in a vector). Furthermore, the overhead of a context switch into privileged mode and back again is not negligible (at the very least a pipeline flush and some saving/restoring of registers). Finally, keeping the emulated vector registers somewhere in memory means that you will quite often be limited by the availability of 'only' one load/store unit.

That's true, I forgot about the 16 byte limit. That will really make the overhead significant. Kind of annoying to me (my typical vector length is over 900). Maybe having two libraries is the way to go, then...

Quoted 8 lines
Quoted 4 lines

I'm also wondering what has been done on this issue on the Intel side of the fence, since KNI and 3Dnow! are similar to Altivec in concept and, at least for 3Dnow!, implementation.

Similar? Please forgive my ranting, but AltiVec is feature-complete, orthogonal, and implemented without compromises. MMX, 3DNow!, and ISSE have none of the above three qualities. They were available sooner, but that's about it.

That's why I said "similar in concept" ... not execution. And I said KNI (the PIII new instructions), not MMX, which is integers only. (Also why I didn't mention Sun's VIS).
_________________________________________________________________________

Quoted 8 lines
                               __________
##   ##   ###   #####   #####   \********/   #####    ###    ##### ######
### ###  ## ##  ##  ## ##        \*/\/\*/    ##  ##  ## ##  ##     ##
#######  ## ##  #####   ####       /\/\      #####   ## ##   ####  ####
## # ## ####### ##  ##     ##      \**/      ##  ## #######     ## ##
##   ## ##   ## ##  ## #####        \/       #####  ##   ## #####  ######

_________________________________________________________________________
### Mike DeSimone ### [email protected] ### ares.marsbase.mars ###

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#6 lore raw
Quoted 2 lines · sean o'malley

I would love to work with Altivec, does anyone have any idea where to get the hardware preferably cheap =)?

The MAX processor hasn't even been released yet. When it is, Apple is always the cheapest supplier of PowerPC systems.

--
Matt Porter
[email protected]
This is Linux Country. On a quiet night, you can hear Windows reboot.

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]

#7 lore raw
Quoted 3 lines · Matt Porter

The MAX processor hasn't even been released yet. When it is, Apple is always the cheapest supplier of PowerPC systems.

             ^^^^^^^^^^^^^^^^^

Something needs to be done about this :)

Josh

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]] [[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]] [[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]