3 Replies Latest reply on Jun 18, 2009 7:19 AM by gaurav.garg

    Error (syntax error) before 'Identifier'  Attribute[GroupSize(GROUP_SIZE,1,1)]

    xmuben

      the testing  code is

      #define  GROUP_SIZE 16
      Attribute[GroupSize(GROUP_SIZE,1,1)]
      kernel void kernelGPU(float input1 <>,float input2 <>, out float output<>
      {
       int2 index = instance().xy;
       int a=index.x;
       int b=index.y;
       output= input1+input2;
      }

      How can I solve this problem?

      What is the diffirence between instanceInGroup() and instance()?

      If I set the groupsize to GROUP_SIZE and input Vector is set to <4*GROUP_SIZE>

      Does Max(instanceInGroup().x) equal  Max(instance().x)?

       

       

       

        • Error (syntax error) before 'Identifier'  Attribute[GroupSize(GROUP_SIZE,1,1)]
          gaurav.garg

          Did you enable pre-processing using -pp flag?

          When you define Attribute of a kernel with GROUP_SIZE, threads are divided into groups and these threads can share data among each other using shared memory.

          InstanceInGroup() shows the thread ID within a group, instance() shows the global id.

            • Error (syntax error) before 'Identifier'  Attribute[GroupSize(GROUP_SIZE,1,1)]
              xmuben

               

              Originally posted by: gaurav.garg Did you enable pre-processing using -pp flag?

              When you define Attribute of a kernel with GROUP_SIZE, threads are divided into groups and these threads can share data among each other using shared memory.

              InstanceInGroup() shows the thread ID within a group, instance() shows the global id.

               

              Thank you. Now Attribute works well.

              Here I got another question about 2D array( width,height).  The input and output  arrays are width x height. I want to define width threads and each thread handles one column data of the arrays.

              Just see the following code. 

               uint4 offset(0,0,0,0);
               uint4 index(width,1,1,1);
               kernelGPU.domainOffset(offset);
               kernelGPU.domainSize(index);

              kernel void kernelGPU(float input1 [][],float input2 [][], out float output [][])
              {
               int2 index = instance().xy;
               int a=index.x;
               int b=index.y;
               for (i=0;i {
                   output[a]=input1[a]+input2[a];
                   b=b+1;  
               }
              }

              the result is incorrect. could anyone tell me how to arrange the code?

              thank you very much.