Skip to content

Commit 4cc20b4

Browse files
committed
wip
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 11e2b2f commit 4cc20b4

11 files changed

Lines changed: 31 additions & 36 deletions

File tree

encodings/zstd/src/zstd_buffers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ impl ZstdBuffers {
5353
}
5454

5555
pub fn compress(array: &ArrayRef, level: i32) -> VortexResult<ZstdBuffersArray> {
56-
let encoding_id = array.encoding_id();
5756
let metadata = array
5857
.metadata()?
5958
.ok_or_else(|| vortex_err!("Array does not support serialization"))?;
@@ -74,6 +73,7 @@ impl ZstdBuffers {
7473
compressed_buffers.push(BufferHandle::new_host(ByteBuffer::from(compressed)));
7574
}
7675

76+
let encoding_id = array.encoding_id().clone();
7777
let data = ZstdBuffersData {
7878
inner_encoding_id: encoding_id,
7979
inner_metadata: metadata,

vortex-array/public-api.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21504,7 +21504,7 @@ pub fn vortex_array::Array<V>::data(&self) -> &<V as vortex_array::VTable>::Arra
2150421504

2150521505
pub fn vortex_array::Array<V>::dtype(&self) -> &vortex_array::dtype::DType
2150621506

21507-
pub fn vortex_array::Array<V>::encoding_id(&self) -> vortex_array::ArrayId
21507+
pub fn vortex_array::Array<V>::encoding_id(&self) -> &vortex_array::ArrayId
2150821508

2150921509
pub fn vortex_array::Array<V>::into_data(self) -> <V as vortex_array::VTable>::ArrayData
2151021510

@@ -21680,7 +21680,7 @@ pub fn vortex_array::ArrayRef::downcast<V: vortex_array::VTable>(self) -> vortex
2168021680

2168121681
pub fn vortex_array::ArrayRef::dtype(&self) -> &vortex_array::dtype::DType
2168221682

21683-
pub fn vortex_array::ArrayRef::encoding_id(&self) -> vortex_array::ArrayId
21683+
pub fn vortex_array::ArrayRef::encoding_id(&self) -> &vortex_array::ArrayId
2168421684

2168521685
pub fn vortex_array::ArrayRef::execute_parent(&self, parent: &vortex_array::ArrayRef, child_idx: usize, ctx: &mut vortex_array::ExecutionCtx) -> vortex_error::VortexResult<core::option::Option<vortex_array::ArrayRef>>
2168621686

@@ -22128,7 +22128,7 @@ pub fn vortex_array::ArrayView<'a, V>::data(&self) -> &'a <V as vortex_array::VT
2212822128

2212922129
pub fn vortex_array::ArrayView<'a, V>::dtype(&self) -> &vortex_array::dtype::DType
2213022130

22131-
pub fn vortex_array::ArrayView<'a, V>::encoding_id(&self) -> vortex_array::ArrayId
22131+
pub fn vortex_array::ArrayView<'a, V>::encoding_id(&self) -> &vortex_array::ArrayId
2213222132

2213322133
pub fn vortex_array::ArrayView<'a, V>::into_owned(self) -> vortex_array::Array<V>
2213422134

vortex-array/src/array/typed.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ pub(crate) struct ArrayInner<V: VTable> {
8787
}
8888

8989
impl<V: VTable> ArrayInner<V> {
90-
/// Returns the encoding ID.
91-
pub fn encoding_id(&self) -> &ArrayId {
92-
&self.encoding_id
93-
}
94-
9590
/// Create a new inner array from explicit construction parameters.
9691
#[doc(hidden)]
9792
pub fn try_new(new: ArrayParts<V>) -> VortexResult<Self> {
@@ -275,7 +270,7 @@ impl<V: VTable> Array<V> {
275270

276271
/// Returns the encoding ID.
277272
pub fn encoding_id(&self) -> &ArrayId {
278-
&self.inner.encoding_id()
273+
&self.downcast_inner().encoding_id
279274
}
280275

281276
/// Returns the statistics.

vortex-array/src/array/view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'a, V: VTable> ArrayView<'a, V> {
6262
}
6363

6464
pub fn encoding_id(&self) -> &ArrayId {
65-
&self.array.encoding_id()
65+
self.array.encoding_id()
6666
}
6767

6868
pub fn statistics(&self) -> StatsSetRef<'_> {

vortex-array/src/normalize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl ArrayRef {
3737
}
3838

3939
fn normalize_with_error(&self, allowed: &[Id]) -> VortexResult<()> {
40-
if !allowed.contains(&self.encoding_id()) {
40+
if !allowed.contains(self.encoding_id()) {
4141
vortex_bail!(AssertionFailed: "normalize forbids encoding ({})", self.encoding_id())
4242
}
4343

vortex-array/src/serde.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl<'a> ArrayNodeFlatBuffer<'a> {
192192
) -> VortexResult<WIPOffset<fba::ArrayNode<'fb>>> {
193193
let encoding_idx = self
194194
.ctx
195-
.intern(&self.array.encoding_id())
195+
.intern(self.array.encoding_id())
196196
// TODO(ngates): write_flatbuffer should return a result if this can fail.
197197
.ok_or_else(|| {
198198
vortex_err!(

vortex-cuda/src/dynamic_dispatch/plan_builder.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ pub struct MaterializedPlan {
5353
/// Checks whether the encoding of an array can be fused into a dynamic-dispatch plan.
5454
fn is_dyn_dispatch_compatible(array: &ArrayRef) -> bool {
5555
let id = array.encoding_id();
56-
if id == ALP::ID {
56+
if *id == ALP::ID {
5757
let arr = array.as_::<ALP>();
5858
return arr.patches().is_none() && arr.dtype().as_ptype() == PType::F32;
5959
}
60-
if id == BitPacked::ID {
60+
if *id == BitPacked::ID {
6161
return array.as_::<BitPacked>().patches().is_none();
6262
}
63-
if id == Dict::ID {
63+
if *id == Dict::ID {
6464
let arr = array.as_::<Dict>();
6565
// As of now the dict dyn dispatch kernel requires
6666
// codes and values to have the same byte width.
@@ -72,7 +72,7 @@ fn is_dyn_dispatch_compatible(array: &ArrayRef) -> bool {
7272
_ => false,
7373
};
7474
}
75-
if id == RunEnd::ID {
75+
if *id == RunEnd::ID {
7676
let arr = array.as_::<RunEnd>();
7777
// As of now the run-end dyn dispatch kernel requires
7878
// ends and values to have the same byte width.
@@ -84,11 +84,11 @@ fn is_dyn_dispatch_compatible(array: &ArrayRef) -> bool {
8484
_ => false,
8585
};
8686
}
87-
id == FoR::ID
88-
|| id == ZigZag::ID
89-
|| id == Primitive::ID
90-
|| id == Slice::ID
91-
|| id == Sequence::ID
87+
*id == FoR::ID
88+
|| *id == ZigZag::ID
89+
|| *id == Primitive::ID
90+
|| *id == Slice::ID
91+
|| *id == Sequence::ID
9292
}
9393

9494
/// An unmaterialized stage: a source op, scalar ops, and optional source buffer reference.
@@ -361,23 +361,23 @@ impl FusedPlan {
361361

362362
let id = array.encoding_id();
363363

364-
if id == BitPacked::ID {
364+
if *id == BitPacked::ID {
365365
self.walk_bitpacked(array)
366-
} else if id == FoR::ID {
366+
} else if *id == FoR::ID {
367367
self.walk_for(array, pending_subtrees)
368-
} else if id == ZigZag::ID {
368+
} else if *id == ZigZag::ID {
369369
self.walk_zigzag(array, pending_subtrees)
370-
} else if id == ALP::ID {
370+
} else if *id == ALP::ID {
371371
self.walk_alp(array, pending_subtrees)
372-
} else if id == Dict::ID {
372+
} else if *id == Dict::ID {
373373
self.walk_dict(array, pending_subtrees)
374-
} else if id == RunEnd::ID {
374+
} else if *id == RunEnd::ID {
375375
self.walk_runend(array, pending_subtrees)
376-
} else if id == Primitive::ID {
376+
} else if *id == Primitive::ID {
377377
self.walk_primitive(array)
378-
} else if id == Slice::ID {
378+
} else if *id == Slice::ID {
379379
self.walk_slice(array, pending_subtrees)
380-
} else if id == Sequence::ID {
380+
} else if *id == Sequence::ID {
381381
self.walk_sequence(array)
382382
} else {
383383
vortex_bail!(

vortex-cuda/src/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ pub trait CudaArrayExt {
352352
impl CudaArrayExt for ArrayRef {
353353
#[allow(clippy::unwrap_in_result, clippy::unwrap_used)]
354354
async fn execute_cuda(self, ctx: &mut CudaExecutionCtx) -> VortexResult<Canonical> {
355-
if self.encoding_id() == Struct::ID {
355+
if *self.encoding_id() == Struct::ID {
356356
let len = self.len();
357357
let StructDataParts {
358358
fields,

vortex-cuda/src/hybrid_dispatch/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub async fn try_gpu_dispatch(
9999
DispatchPlan::Unfused => {
100100
// Unfused kernel dispatch fallback.
101101
ctx.cuda_session()
102-
.kernel(&array.encoding_id())
102+
.kernel(array.encoding_id())
103103
.ok_or_else(|| {
104104
vortex_err!("No CUDA kernel for encoding {:?}", array.encoding_id())
105105
})?

vortex-cuda/src/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ fn extract_constant_buffers(chunk: &ArrayRef) -> Vec<InlinedBuffer> {
549549
let mut buffer_idx = 0u32;
550550
for array in chunk.depth_first_traversal() {
551551
let n = array.nbuffers();
552-
if array.encoding_id() == Constant::ID {
552+
if *array.encoding_id() == Constant::ID {
553553
for buf in array.buffers() {
554554
result.push(InlinedBuffer {
555555
buffer_index: buffer_idx,

0 commit comments

Comments
 (0)