Skip to content

Commit

Permalink
Fix build bugs with metal, NSUInteger (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLBuehler authored Sep 25, 2024
1 parent 9e31a19 commit 105dbd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions candle-core/src/quantized/metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ impl QMetalStorage {
}

pub fn data(&self) -> Result<Vec<u8>> {
let size = (self.count * self.dtype.size_in_bytes()) as NSUInteger;
use metal::NSUInteger;
let count = self.buffer.length() as usize;
let size = (count * self.dtype.type_size()) as NSUInteger;

let buffer = self.device.new_buffer_managed(size)?;
{
Expand All @@ -220,7 +222,7 @@ impl QMetalStorage {
blit.end_encoding();
}
self.device.wait_until_completed()?;
Ok(read_to_vec::<u8>(&buffer, self.count))
Ok(read_to_vec::<u8>(&buffer, count))
}
}

Expand Down

0 comments on commit 105dbd0

Please sign in to comment.