Hi,
When I try to build a CL program for my CPU (Intel Core i7 Q720) using Delphi, I get a "EZeroDivide" exception (Floating point division by zero). The kernel code is just a nonsense test kernel, but it builds + runs on the GPU ok. If I remove "sin" from the kernel, it compiles + runs ok, but I've also had problems with other kernels causing a divide by zero error when building.
__kernel void some_func(__global float4 * inval, __global float * outval) { size_t gid = get_global_id(0); float g_size = (float)get_global_size(0); outval[gid] = sin((float)gid/g_size) * length(inval[gid]) + 17.0f; }
Originally posted by: danbartlett@ntlworld.com Hi,
When I try to build a CL program for my CPU (Intel Core i7 Q720) using Delphi, I get a "EZeroDivide" exception (Floating point division by zero). The kernel code is just a nonsense test kernel, but it builds + runs on the GPU ok. If I remove "sin" from the kernel, it compiles + runs ok, but I've also had problems with other kernels causing a divide by zero error when building.
Are you getting exception while running sample or while compiling kernel code?
It looks like you are getting exception while running this code on CPU becasue CPU handles exception but GPU does not handle exceptions.
I get the error when building it (clBuildProgram).
I have a temporary fix, like this:
// TEMP FIX, TODO: remove oldVal := Get8087CW; Set8087CW($133F); Result := clBuildProgram(Handle, device_count, deviceptr, opt, pfn_notify, user_data); Set8087CW(oldVal);
Originally posted by: danbartlett@ntlworld.com I get the error when building it (clBuildProgram).
I have a temporary fix, like this:
We are not able to reproduce this issue from VS.
Ok, I installed VS C++, and tried to reproduce this:
1) Open HelloCL
2) Add the line "control87(0x1332, 0xFFFF);" somewhere before the line that builds the cl program "err = program.build(devices);". This is the default CW used in Delphi.
3) Change HelloCL_Kernels.cl to the attached code
Now when I try to build, I get the error:
"Unhandled exception at 0x007ee2e3 in HelloCLVS10.exe: 0xC000008F: Floating-point inexact result."
If you don't change the kernel code, it builds without an exception in both cases.
__kernel void hello(__global float4 * inval, __global float * outval) { size_t gid = get_global_id(0); float g_size = (float)get_global_size(0); outval[gid] = sin((float)gid/g_size) * length(inval[gid]) + 17.0f; }