On 2009-02-21 17:03:06 +0100, Don <[email protected]> said:

I don't think that's messy at all. I can't see much difference between special support for float[4] versus float4. It's better if the code can take advantage of hardware without specific support. Bear in mind that SSE/SSE2 is a temporary situation. AVX provides for much longer arrays of vectors; and it's extensible. You'd end up needing to keep adding on special types whenever a new CPU comes out.

Note that the fundamental concept which is missing from the C virtual machine is that all modern machines can efficiently perform operations on arrays of built-in types of length 2^n, for some small value of n. We need to get this into the language abstraction. Not follow C++ in hacking a few extra special types onto the old, deficient C model. And I think D is actually in a position to do this.

float[4] would be a greatly superior option if it could be done.
The key requirements are:
(1) need to specify that static arrays are passed by value.
(2) need to keep stack aligned to 16.
The good news is that both of these appear to be done on DMD2-Mac!

Yes, float[4] would be ok, if some CPU independent permutation support can be added. Would this be with some intrinsic then or what? I very much like the OpenCL syntax for permutation, but I suppose that an intrinsic such as "float[4] noref permute(float[4] noref vec, int newPos0, int newPos1, int newPos2, int newPos3)" would work as well. Note that this should also work with double[2], byte[16], short[8] and int[4].

How would pass by value semantics be implemented without breaking compatibility work, would you you have (yet another) type qulifier (noref used in the example above)?

In my opinion, vectors are a fundamental type in my mind and there is a reason that arrays and vectors are kept separate in LLVM. The problem is exposing this to the programmer in the proper way. OpenCL does have a lot of nice things in it that might be worth considering. But, yeah, if something is done for ensuring the alignment of power of 2 vectors, the permutation support and the pass by value, then I would be fairly happy with that as well.

/ Mattias

Reply via email to