AnsweredAssumed Answered

OpenCL program crash

Question asked by denis on May 27, 2014
Latest reply on Jul 23, 2014 by denis

Hello to everyone,

 

I am trying to figure out why my opencl program crash and it seem very strange I made these test

 

#define TTPROGRAMDATA  __global struct TProgramData

 

...

 

// WORK OK

int Testparseg1(TTPROGRAMDATA *ProgramData,float sprec,vec3 pos)

{

int cnt=0;

int i,ni=ProgramData->NumIstructions;//,imin;

float v,vmin;

bool fnd=false;

float MaxDistVoxel=ProgramData->VoxelData.VoxelRadius*2.0f;

float vraddia=ProgramData->VoxelData.VoxelRadius;

 

i=0;

while (i<ni&&(!fnd))

    {

    v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1[i] );  

    if (v<=vraddia)

        fnd=true;

    i++;

    }

 

if (fnd)

    {

    vraddia*=3.0f;

    for (i=0;i<ni;i++)

        {

        v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1[i] );    //ONLY 1 CALL

        if (v<=vraddia)

            cnt++;

        }

    }

return cnt;

}

 

// KO

int Testparseg1(TTPROGRAMDATA *ProgramData,float sprec,vec3 pos)

{

int cnt=0;

int i,ni=ProgramData->NumIstructions;//,imin;

float v,vmin;

bool fnd=false;

float MaxDistVoxel=ProgramData->VoxelData.VoxelRadius*2.0f;

float vraddia=ProgramData->VoxelData.VoxelRadius;

 

i=0;

while (i<ni&&(!fnd))

    {

    v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1[i] );  

    if (v<=vraddia)

        fnd=true;

    i++;

    }

 

if (fnd)

    {

    vraddia*=3.0f;

     // ----different rows---

    i=0;

    v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1[i] );  

    if (v<=vraddia)

        cnt++;

    //-----------------------------

 

    for (i=1;i<ni;i++)

        {

        v=vTooltball( ProgramData,sprec,pos,&ProgramData->g1[i] );  

        if (v<=vraddia)

            cnt++;

        }

    }

return cnt;

}

 

...

__kernel void Build_testg1(__constant struct TInputData *InputData,TTPROGRAMDATA *ProgramData,

                                TVOXELSPTR Voxels)

{

int    iVoxel=get_global_id(0);

#ifdef _DEBUG

if (iVoxel>=MAXNUMVOXELS)

    return ;

#endif

float3    vp=GetVoxelPnt(ProgramData,iVoxel);

Voxels[iVoxel].ListPtr=Testparseg1(ProgramData,InputData->ExtSPrec,vp);

}

 

 

The function Testparseg1 work and the only difference from the second one is an external call before the for cycle.

Both the function works when ProgramData->NumIstructions < 2000 , when the for have less than about 2000 cycles.

 

Suggestion ?

Thank you,

Denis.

 

Messaggio modificato da Denis A. In attach there is an example of crashing driver program . The sample is build using Visual Studio 2010 . Into the folder bin there is a precompiled version with all the files required by the sample. To compile the project you need boost 1.55 and glm 0.9.4.6 . I Hope this can help to discover where the problem is . Thank you , Denis.

Outcomes