Skip to content

Commit

Permalink
ARROW-10914: [Rust] Refactor simd arithmetic kernels to use chunked i…
Browse files Browse the repository at this point in the history
…teration

This should avoid out of bounds reads in those kernels and also removes some unsafe blocks. The performance actually seems to increase slightly, I will post the numbers later.

The division kernel looks a bit more complex now, but follows the same pattern as used in the simd aggregation functions, with two separate codepaths for the nullable/non-null cases.

The comparison kernels might also do some out of bounds reads, I will look at those in a separate ticket/PR.

Closes #8929 from jhorstmann/ARROW-10914-simd-arithmetic-read-out-of-bounds

Authored-by: Jörn Horstmann <joern.horstmann@signavio.com>
Signed-off-by: Jorge C. Leitao <jorgecarleitao@gmail.com>
  • Loading branch information
jhorstmann authored and jorgecarleitao committed Dec 19, 2020
1 parent 5819943 commit 091df20
Show file tree
Hide file tree
Showing 3 changed files with 254 additions and 196 deletions.
2 changes: 1 addition & 1 deletion rust/arrow/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ impl MutableBuffer {
}

/// View buffer as typed slice.
pub fn typed_data_mut<T: ArrowNativeType + num::Num>(&mut self) -> &mut [T] {
pub fn typed_data_mut<T: ArrowNativeType>(&mut self) -> &mut [T] {
assert_eq!(self.len() % mem::size_of::<T>(), 0);
assert!(memory::is_ptr_aligned::<T>(self.raw_data() as *const T));
unsafe {
Expand Down

0 comments on commit 091df20

Please sign in to comment.