A Person
A Person

Reputation: 811

Do OpenCL vector types use SIMD

I currently have a large array of floats that I process in my OpenCL kernel i am wondering if i divide this array up and use an OpenCL vector type array instead, if it will speed up the process. Basically if i had an array of 4,800 floats i would divide it up into an array of 300 float16 vectors. Would this take advantage of SIMD?

Upvotes: 8

Views: 3879

Answers (2)

w-m
w-m

Reputation: 11232

Intel actually describes what their OpenCL SDK does: see Writing Optimal OpenCL™ Code with Intel® OpenCL SDK. You might want to check that out, as an addition to benchmarking. The interesting part starts at chapter 2.3.

To answer your question: yes, it will take advantage of SIMD. But to "maximize utilization of the CPU vector units by using vector data types" you should really read that document.

Upvotes: 7

grrussel
grrussel

Reputation: 7339

It might, or it might not. It is dependent on the implementation of OpenCL, and the hardware on which your program executes.

The only way to see if it provides an improvement is to benchmark on the platforms and implementations of interest - for the range of vector sizes (e.g. compare 1 (scalar), 2, 4, 8 and 16).

Upvotes: 0

Related Questions