I’m writing a kernel for checking geometric intersections of a line and a collection of primitives. The goal is to check whether there’s an intersection or not. Each work item can tell if the line intersects a primitive or not.

Given that I’m not interested in finding the intersection point, but just if there’s an intersection or not, I was wondering if it would be correct if I initialize a single global flag to FALSE and then all work items write TRUE in that same flag if they find an intersection.

None of them are allowed to set the flag to FALSE, so, at first glance this seems correct to me, but I’m asking because I’m not 100% sure of this…

Thanks!