cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

thesquiff
Journeyman III

Kernel access to constants from CAL not working

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.

 

0 Likes
2 Replies
gaurav_garg
Adept I

Hope this thread answer your question

http://forums.amd.com/forum/messageview.cfm?catid=328&threadid=105452&highlight_key=y

0 Likes

Thanks as always for the quick reply.

 

However, unless I'm missing something, I can't find any explanation of this in the documentation?

0 Likes