¿Se puede ejecutar un elemento de trabajo con una identificación global más grande antes que un elemento de trabajo con una identificación global más pequeña?

I read the OpenCL specification and did not find how global id is assigned. Is it assigned in EnQueue time, or is it assigned in running time?

If later, it is easy to see that a work-item with smaller id is always executed earlier or at the same time as (if in a same warp) a work-item with bigger id. If it is assigned in EnQueue time, can we guarantee that execution order is consistent with the global id?

preguntado el 24 de agosto de 12 a las 22:08

I ask this question because I want to use global id as an index to read from an array. If work-item with smaller global id is always executed earlier, I can use the same array as both input and output. Otherwise, I have to use two arrays. -

On some architectures having you input array be constant read-only allows it to be cached in multiple compute units. Doing this can increase performance. -

1 Respuestas

There is no guarantee in OpenCL about the order in which the workgroups are executed, so your algorithm should not rely on that.

To give you a specific example of how such assumption would fail, imagine a kernel with a data-dependent branch in it. In one workgroup both sides of the branch may need to be taken, while in another, only one side. The latter workgroup will complete first, even though it may have been started at the same time as the former.

Respondido 25 ago 12, 00:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.