outside block variable access

Hi!
Devices: GeForce GT 330M Gpu NVIDIA Corporation 1.0.
Platform: NVIDIA Corporation Opencl 1.1 CUDA 4.0.1
I have ray-tracer in c99 and want to run it in opencl kernel. In c99-program it works. In opencl kernel it doesn’t, because when I init variable inside block I can’t use it outside block.
A simple part of my raytracer can work in opencl kernel. CLGetProgramBuildInfo said that kernel was build successfully, without any errors. It’s execution time error and I don’t not how take log about it and how fix it.
main.txt (25 KB)

dataParallel (2).txt (15.9 KB)