Skip to content

Commit 7938a17

Browse files
committed
merge
Signed-off-by: Nicholas Gates <[email protected]>
1 parent 4ee7b53 commit 7938a17

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

vortex-compute/src/filter/slice/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub(crate) mod neon;
1414
pub(crate) mod scalar;
1515

1616
impl<'a, const NB: usize, T: Copy> Filter<BitView<'a, NB>> for &mut [T] {
17-
type Output = ();
17+
type Output = Self;
1818

1919
fn filter(self, mask: &BitView<'a, NB>) -> Self::Output {
2020
#[cfg(target_arch = "aarch64")]
@@ -24,21 +24,25 @@ impl<'a, const NB: usize, T: Copy> Filter<BitView<'a, NB>> for &mut [T] {
2424
match size_of::<T>() {
2525
1 | 2 if mask.true_count() < (BitView::<NB>::N / 4) => {
2626
// For u8 and u16, the threshold is ~0.25
27-
return scalar::filter_scalar(self, mask);
27+
scalar::filter_scalar(self, mask);
28+
return &mut self[..mask.true_count()];
2829
}
2930
4 if mask.true_count() < (3 * BitView::<NB>::N / 4) => {
3031
// For u32, the threshold is ~0.75
31-
return scalar::filter_scalar(self, mask);
32+
scalar::filter_scalar(self, mask);
33+
return &mut self[..mask.true_count()];
3234
}
3335
_ => {}
3436
}
3537

36-
return unsafe { neon::filter_neon(self, mask) };
38+
unsafe { neon::filter_neon(self, mask) }
39+
return &mut self[..mask.true_count()];
3740
}
3841
}
3942

4043
// Otherwise, fall back to scalar implementation
4144
scalar::filter_scalar(self, mask);
45+
&mut self[..mask.true_count()]
4246
}
4347
}
4448

vortex-compute/src/filter/slice/neon/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,16 @@ mod neon_u16;
1111
mod neon_u32;
1212
mod neon_u8;
1313

14-
use std::arch::is_aarch64_feature_detected;
15-
1614
use vortex_buffer::BitView;
17-
use vortex_error::vortex_panic;
1815

1916
/// Benchmark wrapper for [`filter_neon`].
2017
#[doc(hidden)]
2118
#[cfg(feature = "bench")]
2219
pub fn bench_filter_neon<const NB: usize, T: Copy>(bit_view: &BitView<NB>, slice: &mut [T]) {
23-
if is_aarch64_feature_detected!("neon") {
20+
if std::arch::is_aarch64_feature_detected!("neon") {
2421
unsafe { filter_neon(slice, bit_view) }
2522
}
26-
vortex_panic!("NEON not detected on this CPU");
23+
vortex_error::vortex_panic!("NEON not detected on this CPU");
2724
}
2825

2926
/// Filters the given slice of items in place according to the provided BitView using neon

0 commit comments

Comments
 (0)