From 473d0d97812ad1dd02b76c762643f3d27c2cc882 Mon Sep 17 00:00:00 2001 From: AvvAL Date: Sun, 22 Oct 2023 01:44:53 +0300 Subject: [PATCH] fix bitonic kernel --- src/cl/bitonic.cl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/cl/bitonic.cl b/src/cl/bitonic.cl index e6d749f8..59eef9c7 100644 --- a/src/cl/bitonic.cl +++ b/src/cl/bitonic.cl @@ -2,12 +2,6 @@ #include #endif -void swap(float* a, float* b) { - float tmp = *a; - *a = *b; - *b = tmp; -} - __kernel void bitonic(__global float *as, int K, int local_k) { int gid = get_global_id(0); int r_id = gid / local_k; @@ -15,6 +9,8 @@ __kernel void bitonic(__global float *as, int K, int local_k) { int idx = 2 * local_k * r_id + rl_id; bool is_left = (gid / K) % 2 == 0 ? as[idx + local_k] < as[idx] : as[idx + local_k] > as[idx]; if (is_left) { - swap(&as[idx], &as[idx + local_k]); + float tmp = as[idx]; + as[idx] = as[idx + local_k]; + as[idx + local_k] = tmp; } }