Vector operations in cuda?

I recently bagan developing in CUDA, and having done a lot of shader programming before I was a little surprised to se that normal vector operations are not allowed?
For example the following code:
float4 a = b + c // (where b and c are also float4)
Fails to compile. There also seems to be no swizzling or other vector operations. Am I to gather from this that the eight cores on a multiprocessor are actually not vector processors at all, and only process one element at a time? Thanks for any info,

Erik Sintorn

Yes, the G80 is a scalar architecture.

You can however define inlined operators of your own in the C++ style, something like this:

__device__ float4 operator+(const float4 & a, const float4 & b) {

    return make_float4(a.x+b.x, a.y+b.y, a.z+b.z, a.w+b.w);


// ...


    // ...

    float4 a = b + c; // okay



Okay, thank you. But then, when using the G80 for normal graphics stuff (say a fragment shader composed of mainly vector operations), the 8800GTX will only have 32 “effective” 7000 series style fragment shaders?
Do we know if this is the way they plan to go now, or if a future device might have vector based cores? Thanks again.

FYI: I just happened to notice today (why now?! Why not 2 weeks ago!) that there is a project in the SDK that has an entire complement of Vector operations for use in CUDA and on the Host…

You can find them in CudaMath.h in the dxtc project. It’s a nice find!