Skip to content

Commit

Permalink
chore: cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
FL33TW00D committed Jan 26, 2024
1 parent 03f174b commit 7965c5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 2 additions & 4 deletions crates/ratchet-core/src/compiled_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions crates/ratchet-core/src/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
10 changes: 5 additions & 5 deletions crates/ratchet-core/src/tensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
Expand Down

0 comments on commit 7965c5a

Please sign in to comment.