summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2012-04-27 16:27:57 -0400
committerTom Stellard <thomas.stellard@amd.com>2012-04-27 16:27:57 -0400
commit80e104ead1f8e463c6fd35ba3faf7bae0e65380f (patch)
tree3ca190e00a19b990e251cf8309df3f3d82aafbb0
parent8946be85b1f4000da5ad95f7179e85582276dba1 (diff)
loop: Hoist code out of loop
-rw-r--r--loop.cl3
1 files changed, 2 insertions, 1 deletions
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;
}
}