-
Notifications
You must be signed in to change notification settings - Fork 251
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
[Rust] Benchmark for dot product #1142
Conversation
eddyxu
commented
Aug 17, 2023
•
edited
Loading
edited
- Add benchmark for dot product of f16/f32/f64
- Simd for f32 dot.
const TOTAL: usize = 1024 * 1024; // 1M vectors | ||
|
||
run_bench::<Float16Type>(c); | ||
c.bench_function("Dot(f16, SIMD)", |b| { |
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.
why not put this in run_bench
as well?
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.
This is due to the generic specialization thing. Could not make generic trait working
@@ -53,6 +55,13 @@ impl Dot for [f32] { | |||
type Output = f32; | |||
|
|||
fn dot(&self, other: &[f32]) -> f32 { | |||
#[cfg(target_arch = "x86_64")] | |||
{ | |||
if is_x86_feature_detected!("fma") { |
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.
do we need AVX2 flag here too?
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.
We dont not need. fma
is one set newer than to avx2
, for the machine with fma
, all of them have avx2
.