alamb commented on code in PR #6554: URL: https://github.com/apache/arrow-rs/pull/6554#discussion_r1802864888
########## arrow/CONTRIBUTING.md: ########## @@ -109,6 +109,42 @@ specific JIRA issues and reference them in these code comments. For example: // This is not sound because .... see https://issues.apache.org/jira/browse/ARROW-nnnnn ``` +### Usage if SIMD / auto vectorization + +This crate does not use SIMD intrinsics (e.g. [`std::simd`]) directly, but +instead relies on the Rust compiler's auto-vectorization capabilities, which are +built on LLVM. + +SIMD intrinsics are difficult to maintain and can be difficult to reason about. +The auto-vectorizer in LLVM is quite good and often produces kernels that are +faster than using hand-written SIMD intrinsics. This crate used to contain +several kernels with hand-written SIMD instructions, which were removed after +discovering the auto-vectorized code was faster. + +[`std::simd`]: https://doc.rust-lang.org/std/simd/index.html + +#### Tips for auto vectorization + +LLVM is relatively good at vectorizing vertical operations provided: + +1. No conditionals within the loop body (e.g no checking for nulls on each row) +2. Not too much inlining (as the vectorizer gives up if the code is too complex) Review Comment: ```suggestion 2. Not too much `#[inline]` (as the vectorizer gives up if the code is too complex) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
