Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

Passing structs as kernel arguments crashed using APP SDK 2.8


My kernel has many arguments which are grouped as two structs for convenience. Passing single struct as argument to kernel is OK, but passing two of them caused crash using APP SDK 2.8. It works using APP SDK 2.7. The develop environment is openSUSUE 12.2 64bit on Core i5-2500K.

The two argument structs in host codes are defined as follow

typedef struct {

        cl_float minX;

        cl_float maxX;

        cl_float minY;

        cl_float maxY;

        cl_float minZ;

        cl_float maxZ;

        cl_float initStepSize;

        cl_float maxStepSize;

        cl_float minStepSize;

        cl_float maxLength;

        cl_float terminationSpeed;

        cl_float adaptiveUpBound;

        cl_float adaptiveLowBound;

        cl_uint maxStepNum;

        cl_float fixedTimeStep;

} GenerationParameters;

    typedef struct {

        cl_float originX;

        cl_float originY;

        cl_float originZ;

        cl_uint extentMinX;

        cl_uint extentMinY;

        cl_uint extentMinZ;

        cl_uint extentMaxX;

        cl_uint extentMaxY;

        cl_uint extentMaxZ;

        cl_float spacingX;

        cl_float spacingY;

        cl_float spacingZ;

        cl_float reciprocalSpacingX;

        cl_float reciprocalSpacingY;

        cl_float reciprocalSpacingZ;

        cl_float reciprocalSpacingXY;

        cl_float reciprocalSpacingYZ;

        cl_float reciprocalSpacingZX;

        cl_float reciprocalSpacingXYZ;

  } UniformGridInfo;


And the structs defined in kernel

typedef struct {

          float minX;

          float maxX;

          float minY;

          float maxY;

          float minZ;

          float maxZ;

          float initStepSize;

          float maxStepSize;

          float minStepSize;

          float maxLength;

          float terminationSpeed;

          float adaptiveUpBound;

          float adaptiveLowBound;

          uint maxStepNum;

          float fixedTimeStep;

} GenerationParameters;

typedef struct {

          float originX;

          float originY;

          float originZ;

          uint extentMinX;

          uint extentMinY;

          uint extentMinZ;

          uint extentMaxX;

          uint extentMaxY;

          uint extentMaxZ;

          float spacingX;

          float spacingY;

          float spacingZ;

          float reciprocalSpacingX;

          float reciprocalSpacingY;

          float reciprocalSpacingZ;

          float reciprocalSpacingXY;

          float reciprocalSpacingYZ;

          float reciprocalSpacingZX;

          float reciprocalSpacingXYZ;

} UniformGridInfo;

The kernel function

__kernel void generateStreamlines (GenerationParameters generationParameters,UniformGridInfo gridInfo  ){



Thanks a lot!

Edited: Sorry for the incomplete post because of the problem of my browser. I have no idea it has been submitted.

Message was edited by: ZHAO PENG

2 Replies

Please post a copy of your code (as zip file) so that we can reproduce here.

1. Please mention your platform - win32 / win64 / lin32 / lin64 or some other.

    Win7 or win vista or Win8.. Similarly for linux, your distribution

2. Version of driver

3. CPU or GPU Target?

4. CPU/GPU details of your hardware



It will be helpful, if you can share a complete testcase, which is easy to reproduce. I may try to modify a particular sample based on your description, but we can't be sure to fall into the same problem. Do You think if i create some dummy structs in a sample the issue would be reproducible?

EDIT: I tried this using NBody Sample. I am passing the arguments as a struct myFloat, and am able to run the sample. May be you can update this sample as per your code.

Message was edited by: Himanshu Gautam