6 Replies Latest reply on Jul 1, 2014 10:40 AM by kjo

    clBuildProgram Segmentation fault

    kjo

      Hi Guys,

       

      I am trying to Write a Real Time Ray Tracer in an OpenCL Kernel without any accelerating Techniques.

      The Problem is now, that after some time Debugging with CodeXL and keep on changing the opencl kernel code, that now

      when CodeXL tries to build the kernel, a Segmentation Fault occurs. And I don't know why.

      Before I made these changes on the kernel it was possible to Build the program. But I still don't know

      if the code I wrote in the kernel even works because before it said that there would be register spilling. I am still trying to find out what my Problems are.

      In my Kernel I got about 700 lines of Code and I am working on my Laptop on an ATI Mobility Radeon HD 5650.

      CodeXL says that my GPU got a Global Memory Size of 512 MB and a Local Memory Size of 32KB if it helps.

      I haven't tried to build the program on a different PC yet, because I am working from Home, but I got the possibility

      to test it on the PCs at my university.

       

      I will attach my cl kernel so that maybe somebody knows what could be the reason for my segmentation fault.

       

      Thanks

      KJo

        • Re: clBuildProgram Segmentation fault
          pinform

          Hi KJo,

           

          Can you post the host code as well?  That should help us reproduce the issue at our end and point out any potential problems.

            • Re: Re: clBuildProgram Segmentation fault
              kjo

              Yes of course.

              Here it is.

              • Re: clBuildProgram Segmentation fault
                kjo

                I think it is this line of code in the kernel:

                ...

                __constant Object objects[] = {

                    //properties                                                      type    Material      kEpsilon

                    {.properties = {((float3)(0,5,0)), 10},                           SPHERE, &transparent, 0.001f}, //transparent

                    {.properties = {((float3)(15,0,-15)), 10},                        SPHERE, &phongSphere, 0.001f}, //phong

                    {.properties = {((float3)(-15,7,-15)), 10},                       SPHERE, &reflective,  0.001f}, //reflective

                    {.properties.plane = {((float3)(0,0,1)), ((float3)(0,-10,-500))}, PLANE,  &phongWand,   0.001f}, //Wand Mitte

                    {.properties.plane = {((float3)(1,0,0)), ((float3)(500,-10,0))},  PLANE,  &phongWand,   0.001f}, //Wand Rechts

                    {.properties.plane = {((float3)(1,0,0)), ((float3)(-500,-10,0))}, PLANE,  &phongWand,   0.001f}, //Wand Links

                    {.properties.plane = {((float3)(0,1,0)), ((float3)(0,-11,0))},    PLANE,  &phongBoden,  0.001f}}; //Boden

                 

                I just inserted it in an Hello World of OpenCL and after that it also stopped at clBuildProgram, even after I modified it a little to this code:

                ...

                __constant Object objects[] = {

                    //properties                                                      type    Material      kEpsilon

                    {.properties = {((float3)(0,5,0)), 10},                           SPHERE, {((float4)(0)),                0.0f, 1.0f,  200, 0.1f, ((float4)(0)), 0.9f, 1.5f}, 0.001f}, //transparent

                    {.properties = {((float3)(15,0,-15)), 10},                        SPHERE, {((float4)(1,0,0,1)),          0.6f, 0.2f,  100, 0.0f, ((float4)(0)), 0.0f, 0.0f}, 0.001f}, //phong

                    {.properties = {((float3)(-15,7,-15)), 10},                       SPHERE, {((float4)(0,0,1,1)),           0.5f, 0.15f, 100, 0.75f,((float4)(1)), 0.0f, 0.0f},  0.001f}, //reflective

                    {.properties.plane = {((float3)(0,0,1)), ((float3)(0,-10,-500))}, PLANE,  {((float4)(0.5f, 0.722f, 1,1)), 0.4f, 0.75f, 300, 0.0f, ((float4)(0)), 0.0f, 0.0f},   0.001f}, //Wand Mitte

                    {.properties.plane = {((float3)(1,0,0)), ((float3)(500,-10,0))},  PLANE,  {((float4)(0.5f, 0.722f, 1,1)), 0.4f, 0.75f, 300, 0.0f, ((float4)(0)), 0.0f, 0.0f},   0.001f}, //Wand Rechts

                    {.properties.plane = {((float3)(1,0,0)), ((float3)(-500,-10,0))}, PLANE,  {((float4)(0.5f, 0.722f, 1,1)), 0.4f, 0.75f, 300, 0.0f, ((float4)(0)), 0.0f, 0.0f},   0.001f}, //Wand Links

                    {.properties.plane = {((float3)(0,1,0)), ((float3)(0,-11,0))},    PLANE,  {((float4)(0.5f, 0.722f, 1,1)), 0.4f, 0.75f, 300, 0.0f, ((float4)(0)), 0.0f, 0.0f},  0.001f}}; //Boden

                 

                 

                it still started to crash at the same time.

                Why is that the reason? Is that kind of array too big for a constant memory?

              • Re: clBuildProgram Segmentation fault
                kjo

                Oh hi,

                sry that i forgot to answer. I somehow managed to solve the problem differently.

                I don't use that much structs anymore, i solved it by using functions which are giving me some values for the shading of the materials.

                And i stopped using a while loop inside the kernel which would check every kind of possible case in ray tracing with transparent objects.

                But thanks guys

                1 of 1 people found this helpful