Skip to content

Commit 9705626

Browse files
committed
build: 更新算子库
Signed-off-by: YdrMaster <ydrml@hotmail.com>
1 parent 46f6ee4 commit 9705626

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ itertools = "0.13"
2626

2727
ggus = { git = "https://github.com/YdrMaster/gguf", rev = "b65b1a2" }
2828
ndarray-layout = { git = "https://github.com/YdrMaster/ndarray-layout", rev = "48d36c5" }
29-
operators = { git = "https://github.com/YdrMaster/operators-rs", rev = "98e1abe", default-features = false }
29+
operators = { git = "https://github.com/YdrMaster/operators-rs", rev = "48892b8", default-features = false }
3030

3131
build-script-cfg = "0.0"
3232
search-cl-tools = { git = "https://github.com/InfiniTensor/clrt", rev = "6846d52" }

models/llama/common-cpu/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use llama::{
66
};
77
use operators::{
88
all_reduce::{AllReduce, NonAllReduce},
9-
common_cpu::{Blob, Cpu},
9+
common_cpu::Cpu,
1010
random_sample::common_cpu::Operator as RandomSampleCpu,
1111
rearrange::common_cpu::Operator as Rearrange,
12-
ByteOf, QueueOf, TopoNode,
12+
Blob, ByteOf, QueueOf, TopoNode,
1313
};
1414
use std::{
1515
cell::Ref,

models/llama/common-cpu/src/test_dist.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use gguf::GGufModel;
33
use llama::{ext::ggml_quants::f16, LlamaRequest, LlamaStorage, LlamaWorker, Tensor};
44
use operators::{
55
all_reduce::common_cpu::Operator as AllReduce,
6-
common_cpu::{Blob, Cpu, InprocNode, ThisThread},
6+
common_cpu::{Cpu, InprocNode, ThisThread},
77
random_sample::{KVPair, SampleArgs},
8+
Blob,
89
};
910
use std::{
1011
iter::zip,

models/llama/common-cpu/src/test_infer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ use llama::{
44
ext::ggml_quants::f16, LlamaArgs, LlamaMeta, LlamaRequest, LlamaStorage, LlamaWorker, Tensor,
55
};
66
use operators::{
7-
common_cpu::{Blob, Cpu, ThisThread},
7+
common_cpu::{Cpu, ThisThread},
88
random_sample::{KVPair, SampleArgs},
9+
Blob,
910
};
1011
use std::slice::from_raw_parts_mut;
1112
use test_utils::{Inference, TokenizerAndPrompt};

tensor/src/lib.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ mod operators;
33
mod split;
44

55
use ggus::ggml_quants::digit_layout::DigitLayout;
6-
use ndarray_layout::{ArrayLayout, Endian::BigEndian};
76
use std::{
87
ops::{Deref, DerefMut, Range},
98
slice::{from_raw_parts, from_raw_parts_mut},
109
};
1110

12-
pub use ::operators::common_cpu::Blob;
11+
pub use ::operators::Blob;
12+
pub use ndarray_layout::{ArrayLayout, Endian};
1313
pub use operators::RandomSample;
1414
pub use split::{LocalSplitable, Splitable};
1515

@@ -25,14 +25,23 @@ impl Tensor<usize> {
2525
let ele = dt.nbytes();
2626
Self {
2727
dt,
28-
layout: ArrayLayout::new_contiguous(shape, BigEndian, ele),
28+
layout: ArrayLayout::new_contiguous(shape, Endian::BigEndian, ele),
2929
physical: shape.iter().product::<usize>() * ele,
3030
}
3131
}
3232
}
3333

3434
/// access
3535
impl<T> Tensor<T> {
36+
#[inline]
37+
pub const fn from_parts(dt: DigitLayout, layout: ArrayLayout<5>, physical: T) -> Self {
38+
Self {
39+
dt,
40+
layout,
41+
physical,
42+
}
43+
}
44+
3645
#[inline]
3746
pub const fn dt(&self) -> DigitLayout {
3847
self.dt

0 commit comments

Comments
 (0)