‘k’ is never set to anything in prog1. The compiler error is probably because of that.
But I gotta say, your iszero() function is awesome in it’s badness
… try (all(u == 0)) instead. See section 6.12.6 of the specification for other possible functions.
You can also do ulong16 fpres = 0 to set every element to 0, you don’t need to set them individually.
The code itself is questionable anyway - e.g. every work item is working on the same global index. The point of global indices is that they should identify unique data so the work items do not conflict.