Skip to content

Commit 11ac1c0

Browse files
committed
move code around and remove scalar fn plugin
Signed-off-by: Connor Tsui <[email protected]>
1 parent 5314399 commit 11ac1c0

13 files changed

Lines changed: 283 additions & 483 deletions

File tree

‎vortex-turboquant/benches/encode_decode.rs‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//!
77
//! The four mask shapes (`AllTrue`, `AllFalse`, dense `Values`, sparse `Values`) exercise the
88
//! variant-specialized paths added in the mask refactor in `vector/normalize.rs`,
9-
//! `vector/quantize.rs`, and `vector/decode.rs`.
9+
//! `vector/quantize.rs`, and `scalar_fns/decode.rs`.
1010
1111
#![expect(clippy::unwrap_used)]
1212

@@ -101,17 +101,15 @@ fn build_vector_array(shape: MaskShape) -> ArrayRef {
101101
}
102102

103103
fn encode(vec: ArrayRef, config: &TurboQuantConfig, ctx: &mut ExecutionCtx) -> ArrayRef {
104-
let len = vec.len();
105-
TQEncode::try_new_array(vec, config, len)
104+
TQEncode::try_new_array(vec, config)
106105
.unwrap()
107106
.into_array()
108107
.execute(ctx)
109108
.unwrap()
110109
}
111110

112-
fn decode(encoded: ArrayRef, config: &TurboQuantConfig, ctx: &mut ExecutionCtx) -> ArrayRef {
113-
let len = encoded.len();
114-
TQDecode::try_new_array(encoded, config, len)
111+
fn decode(encoded: ArrayRef, ctx: &mut ExecutionCtx) -> ArrayRef {
112+
TQDecode::try_new_array(encoded)
115113
.unwrap()
116114
.into_array()
117115
.execute(ctx)
@@ -145,5 +143,5 @@ fn turboquant_decode(bencher: Bencher, shape: &MaskShape) {
145143
(encoded, SESSION.create_execution_ctx())
146144
})
147145
.input_counter(|_| divan::counter::ItemsCount::new(ROWS))
148-
.bench_values(|(encoded, mut ctx)| decode(encoded, &cfg, &mut ctx))
146+
.bench_values(|(encoded, mut ctx)| decode(encoded, &mut ctx))
149147
}

‎vortex-turboquant/public-api.lock‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,17 @@ pub struct vortex_turboquant::TQDecode
44

55
impl vortex_turboquant::TQDecode
66

7-
pub fn vortex_turboquant::TQDecode::new(&vortex_turboquant::TurboQuantConfig) -> vortex_array::scalar_fn::typed::TypedScalarFnInstance<vortex_turboquant::TQDecode>
7+
pub fn vortex_turboquant::TQDecode::new() -> vortex_array::scalar_fn::typed::TypedScalarFnInstance<vortex_turboquant::TQDecode>
88

9-
pub fn vortex_turboquant::TQDecode::try_new_array(vortex_array::array::erased::ArrayRef, &vortex_turboquant::TurboQuantConfig, usize) -> vortex_error::VortexResult<vortex_array::arrays::scalar_fn::vtable::ScalarFnArray>
9+
pub fn vortex_turboquant::TQDecode::try_new_array(vortex_array::array::erased::ArrayRef) -> vortex_error::VortexResult<vortex_array::arrays::scalar_fn::vtable::ScalarFnArray>
1010

1111
impl core::clone::Clone for vortex_turboquant::TQDecode
1212

1313
pub fn vortex_turboquant::TQDecode::clone(&self) -> vortex_turboquant::TQDecode
1414

15-
impl vortex_array::arrays::scalar_fn::plugin::ScalarFnArrayVTable for vortex_turboquant::TQDecode
16-
17-
pub fn vortex_turboquant::TQDecode::deserialize(&self, &vortex_array::dtype::DType, usize, &[u8], &dyn vortex_array::serde::ArrayChildren, &vortex_session::VortexSession) -> vortex_error::VortexResult<vortex_array::arrays::scalar_fn::plugin::ScalarFnArrayParts<Self>>
18-
19-
pub fn vortex_turboquant::TQDecode::serialize(&self, &vortex_array::arrays::scalar_fn::vtable::ScalarFnArrayView<'_, Self>, &vortex_session::VortexSession) -> vortex_error::VortexResult<core::option::Option<alloc::vec::Vec<u8>>>
20-
2115
impl vortex_array::scalar_fn::vtable::ScalarFnVTable for vortex_turboquant::TQDecode
2216

23-
pub type vortex_turboquant::TQDecode::Options = vortex_turboquant::TurboQuantConfig
17+
pub type vortex_turboquant::TQDecode::Options = vortex_array::extension::EmptyMetadata
2418

2519
pub fn vortex_turboquant::TQDecode::arity(&self, &Self::Options) -> vortex_array::scalar_fn::vtable::Arity
2620

@@ -50,7 +44,7 @@ impl vortex_turboquant::TQEncode
5044

5145
pub fn vortex_turboquant::TQEncode::new(&vortex_turboquant::TurboQuantConfig) -> vortex_array::scalar_fn::typed::TypedScalarFnInstance<vortex_turboquant::TQEncode>
5246

53-
pub fn vortex_turboquant::TQEncode::try_new_array(vortex_array::array::erased::ArrayRef, &vortex_turboquant::TurboQuantConfig, usize) -> vortex_error::VortexResult<vortex_array::arrays::scalar_fn::vtable::ScalarFnArray>
47+
pub fn vortex_turboquant::TQEncode::try_new_array(vortex_array::array::erased::ArrayRef, &vortex_turboquant::TurboQuantConfig) -> vortex_error::VortexResult<vortex_array::arrays::scalar_fn::vtable::ScalarFnArray>
5448

5549
impl core::clone::Clone for vortex_turboquant::TQEncode
5650

‎vortex-turboquant/src/lib.rs‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,12 @@ pub use vtable::TurboQuantMetadata;
6969
// TODO(connor): We need to somehow make sure that callers call `vortex_tensor::initialize` first.
7070
/// Register the TurboQuant extension type with a Vortex session.
7171
pub fn initialize(session: &vortex_session::VortexSession) {
72-
use vortex_array::arrays::scalar_fn::plugin::ScalarFnArrayPlugin;
7372
use vortex_array::dtype::session::DTypeSessionExt;
7473
use vortex_array::scalar_fn::session::ScalarFnSessionExt;
75-
use vortex_array::session::ArraySessionExt;
76-
7774
session.dtypes().register(TurboQuant);
7875

7976
session.scalar_fns().register(TQEncode);
8077
session.scalar_fns().register(TQDecode);
81-
82-
let session_arrays = session.arrays();
83-
session_arrays.register(ScalarFnArrayPlugin::new(TQDecode));
8478
}
8579

8680
#[cfg(test)]

0 commit comments

Comments
 (0)