1 Reply Latest reply on Dec 2, 2009 12:55 PM by genaganna

    error: a parameter cannot be allocated in a named address space

    spectral
      error: a parameter cannot be allocated in a named address space

      Hi,

      I'm testing OpenCL and during the call to "clBuildProgram" I got the following error :

      "error: a parameter cannot be allocated in a named address space
        kernel void intersect(global float4 dir,"

      Here, I join some information about my platform :

      ------------------| Start OpenCL platform info |------------------
      For test only: Expires on Sun Feb 28 00:00:00 2010
      name:     ATI Stream
      version:  OpenCL 1.0 ATI-Stream-v2.0-beta4
      profile:  FULL_PROFILE
      vendor:   Advanced Micro Devices, Inc.
      extensions:

      devices:
              name:    Intel(R) Core(TM)2 Duo CPU     E7400  @ 2.80GHz
              driver:  1.0
              vendor:  GenuineIntel
              extensions:
               + cl_khr_global_int32_base_atomics
               + cl_khr_global_int32_extended_atomics
               + cl_khr_local_int32_base_atomics
               + cl_khr_local_int32_extended_atomics
               + cl_khr_byte_addressable_store
      -------------------| End OpenCL platform info |-------------------

       

      Here is my OpenCL code :

      kernel void intersect(global float4 dir,
          global float4 * pointA,
          global float4 * pointB,
          global float4 * pointC,
          global float *    hits )
      {

      int index = get_global_id(0);

      hits[index] = 0;
      float4 EdgeAB = pointB[index] - pointA[index];
      float4 EdgeAC = pointC[index] - pointA[index];
      float4 Normal = normalize( cross( EdgeAB, EdgeAC ) );
      float dotABAB = dot( EdgeAB, EdgeAB );
      float dotABAC = dot( EdgeAB, EdgeAC );
      float dotACAC = dot( EdgeAC, EdgeAC );

      float Denominator = dotABAC * dotABAC - dotABAB * dotACAC;

      if( Denominator == 0 ) return;

      // cosine between ray direction and triangle normal
      float cosDirNorm = dot( dir, Normal );

      // backface culling
      if( cosDirNorm >= 0 ) return;

      // distance from eye
      float distance = dot( pointA[index], Normal ) / cosDirNorm;

      // intersection behind camera
      if( distance < 0 ) return;

      float4 point = distance * dir;

      float4 w = point - pointA[index];

      float uw = dot( EdgeAB, w );
      float vw = dot( EdgeAC, w );

      float s = ( dotABAC * vw - dotACAC * uw ) / Denominator;
      if( s < 0 ) return;

      float t = ( dotABAC * uw - dotABAB * vw ) / Denominator;
      if( t < 0 ) return;

      if( ( s + t ) > 1 ) return;

      //!!!!found intersection!!!!
      hits[ index ] = distance;
      }

        • error: a parameter cannot be allocated in a named address space
          genaganna

           

          Originally posted by: viewon01 Hi,

           

          I'm testing OpenCL and during the call to "clBuildProgram" I got the following error :

           

          "error: a parameter cannot be allocated in a named address space   kernel void intersect(global float4 dir,"

           

          Here, I join some information about my platform :

           

          ------------------| Start OpenCL platform info |------------------ For test only: Expires on Sun Feb 28 00:00:00 2010 name:     ATI Stream version:  OpenCL 1.0 ATI-Stream-v2.0-beta4 profile:  FULL_PROFILE vendor:   Advanced Micro Devices, Inc. extensions: devices:         name:    Intel(R) Core(TM)2 Duo CPU     E7400  @ 2.80GHz         driver:  1.0         vendor:  GenuineIntel         extensions:          + cl_khr_global_int32_base_atomics          + cl_khr_global_int32_extended_atomics          + cl_khr_local_int32_base_atomics          + cl_khr_local_int32_extended_atomics          + cl_khr_byte_addressable_store -------------------| End OpenCL platform info |-------------------

           

           

           

          Here is my OpenCL code :

           

          kernel void intersect(global float4 dir,     global float4 * pointA,     global float4 * pointB,     global float4 * pointC,     global float *    hits ) { int index = get_global_id(0); hits[index] = 0; float4 EdgeAB = pointB[index] - pointA[index]; float4 EdgeAC = pointC[index] - pointA[index]; float4 Normal = normalize( cross( EdgeAB, EdgeAC ) ); float dotABAB = dot( EdgeAB, EdgeAB ); float dotABAC = dot( EdgeAB, EdgeAC ); float dotACAC = dot( EdgeAC, EdgeAC ); float Denominator = dotABAC * dotABAC - dotABAB * dotACAC; if( Denominator == 0 ) return; // cosine between ray direction and triangle normal float cosDirNorm = dot( dir, Normal ); // backface culling if( cosDirNorm >= 0 ) return; // distance from eye float distance = dot( pointA[index], Normal ) / cosDirNorm; // intersection behind camera if( distance < 0 ) return; float4 point = distance * dir; float4 w = point - pointA[index]; float uw = dot( EdgeAB, w ); float vw = dot( EdgeAC, w ); float s = ( dotABAC * vw - dotACAC * uw ) / Denominator; if( s < 0 ) return; float t = ( dotABAC * uw - dotABAB * vw ) / Denominator; if( t < 0 ) return; if( ( s + t ) > 1 ) return; //!!!!found intersection!!!! hits[ index ] = distance; }

           

           

          in your kernel, change global float4 dir to  global float4 * dir or float4 dir.

          You can get more details in OpenCL spec section 6.5.