From 80e104ead1f8e463c6fd35ba3faf7bae0e65380f Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 27 Apr 2012 16:27:57 -0400 Subject: loop: Hoist code out of loop --- loop.cl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loop.cl b/loop.cl index 0d2c1b8..3379e9e 100644 --- a/loop.cl +++ b/loop.cl @@ -1,8 +1,9 @@ __kernel void loop(__global int * out, int iterations) { unsigned i; + unsigned base = get_global_id(0) * iterations; for (i = 0; i < iterations; i++) { - unsigned id = (get_global_id(0) * iterations) + i; + unsigned id = (base + i); out[id] = id; } } -- cgit v1.2.3