Binu MD
Binu MD

Reputation: 25

OpenCL convert float16 to float*

Currently I am working on a kernel, that can be optimized using float16 types. However, I did not find any documentation about converting float16 into float*, because my output variable is a float*. Here is the sample code

_kernel void IncrementMatrix( __global float* Source, __global float* Target, __global float* out )
{
   const int globalID = get_global_id(0);
   float16 S = vload16( globalID , Source );
   float16 T = vload16( globalID , Target );
   S = S + T;
   out[globalID*16] = (float*)S; // this is not working    
}

I already tried this out = (float*)S;, but it is giving invalid type conversion error.

Upvotes: 1

Views: 1256

Answers (1)

Jovasa
Jovasa

Reputation: 445

Just like you use vload16() to load the data use vstore16 to store it

like this:

vstore16(S, globalID, out)

Upvotes: 5

Related Questions