diff --git a/crates/ratchet-core/src/compiled_op.rs b/crates/ratchet-core/src/compiled_op.rs index 76dd55d5..6f1d0cd7 100644 --- a/crates/ratchet-core/src/compiled_op.rs +++ b/crates/ratchet-core/src/compiled_op.rs @@ -20,7 +20,6 @@ pub struct CompiledOp { impl CompiledOp { const MAX_BINDINGS_PER_GROUP: usize = 4; - //TODO: Should return a Result pub fn create_storage_bind_groups( srcs: &[&Tensor], dst: &Tensor, @@ -44,9 +43,8 @@ impl CompiledOp { let entries = bind_group_entries[group_range].into(); let layout = *bind_group_layout; - let bind_group = - device.get_or_create_bind_group(&BindGroupDescriptor { entries, layout })?; - storage_groups.push(bind_group); + let bg = device.get_or_create_bind_group(&BindGroupDescriptor { entries, layout })?; + storage_groups.push(bg); } Ok(storage_groups) } diff --git a/crates/ratchet-core/src/op.rs b/crates/ratchet-core/src/op.rs index 4d236feb..0064ac65 100644 --- a/crates/ratchet-core/src/op.rs +++ b/crates/ratchet-core/src/op.rs @@ -7,6 +7,7 @@ use crate::gpu::{CpuUniform, PoolError, WgpuDevice, UNIFORM_ALIGN}; use crate::{rvec, Binary, CompiledOp, InvariantError, Matmul, RVec, Softmax, StorageView, Tensor}; #[derive(Clone, Debug)] +#[non_exhaustive] pub enum LazyOp { Matmul(Matmul), Binary(Binary), diff --git a/crates/ratchet-core/src/tensor.rs b/crates/ratchet-core/src/tensor.rs index c1a9ebca..b6718713 100644 --- a/crates/ratchet-core/src/tensor.rs +++ b/crates/ratchet-core/src/tensor.rs @@ -261,12 +261,12 @@ impl Tensor { let handle = gpu_buf.inner().handle; let segments = self.dt().segments(gpu_buf.inner().size() as usize); segments.iter().fold(rvec![], |mut entries, segment| { - let entry = BindGroupEntry { + let (offset, size) = (segment.offset, segment.size); + entries.push(BindGroupEntry { handle, - offset: segment.offset, - size: segment.size, - }; - entries.push(entry); + offset, + size, + }); entries }) }