Bugfix for Khronos Bug 16242. (#261)

Use convert_int_rte for the result of the sqrt instead of casting to int.

Fixes possible rounding issues.
This commit is contained in:
Kévin Petit
2019-05-03 01:16:31 +08:00
committed by GitHub
parent 6890b58c6f
commit d536a019d1

View File

@@ -37,7 +37,7 @@ static const char* enqueue_block_first_kernel[] =
NL, " for(int i = 1 ; i < tid ; i++)"
NL, " {"
NL, " for(int j = 0 ; j < num ; j++)"
NL, " atomic_add(res+tid, (int)sqrt((float)i*i) / i);"
NL, " atomic_add(res+tid, convert_int_rte(sqrt((float)i*i) / i));"
NL, " }"
NL, "}"
NL, ""