Topic
  • No replies
p_siegl
p_siegl
1 Post

Pinned topic QS22: wrong value while using vectorization on Accelerator (SPE)

‏2011-12-16T19:21:06Z |
Hi there,

I have a QS22 at my university and I'm running a small piece of code on it.
I think I found a bug within the IBM OpenCL environment while moving data within a float* type (* stands here for 2,4,8,16).
I've seen this behaviour only on the SPE device (means the Cell Accelerator). If you try this on Cell PPE (or other OpenCL devices) it works fine.
The problem appears if you try the following:
The idea is to copy the values of input*_b to output*, but with an offset of one to the right.
Now overwrite the first element in output*, which has a senseless value of input*_b, with the last value of input*_a.
If you know look at the first element in output*. You ever (!) have a zero in it equal which value came from input*_a or how it was initialized.
I've tried this on following OpenCL devices and it worked fine:
Intel Core i7 2600k, Intel Core i7 2620m, Geforce GTX 560TI, Nvidia Quadro FX570, Nvidia Quadro NVS290 and a Tesla C1060. Even on the Cell PowerPC core it works fine (like I said).
I only get this zero value behaviour while using the QS22 Cell Accelerator OpenCL device.
Hope there is a fix for this :-)

Regards
Patrick

Example code (for float2,4,8,16):
=================================

/**********************************************/
/*********** Test it with FLOAT2 **************/
/**********************************************/

float2 input2_a = (float2)( 1.0f, 2.0f);
float2 input2_b = (float2)( 3.0f, 4.0f);

// initializing with -1 so that we have no zeros in output ...
float2 output2 = (float2)(-1.0f,-1.0f);

output2 = input2_b.s00;
output2.s0 = input2_a.s1;

// now in output there should be the values: 2 3
// but output has values: 0 3
// where is the zero coming from?!?

#if defined PRINTF
printf("output 2: %f %f \n", output2.s0, output2.s1);
printf("\n");
#endif

/**********************************************/
/*********** Test it with FLOAT4 **************/
/**********************************************/

float4 input4_a = (float4)( 1.0f, 2.0f, 3.0f, 4.0f);
float4 input4_b = (float4)( 5.0f, 6.0f, 7.0f, 8.0f);

// initializing with -1 so we have no zeros in output ...
float4 output4 = (float4)(-1.0f,-1.0f,-1.0f,-1.0f);

output4 = input4_b.s0012;
output4.s0 = input4_a.s3;

// now in output there should be the values: 4 5 6 7
// but output has values: 0 5 6 7
// where is the zero coming from?!?

#if defined PRINTF
printf("output 4: %f %f %f %f \n", output4.s0, output4.s1, output4.s2, output4.s3);
printf("\n");
#endif

/**********************************************/
/*********** Test it with FLOAT8 **************/
/**********************************************/

float8 input8_a = (float8)( 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f);
float8 input8_b = (float8)( 9.0f,10.0f,11.0f,12.0f,13.0f,14.0f,15.0f,16.0f);

// initializing with -1 so we have no zeros in output ...
float8 output8 = (float8)(-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f);

output8 = input8_b.s00123456;
output8.s0 = input8_a.s7;

// now in output there should be the values: 8 9 10 11 12 13 14 15
// but output has values: 0 9 10 11 12 13 14 15
// where is the zero coming from?!?

#if defined PRINTF
printf("output 8: %f %f %f %f %f %f %f %f\n", output8.s0, output8.s1, output8.s2, output8.s3,
output8.s4, output8.s5, output8.s6, output8.s7 );
printf("\n");
#endif

/**********************************************/
/*********** Test it with FLOAT16 *************/
/**********************************************/

float16 input16_a = (float16)( 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,10.0f,11.0f,12.0f,13.0f,14.0f,15.0f,16.0f);
float16 input16_b = (float16)(17.0f,18.0f,19.0f,20.0f,21.0f,22.0f,23.0f,24.0f,25.0f,26.0f,27.0f,28.0f,29.0f,30.0f,31.0f,32.0f);

// initializing with -1 so we have no zeros in output ...
float16 output16 = (float16)(-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f,-1.0f);

output16 = input16_b.s00123456789ABCDE;
output16.s0 = input16_a.sF;

// now in output there should be the values: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
// but output has values: 0 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
// where is the zero coming from?!?

#if defined PRINTF
printf("output 16: %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f\n",
output16.s0, output16.s1, output16.s2, output16.s3,
output16.s4, output16.s5, output16.s6, output16.s7,
output16.s8, output16.s9, output16.sA, output16.sB,
output16.sC, output16.sD, output16.sE, output16.sF );
printf("\n");
#endif