Add GLM 5.2 Metal execution
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
impl Executor {
|
||||
impl DeepSeekExecutor {
|
||||
pub(in crate::engine) fn save_checkpoint(
|
||||
&mut self,
|
||||
path: &Path,
|
||||
@@ -305,12 +305,37 @@ impl Executor {
|
||||
}
|
||||
}
|
||||
|
||||
impl Executor {
|
||||
pub(in crate::engine) fn save_checkpoint(
|
||||
&mut self,
|
||||
path: &Path,
|
||||
tag: [u8; 32],
|
||||
progress: &mut impl FnMut(u64),
|
||||
) -> Result<(), String> {
|
||||
match self {
|
||||
Self::DeepSeek(executor) => executor.save_checkpoint(path, tag, progress),
|
||||
Self::Glm(executor) => executor.save_checkpoint(path, tag, progress),
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::engine) fn load_checkpoint(
|
||||
&mut self,
|
||||
path: &Path,
|
||||
progress: &mut impl FnMut(u64),
|
||||
) -> Result<bool, String> {
|
||||
match self {
|
||||
Self::DeepSeek(executor) => executor.load_checkpoint(path, progress),
|
||||
Self::Glm(executor) => executor.load_checkpoint(path, progress),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn compressor_state_bytes(ratio: u32, head_dim: u64) -> u64 {
|
||||
let coefficient = if ratio == 4 { 2 } else { 1 };
|
||||
coefficient * head_dim * coefficient * u64::from(ratio) * 4
|
||||
}
|
||||
|
||||
fn write_buffer(
|
||||
pub(super) fn write_buffer(
|
||||
file: &mut File,
|
||||
buffer: &Buffer,
|
||||
mut offset: u64,
|
||||
@@ -330,7 +355,7 @@ fn write_buffer(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_buffer(
|
||||
pub(super) fn read_buffer(
|
||||
file: &mut File,
|
||||
buffer: &Buffer,
|
||||
mut offset: u64,
|
||||
@@ -350,24 +375,24 @@ fn read_buffer(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_u32(file: &mut File, value: u32) -> Result<(), String> {
|
||||
pub(super) fn write_u32(file: &mut File, value: u32) -> Result<(), String> {
|
||||
file.write_all(&value.to_le_bytes())
|
||||
.map_err(|error| error.to_string())
|
||||
}
|
||||
|
||||
fn write_u64(file: &mut File, value: u64) -> Result<(), String> {
|
||||
pub(super) fn write_u64(file: &mut File, value: u64) -> Result<(), String> {
|
||||
file.write_all(&value.to_le_bytes())
|
||||
.map_err(|error| error.to_string())
|
||||
}
|
||||
|
||||
fn read_u32(file: &mut File) -> Result<u32, String> {
|
||||
pub(super) fn read_u32(file: &mut File) -> Result<u32, String> {
|
||||
let mut bytes = [0; 4];
|
||||
file.read_exact(&mut bytes)
|
||||
.map_err(|error| error.to_string())?;
|
||||
Ok(u32::from_le_bytes(bytes))
|
||||
}
|
||||
|
||||
fn read_u64(file: &mut File) -> Result<u64, String> {
|
||||
pub(super) fn read_u64(file: &mut File) -> Result<u64, String> {
|
||||
let mut bytes = [0; 8];
|
||||
file.read_exact(&mut bytes)
|
||||
.map_err(|error| error.to_string())?;
|
||||
|
||||
Reference in New Issue
Block a user