AnsweredAssumed Answered

Possible compiler bug with Catalyst 12.10

Question asked by cvazquezb on Nov 28, 2012
Latest reply on Nov 29, 2012 by cvazquezb

Tested with a Radeon HD 7970 on Windows 7 64 bits. Driver updated to Catalyst 12.10

 

The relevant code:

 

#define PIXELS 20

     for(int dy=0;dy<PIXELS;dy++)

     {

          (...)

        if(dy>0)

        {

            w=weights[(PIXELS-1-dy)*VOX_SLICE*workspace->xMaxVoxels];

            c=evaluate(lines[-dy+PIXELS-1].z,lines[-dy+PIXELS-1].w,slice)+yChunk;

 

            for(int y=dy;y<PIXELS;y++)

            {   

                if((c>=0)&&(c<CHUNK_SIZE))

                    chunk[c *VOX_ROW]+=w;

 

                barrier(CLK_LOCAL_MEM_FENCE);

                c+=Z_SLOPE;

            }

        }

     }

 

If I change the seventh line for the equivalent:


            w=weights[(-dy+PIXELS-1)*VOX_SLICE*workspace->xMaxVoxels];

 

The generated IL changes a lot from register renaming with the first version having a few more instructions. Worse still, after the change results are completely wrong. The code works fine either way on a variety of Nvidia platforms. I'm afraid I can't provide the full code without an NDA but I'd be happy to help in any other way.

Outcomes