Any usable SIMD implementation?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 6 17:42:30 PDT 2016


On 4/6/2016 5:36 AM, Manu via Digitalmars-d wrote:
> But at very least, the important detail is that the version ID's are
> standardised and shared among all compilers.

It's a reasonable suggestion; some points:

1. This has been characterized as a blocker, it is not, as it does not impede 
writing code that takes advantage of various SIMD code generation at compile time.

2. I'm not sure these global settings are the best approach, especially if one 
is writing applications that dynamically adjusts based on the CPU the user is 
running on. The main trouble comes about when different modules are compiled 
with different settings. What happens with template code generation, when the 
templates are pulled from different modules? What happens when COMDAT functions 
are generated? (The linker picks one arbitrarily and discards the others.) Which 
settings wind up in the executable will be not easily predictable.

I suspect that using a pragma would be a much better approach:

    pragma(SIMD, AFX)
    {
	... code ...
    }

Doing it on the command line is certainly the traditional way, but it strikes me 
as being bug-prone and as unhygienic and obsolete as the C preprocessor is (for 
similar reasons).


More information about the Digitalmars-d mailing list