diff options
author | Pan Xiuli <xiuli.pan@intel.com> | 2016-09-02 16:50:52 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-10-21 12:35:11 +0800 |
commit | 51950f4e06d7b3ec4975419b5dee3ffab8e7ddad (patch) | |
tree | c55b38266e182fa528c556accea800b20a4a5013 | |
parent | 4fc1429d976c44ca37a46683b8bcbfc40052b430 (diff) |
Libocl: Fix get_sub_group_size bug
If last sub group has the max sub group size, it will return 0 instead
of max sub group size. Fix the bug.
V2: Remove useless check for threadn, threadn should always bigger than 1.
Signed-off-by: Pan Xiuli <xiuli.pan@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
-rw-r--r-- | backend/src/libocl/tmpl/ocl_simd.tmpl.cl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/backend/src/libocl/tmpl/ocl_simd.tmpl.cl b/backend/src/libocl/tmpl/ocl_simd.tmpl.cl index 9c09b217..8e220158 100644 --- a/backend/src/libocl/tmpl/ocl_simd.tmpl.cl +++ b/backend/src/libocl/tmpl/ocl_simd.tmpl.cl @@ -30,8 +30,8 @@ uint get_sub_group_size(void) { uint threadn = get_num_sub_groups(); uint threadid = get_sub_group_id(); - if((threadid == (threadn - 1)) && (threadn > 1)) - return (get_local_size(0)*get_local_size(1)*get_local_size(2)) % get_max_sub_group_size(); + if (threadid == (threadn - 1)) + return (get_local_size(0)*get_local_size(1)*get_local_size(2) -1) % get_max_sub_group_size() + 1; else return get_max_sub_group_size(); } |