Results 1 to 2 of 2

Thread: Sum Vector Components in OpenCL (SSE-like)

  1. #1
    Junior Member
    Join Date
    Aug 2011

    Sum Vector Components in OpenCL (SSE-like)

    Is there a single instruction to calculate the sum of all components of a float4, e.g., in OpenCL?

    float4 v;
    float desiredResult = v.x + v.y + v.z + v.w;

    Is there an SSE-like set of instructions?

  2. #2
    Senior Member
    Join Date
    Mar 2011

    Re: Sum Vector Components in OpenCL (SSE-like)

    I've been wondering also why there's no built-in sum function in the OpenCL specification, but maybe that's because a compiler could generate it from optimizing the built-in dot function, e.g., sum = dot(v, (float4)(1)). However, I haven't checked this yet.

Similar Threads

  1. Reverse (.rev) Vector Components
    By sean.settle in forum OpenCL
    Replies: 2
    Last Post: 02-02-2013, 07:30 PM
  2. Replies: 4
    Last Post: 08-31-2012, 10:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean