Re: How to create a library that detects the processor and uses SIMD instructions as necessary



"ldb" <spamtrap@xxxxxxxxxx> wrote:

The cleanest way to do this would be to determine which version to use
at compile-time, and compile the correct functions into the executable.
If distributing source isn't an option, you can just compile two
completely seperate executables, and call the correct one at run-time.

Doing it "on the fly" or "just in time" is going to cost too much
computationally, in general.

That's just nonsense. Intel does this in virtually every
computationally-intensive application and driver they deliver. You call
one function at init time that sets up a table of function pointers.
Performance delta is exactly the same as the difference between a straight
function call and a C++ virtual function call. Since this is only used for
computationally-intensive functions, the overhead is irrelevant.
--
- Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.

.



Relevant Pages

  • Re: exportdll DLL
    ... way it can succeed is if you force a compile ... since an inline function doesn't really belong to any module; ... The virtual function issue is more interesting. ... Suppose you have the OP's class CMetaData: ...
    (microsoft.public.vc.mfc)
  • RE: [newbie][long]Pure virtual function call :(
    ... > I'm Visual C++ 6 newbie. ... I'm trying to compile some simple ... >: see declaration of 'QueryInterface' ... > virtual function was not defined ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Compile Error on Propputref
    ... > When i compile with this method it produces the following error ... But when i change propputref to propput it compiles ok. ... > cannot instantiate abstract class ... > virtual function was not defined ...
    (microsoft.public.vc.atl)
  • RE: [newbie][long]Pure virtual function call :(
    ... I'm trying to compile some simple ... >: see declaration of 'QueryInterface' ... > virtual function was not defined ... > pure virtual function was not defined ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Undefined reference to vtable
    ... Karl Ebener wrote: ... > I have created a program using several classes with inheritage. ... > compile and link, ... A call to virtual function shouldn't go through vtable, ...
    (comp.lang.cpp)