-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metal GGML Q40 support #1643
Metal GGML Q40 support #1643
Conversation
b7613ba
to
7ce03b7
Compare
This reverts commit 6af0994.
&& matches!(facts[0].datum_type, DatumType::F16 | DatumType::F32)) | ||
|| ((facts[1].datum_type == DatumType::F32) && (facts[0].datum_type == DatumType::F32)) | ||
|| ((facts[1].datum_type == DatumType::F16) | ||
&& matches!(facts[0].datum_type, DatumType::F32 | DatumType::F16)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, this is very hard to parse :) maybe we could split the tricky q40 case apart then do somethings like
use DatumType::*;
match (facts[0].datum_type, facts[1].datum_type) {
(F32, F32) => true,
(F16, F16) => true,
(F16, F32) => true,
_ => false
}
a_dt: DatumType, | ||
b_dt: DatumType, | ||
) -> TractResult<TVec<TypedFact>> { | ||
let out_dt = self.matmul.output_dt(a_dt, b_dt)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about something that respect the symmetry more ?
ensure!([DatumType::F16, DatumType::F32].contains(out_dt));
Ok(tvec!(out_dt.fact(shape))
metal/src/kernels/matmul/mod.rs
Outdated
}; | ||
|
||
let mut rng = rand::thread_rng(); | ||
let lhs_data: Vec<F> = (0..b * m * k) // Create a vector with 10 elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suspect we have a lying comment here.
metal/src/kernels/matmul/mod.rs
Outdated
|
||
let mut rng = rand::thread_rng(); | ||
let lhs_data: Vec<F> = (0..b * m * k) // Create a vector with 10 elements | ||
.map(|_| F::from(rng.gen_range(0.0..1.0)).unwrap()) // Generate a random float in [0.0, 1.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm... this is not good. we should not rand() ourselves, but let the proptest strategies do it in predictable and simplifiable manner. The idea is to use proptest::collections::vec()
or something like that.
ee3db0e
to
1a5de36
Compare
No description provided.