diff --git a/vortex-array/src/buffer.rs b/vortex-array/src/buffer.rs index 6c59140c9a6..43039eb52ab 100644 --- a/vortex-array/src/buffer.rs +++ b/vortex-array/src/buffer.rs @@ -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; @@ -321,7 +320,7 @@ impl BufferHandle { pub fn try_to_host_sync(&self) -> VortexResult { 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), } } @@ -331,7 +330,7 @@ impl BufferHandle { pub fn try_into_host_sync(self) -> VortexResult { 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), } } @@ -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), } } @@ -370,7 +369,7 @@ impl BufferHandle { pub fn try_into_host(self) -> VortexResult>> { 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), } } diff --git a/vortex-buffer/src/alignment.rs b/vortex-buffer/src/alignment.rs index c09bb82e7cb..43a4c29c8b7 100644 --- a/vortex-buffer/src/alignment.rs +++ b/vortex-buffer/src/alignment.rs @@ -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 @@ -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