@@ -13,7 +13,6 @@ use divan::Bencher;
1313use divan:: counter:: ItemsCount ;
1414use mimalloc:: MiMalloc ;
1515use vortex_array:: ArrayRef ;
16- use vortex_array:: ExecutionCtx ;
1716use vortex_array:: IntoArray ;
1817use vortex_array:: VortexSessionExecute ;
1918use vortex_array:: array_session;
@@ -24,14 +23,9 @@ use vortex_array::dtype::NativePType;
2423use vortex_array:: scalar_fn:: EmptyOptions ;
2524use vortex_array:: scalar_fn:: ScalarFnId ;
2625use vortex_array:: scalar_fn:: VecExecutionArgs ;
27- use vortex_array:: scalar_fn:: unstable:: row:: InitializedElement ;
28- use vortex_array:: scalar_fn:: unstable:: row:: InputElement ;
2926use vortex_array:: scalar_fn:: unstable:: row:: RowFn ;
3027use vortex_array:: scalar_fn:: unstable:: row:: RowVisitor ;
31- use vortex_array:: scalar_fn:: unstable:: row:: UninitElementSink ;
3228use vortex_array:: scalar_fn:: unstable:: row:: execute_rows;
33- use vortex_array:: validity:: Validity ;
34- use vortex_buffer:: Buffer ;
3529use vortex_error:: VortexExpect ;
3630use vortex_error:: VortexResult ;
3731use vortex_error:: vortex_ensure;
@@ -62,36 +56,13 @@ const INPUT_SHAPES: &[InputShape] = &[InputShape::PerRowPerRow];
6256/// and that is the difference worth watching.
6357const 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 ) ]
7260enum 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-
9566trait 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 ) ]
17595struct InfallibleBool < T > ( PhantomData < T > ) ;
17696
@@ -180,12 +100,6 @@ struct DeferredBool<T>(PhantomData<T>);
180100#[ derive( Clone ) ]
181101struct DeferredI64 ;
182102
183- #[ derive( Clone ) ]
184- struct FilteredOwnedI64 ;
185-
186- #[ derive( Clone ) ]
187- struct FilteredSinkI64 ;
188-
189103impl < 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 ) ]
317186fn 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-
361218fn 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-
381228fn bench_row_fn < F : RowFn < Options = EmptyOptions > > (
382229 bencher : Bencher ,
383230 function : & F ,
0 commit comments