You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Jörn Horstmann (Jira)" <ji...@apache.org> on 2020/12/20 12:42:00 UTC

[jira] [Assigned] (ARROW-10990) [Rust]: SIMD implementation of compare kernels reads out of bounds

     [ https://issues.apache.org/jira/browse/ARROW-10990?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jörn Horstmann reassigned ARROW-10990:
--------------------------------------

    Assignee: Jörn Horstmann

> [Rust]: SIMD implementation of compare kernels reads out of bounds
> ------------------------------------------------------------------
>
>                 Key: ARROW-10990
>                 URL: https://issues.apache.org/jira/browse/ARROW-10990
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Rust
>            Reporter: Jörn Horstmann
>            Assignee: Jörn Horstmann
>            Priority: Major
>
> The simd compare kernels use the following pattern to handle the remainder that is not a multiple of the number of vector lanes:
> {code}
>     if rem > 0 {
>         let simd_left = T::load(left.value_slice(len - rem, lanes));
>         let simd_right = T::load(right.value_slice(len - rem, lanes));
>         let simd_result = op(simd_left, simd_right);
>         let rem_buffer_size = (rem as f32 / 8f32).ceil() as usize;
>         T::bitmask(&simd_result, |b| {
>             result.extend_from_slice(&b[0..rem_buffer_size]);
>         });
>     }
> {code}
> While this avoids writing into result out of bounds, it still reads from the {{left}} and {{right}} arrays at out of bounds indices and valgrind complains about that. I propose to rewrite the logic to use chunked iteration, with a scalar loop for the remainder, similar to the change for arithmetic kernels in ARROW-10914.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)