Skip to content

Refactor cosine distance into linalg module#786

Merged
eddyxu merged 13 commits intomainfrom
lei/move_cos
Apr 19, 2023
Merged

Refactor cosine distance into linalg module#786
eddyxu merged 13 commits intomainfrom
lei/move_cos

Conversation

@eddyxu
Copy link
Copy Markdown
Member

@eddyxu eddyxu commented Apr 18, 2023

  • Refactor cosine distance to linalg module.
  • Separate x86_64::avx and aarch64::neon modules ,and prepare the code to accept data types other than f32. Also support dynamical CPU feature detection.

@eddyxu eddyxu marked this pull request as ready for review April 18, 2023 22:55
Comment thread rust/src/linalg/cosine.rs
}
}

#[cfg(not(target_arch = "aarch64"))]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point you already know that target_arch != "aarch64", right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is making compiler happy. on aarch64, compiler will think this is dead code because it never reaches here.

Comment thread rust/src/linalg/cosine.rs
}
}

#[cfg(test)]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add tests to the aarch64 / x86_64 modules?

Copy link
Copy Markdown
Contributor

@gsilvestrin gsilvestrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some small comments

@eddyxu eddyxu merged commit 1cc4ef0 into main Apr 19, 2023
@eddyxu eddyxu deleted the lei/move_cos branch April 19, 2023 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants