Skip to content
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

Merged
merged 7 commits into from
Aug 17, 2023
Merged

[Rust] Benchmark for dot product #1142

merged 7 commits into from
Aug 17, 2023

Conversation

eddyxu
Copy link
Contributor

@eddyxu eddyxu commented Aug 17, 2023

  • Add benchmark for dot product of f16/f32/f64
  • Simd for f32 dot.

@eddyxu eddyxu added benchmark WIP work in progress donotmerge Do not merge donotreview labels Aug 17, 2023
@eddyxu eddyxu self-assigned this Aug 17, 2023
@eddyxu eddyxu marked this pull request as ready for review August 17, 2023 07:27
@eddyxu eddyxu changed the title [Rust] Benchmark for dot production [Rust] Benchmark for dot product Aug 17, 2023
const TOTAL: usize = 1024 * 1024; // 1M vectors

run_bench::<Float16Type>(c);
c.bench_function("Dot(f16, SIMD)", |b| {
Copy link
Contributor

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?

Copy link
Contributor Author

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") {
Copy link
Contributor

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?

Copy link
Contributor Author

@eddyxu eddyxu Aug 17, 2023

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.

@eddyxu eddyxu merged commit da41e49 into main Aug 17, 2023
@eddyxu eddyxu deleted the lei/dot_bench branch August 17, 2023 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants