Skip to content

Commit 73a9b1d

Browse files
committed
Remove the RowFn UTF-8 and filtered-output benchmarks
Both measure real Vortex kernels, but neither holds still on the walltime legs, where allocator time cannot be excluded the way #9994 excludes it from two simulation shards. - row_fn_utf8: decode swung between 80.7 and 187.6 us, 10 to 18 per cent per report, on 13 of the last 24 reports. Seven of those pull requests touch no RowFn or scalar_fn code at all, among them a lockfile refresh and a one-file Python fix. Both legs move, so this is the benchmark, not one runner. The file held only that benchmark, so it goes with it. - row_fn_output: filtered_owned_i64 and filtered_sink_i64 swung 10 to 19 per cent on avx2, avx512 and neon alike, again on unrelated pull requests. Their support types go too: FilteredI64, the two RowFn implementations, the validity patterns, and the argument builder. The rest of row_fn_output is untouched. Its infallible and deferred benchmarks have stayed put. Signed-off-by: Claude <[email protected]>
1 parent 749fbee commit 73a9b1d

3 files changed

Lines changed: 0 additions & 234 deletions

File tree

‎vortex-array/Cargo.toml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@ harness = false
149149
name = "row_fn_bool_retry"
150150
harness = false
151151

152-
[[bench]]
153-
name = "row_fn_utf8"
154-
harness = false
155-
156152
[[bench]]
157153
name = "row_fn_output"
158154
harness = false

‎vortex-array/benches/row_fn_output.rs‎

Lines changed: 0 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use divan::Bencher;
1313
use divan::counter::ItemsCount;
1414
use mimalloc::MiMalloc;
1515
use vortex_array::ArrayRef;
16-
use vortex_array::ExecutionCtx;
1716
use vortex_array::IntoArray;
1817
use vortex_array::VortexSessionExecute;
1918
use vortex_array::array_session;
@@ -24,14 +23,9 @@ use vortex_array::dtype::NativePType;
2423
use vortex_array::scalar_fn::EmptyOptions;
2524
use vortex_array::scalar_fn::ScalarFnId;
2625
use vortex_array::scalar_fn::VecExecutionArgs;
27-
use vortex_array::scalar_fn::unstable::row::InitializedElement;
28-
use vortex_array::scalar_fn::unstable::row::InputElement;
2926
use vortex_array::scalar_fn::unstable::row::RowFn;
3027
use vortex_array::scalar_fn::unstable::row::RowVisitor;
31-
use vortex_array::scalar_fn::unstable::row::UninitElementSink;
3228
use vortex_array::scalar_fn::unstable::row::execute_rows;
33-
use vortex_array::validity::Validity;
34-
use vortex_buffer::Buffer;
3529
use vortex_error::VortexExpect;
3630
use vortex_error::VortexResult;
3731
use vortex_error::vortex_ensure;
@@ -62,36 +56,13 @@ const INPUT_SHAPES: &[InputShape] = &[InputShape::PerRowPerRow];
6256
/// and that is the difference worth watching.
6357
const CONSTANT_SHAPES: &[InputShape] = &[InputShape::PerRowConstant, InputShape::ConstantPerRow];
6458

65-
const VALIDITY_PATTERNS: &[ValidityPattern] = &[
66-
ValidityPattern::AllValid,
67-
ValidityPattern::OneNullInEight,
68-
ValidityPattern::NineNullsInTen,
69-
];
70-
7159
#[derive(Clone, Copy, Debug)]
7260
enum InputShape {
7361
PerRowPerRow,
7462
PerRowConstant,
7563
ConstantPerRow,
7664
}
7765

78-
#[derive(Clone, Copy, Debug)]
79-
enum ValidityPattern {
80-
AllValid,
81-
OneNullInEight,
82-
NineNullsInTen,
83-
}
84-
85-
impl ValidityPattern {
86-
fn is_valid(self, index: usize) -> bool {
87-
match self {
88-
Self::AllValid => true,
89-
Self::OneNullInEight => !index.is_multiple_of(8),
90-
Self::NineNullsInTen => index.is_multiple_of(10),
91-
}
92-
}
93-
}
94-
9566
trait BenchPrimitive: NativePType {
9667
fn per_row(offset: usize) -> ArrayRef;
9768

@@ -120,57 +91,6 @@ impl BenchPrimitive for i64 {
12091
}
12192
}
12293

123-
/// Primitive input that forces partially valid batches through the filtered fallback.
124-
///
125-
/// `DENSE_SAFE = false` selects valid-only execution. This type inherits the conservative
126-
/// null-tolerant decode implementation, so direct valid-row execution declines the original
127-
/// nullable input. A partially valid input must therefore use the executor's filtered fallback.
128-
struct FilteredI64;
129-
130-
// SAFETY: the view is a native slice, and its reported length is the slice length.
131-
unsafe impl InputElement for FilteredI64 {
132-
type Column = Buffer<i64>;
133-
type Constant = i64;
134-
type View<'a> = &'a [i64];
135-
type Elem<'a> = i64;
136-
137-
const DENSE_SAFE: bool = false;
138-
const DECODE_INFALLIBLE: bool = true;
139-
140-
fn validate(dtype: &DType) -> VortexResult<()> {
141-
<i64 as InputElement>::validate(dtype)
142-
}
143-
144-
fn decode(array: ArrayRef, ctx: &mut ExecutionCtx) -> VortexResult<Self::Column> {
145-
<i64 as InputElement>::decode(array, ctx)
146-
}
147-
148-
fn decode_constant(array: ArrayRef, ctx: &mut ExecutionCtx) -> VortexResult<Self::Constant> {
149-
<i64 as InputElement>::decode_constant(array, ctx)
150-
}
151-
152-
fn get(column: &Self::Column, index: usize) -> Self::Elem<'_> {
153-
column[index]
154-
}
155-
156-
fn get_constant(constant: &Self::Constant) -> Self::Elem<'_> {
157-
*constant
158-
}
159-
160-
fn view(column: &Self::Column) -> Self::View<'_> {
161-
column.as_slice()
162-
}
163-
164-
fn get_from_view<'a>(view: &Self::View<'a>, index: usize) -> Self::Elem<'a> {
165-
view[index]
166-
}
167-
168-
unsafe fn get_from_view_unchecked<'a>(view: &Self::View<'a>, index: usize) -> Self::Elem<'a> {
169-
// SAFETY: forwarded from this method's contract.
170-
unsafe { *view.get_unchecked(index) }
171-
}
172-
}
173-
17494
#[derive(Clone)]
17595
struct InfallibleBool<T>(PhantomData<T>);
17696

@@ -180,12 +100,6 @@ struct DeferredBool<T>(PhantomData<T>);
180100
#[derive(Clone)]
181101
struct DeferredI64;
182102

183-
#[derive(Clone)]
184-
struct FilteredOwnedI64;
185-
186-
#[derive(Clone)]
187-
struct FilteredSinkI64;
188-
189103
impl<T: BenchPrimitive> RowFn for InfallibleBool<T> {
190104
type Options = EmptyOptions;
191105

@@ -267,51 +181,6 @@ impl RowFn for DeferredI64 {
267181
}
268182
}
269183

270-
impl RowFn for FilteredOwnedI64 {
271-
type Options = EmptyOptions;
272-
273-
const ARG_NAMES: &'static [&'static str] = &["value"];
274-
const INFALLIBLE: bool = true;
275-
276-
fn id(&self) -> ScalarFnId {
277-
static ID: CachedId = CachedId::new("bench.row_fn_output.filtered_owned_i64");
278-
*ID
279-
}
280-
281-
fn dispatch<V: RowVisitor>(
282-
&self,
283-
_options: &Self::Options,
284-
_args: &[DType],
285-
visitor: V,
286-
) -> VortexResult<V::VisitResult> {
287-
visitor.visit::<(FilteredI64,), i64>(|(value,)| value.wrapping_add(1))
288-
}
289-
}
290-
291-
impl RowFn for FilteredSinkI64 {
292-
type Options = EmptyOptions;
293-
294-
const ARG_NAMES: &'static [&'static str] = &["value"];
295-
const INFALLIBLE: bool = true;
296-
297-
fn id(&self) -> ScalarFnId {
298-
static ID: CachedId = CachedId::new("bench.row_fn_output.filtered_sink_i64");
299-
*ID
300-
}
301-
302-
fn dispatch<V: RowVisitor>(
303-
&self,
304-
_options: &Self::Options,
305-
_args: &[DType],
306-
visitor: V,
307-
) -> VortexResult<V::VisitResult> {
308-
visitor.visit_into::<(FilteredI64,), UninitElementSink<i64>, _>((), |(value,), output| {
309-
// SAFETY: `output` is the `UninitElementSink` row supplied for this callback.
310-
unsafe { InitializedElement::write(output, value.wrapping_add(1)) }
311-
})
312-
}
313-
}
314-
315184
#[vortex_bench_support::cpu_features]
316185
#[divan::bench(types = [i32, i64], args = INPUT_SHAPES)]
317186
fn infallible_bool<T: BenchPrimitive>(bencher: Bencher, &shape: &InputShape) {
@@ -346,18 +215,6 @@ fn deferred_i64(bencher: Bencher, &shape: &InputShape) {
346215
bench_row_fn(bencher, &DeferredI64, make_args::<i64>(shape));
347216
}
348217

349-
#[vortex_bench_support::cpu_features]
350-
#[divan::bench(args = VALIDITY_PATTERNS)]
351-
fn filtered_owned_i64(bencher: Bencher, &validity: &ValidityPattern) {
352-
bench_row_fn(bencher, &FilteredOwnedI64, make_filtered_args(validity));
353-
}
354-
355-
#[vortex_bench_support::cpu_features]
356-
#[divan::bench(args = VALIDITY_PATTERNS)]
357-
fn filtered_sink_i64(bencher: Bencher, &validity: &ValidityPattern) {
358-
bench_row_fn(bencher, &FilteredSinkI64, make_filtered_args(validity));
359-
}
360-
361218
fn make_args<T: BenchPrimitive>(shape: InputShape) -> VecExecutionArgs {
362219
let args = match shape {
363220
InputShape::PerRowPerRow => vec![T::per_row(0), T::per_row(1)],
@@ -368,16 +225,6 @@ fn make_args<T: BenchPrimitive>(shape: InputShape) -> VecExecutionArgs {
368225
VecExecutionArgs::new(args, ROWS)
369226
}
370227

371-
fn make_filtered_args(validity: ValidityPattern) -> VecExecutionArgs {
372-
let values = PrimitiveArray::new(
373-
(0..ROWS).map(|index| index as i64).collect::<Buffer<_>>(),
374-
Validity::from_iter((0..ROWS).map(|index| validity.is_valid(index))),
375-
)
376-
.into_array();
377-
378-
VecExecutionArgs::new(vec![values], ROWS)
379-
}
380-
381228
fn bench_row_fn<F: RowFn<Options = EmptyOptions>>(
382229
bencher: Bencher,
383230
function: &F,

‎vortex-array/benches/row_fn_utf8.rs‎

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)