Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions vortex-array/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::ops::Range;
use std::sync::Arc;

use futures::future::BoxFuture;
use vortex_buffer::ALIGNMENT_TO_HOST_COPY;
use vortex_buffer::Alignment;
use vortex_buffer::ByteBuffer;
use vortex_error::VortexExpect;
Expand Down Expand Up @@ -321,7 +320,7 @@ impl BufferHandle {
pub fn try_to_host_sync(&self) -> VortexResult<ByteBuffer> {
match &self.0 {
Inner::Host(b) => Ok(b.clone()),
Inner::Device(device) => device.copy_to_host_sync(ALIGNMENT_TO_HOST_COPY),
Inner::Device(device) => device.copy_to_host_sync(Alignment::HOST_COPY),
}
}

Expand All @@ -331,7 +330,7 @@ impl BufferHandle {
pub fn try_into_host_sync(self) -> VortexResult<ByteBuffer> {
match self.0 {
Inner::Host(b) => Ok(b),
Inner::Device(device) => device.copy_to_host_sync(ALIGNMENT_TO_HOST_COPY),
Inner::Device(device) => device.copy_to_host_sync(Alignment::HOST_COPY),
}
}

Expand All @@ -352,7 +351,7 @@ impl BufferHandle {
let buffer = b.clone();
Ok(Box::pin(async move { Ok(buffer) }))
}
Inner::Device(device) => device.copy_to_host(ALIGNMENT_TO_HOST_COPY),
Inner::Device(device) => device.copy_to_host(Alignment::HOST_COPY),
}
}

Expand All @@ -370,7 +369,7 @@ impl BufferHandle {
pub fn try_into_host(self) -> VortexResult<BoxFuture<'static, VortexResult<ByteBuffer>>> {
match self.0 {
Inner::Host(b) => Ok(Box::pin(async move { Ok(b) })),
Inner::Device(device) => device.copy_to_host(ALIGNMENT_TO_HOST_COPY),
Inner::Device(device) => device.copy_to_host(Alignment::HOST_COPY),
}
}

Expand Down
6 changes: 3 additions & 3 deletions vortex-buffer/src/alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ use vortex_error::VortexError;
use vortex_error::VortexExpect;
use vortex_error::vortex_err;

/// Default alignment for device-to-host buffer copies.
pub const ALIGNMENT_TO_HOST_COPY: Alignment = Alignment::new(256);

/// The alignment of a buffer.
///
/// This type is a wrapper around `usize` that ensures the alignment is a power of 2 and fits into
Expand All @@ -19,6 +16,9 @@ pub const ALIGNMENT_TO_HOST_COPY: Alignment = Alignment::new(256);
pub struct Alignment(usize);

impl Alignment {
/// Default alignment for device-to-host buffer copies.
pub const HOST_COPY: Self = Alignment::new(256);

/// Create a new alignment.
///
/// ## Panics
Expand Down
Loading