[SDL] Re: SIMD
oberon at brandeis.edu
Mon Oct 20 23:49:02 PDT 2003
A lot of people have been saying a lot of weird stuff about SIMD. I'd just
like to respond to all that's been said in one big rant:
Processor dependance is an interesting issue. I'm sure, however, that
there's some way to detect the current processor. As long as the code for
every SIMD instruction set is compiled in, a simple case statement at
run time could figure out which one to use. Once that's done, the union
can be set up appropriately and all the function pointers initialized. No
runtime speed penalty; only during initialization.
As to speed: it would help. The argument about C vs. ASM is spurious --
C compiles to ASM. If you don't trust your compiler to write good ASM then
you have more problems than SIMD. On the mac, at least, there's a C
library provided for doing altivec vector ops. Perhaps all x86 SIMD is so
poorly conceived and implemented that this is not possible, but I highly
doubt it. And while compilers can in theory auto-vectorize stuff, it would be at
compile time, whereas this would be runtime.
I'm kinda confused why everyone is so against this right off. Is there
some bizarre allergy to processing a lot of data at once going around?
It's not like I'm suggesting something infeasible -- plenty of apps use
SIMD. If someone could explain why everyone is in such a hurry to declare
it unpractical or impossible I'd appreciate it.
More information about the SDL