2 Replies Latest reply on Feb 26, 2009 2:24 PM by thesquiff

    Kernel access to constants from CAL not working

    thesquiff

      Me again. All was going so well, but I've been going round in circles for hours with this one. For some reason this kernel will only access every 4th element of my constant arrays. symbolArray and huffmanArray are both 512x256.


      kernel void encode(int symbolArray[][], int2 static_ltree[288], int2 static_dtree[30], int extra_lbits[29], int extra_dbits[30], int length_code[256], int dist_code[512], int base_length[29], int base_dist[30], out int4 huffmanArray<> {
          int backwardDistance, length;
          int totalbits;
          int nextSymbol;

          int extra, lengCode,coded;
          unsigned int output;
         
          int d_code;

          int x,y;
          int idx,idy,memIndex;
          idx = instance().x;
          idy = instance().y;

       

      //other stuff I commented out in here that actually does something useful
       
          huffmanArray.x = base_dist[idx]+1;
          huffmanArray.y = totalbits;
          huffmanArray.z = idx;
          huffmanArray.w = base_length[idx]+1;
      }


      And heres where I call it:

      SampleInfo encodeInfo;
              if(!RunProgram(&ctx, &encodeModule, 512, 256, &encodeInfo))
              {
                  return 1;
              }

       

      Everything launches OK, but huffmanArray[0].x gets the value from base_dist[0], huffmanArray[1].x gets the value from base_dist[4], huffmanArray[2] gets the value from base_dist[8].x etc, which is not what I want! Why is this happening? Have I been really stupid again?

      Thanks in advance.