Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust]: SIMD implementation of compare kernels reads out of bounds #26912

Closed
asfimport opened this issue Dec 20, 2020 · 1 comment
Closed

[Rust]: SIMD implementation of compare kernels reads out of bounds #26912

asfimport opened this issue Dec 20, 2020 · 1 comment

Comments

@asfimport
Copy link
Collaborator

The simd compare kernels use the following pattern to handle the remainder that is not a multiple of the number of vector lanes:

    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]);
        });
    }

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.

Reporter: Jörn Horstmann / @jhorstmann
Assignee: Jörn Horstmann / @jhorstmann

PRs and other links:

Note: This issue was originally created as ARROW-10990. Please see the migration documentation for further details.

@asfimport
Copy link
Collaborator Author

Andrew Lamb / @alamb:
Issue resolved by pull request 8975
#8975

@asfimport asfimport added this to the 3.0.0 milestone Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant