etseidl commented on code in PR #6554:
URL: https://github.com/apache/arrow-rs/pull/6554#discussion_r1798626727


##########
arrow/CONTRIBUTING.md:
##########
@@ -109,6 +109,36 @@ 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 create does not use SIMD intrinsics (e.g. [`std::simd`] directly, but

Review Comment:
   ```suggestion
   This crate does not use SIMD intrinsics (e.g. [`std::simd`] directly, but
   ```
   



##########
arrow/CONTRIBUTING.md:
##########
@@ -109,6 +109,36 @@ 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 create does not use SIMD intrinsics (e.g. [`std::simd`] directly, but
+instead relies on LLVM's auto-vectorization.
+
+SIMD intrinsics are difficult to maintain and can be difficult to reason about.
+The auto-vectorizer in LLVM is quite good and often produces better code than
+hand-written manual uses of SIMD. In fact, this crate used to to have a fair
+amount of manual SIMD, and over time we've removed it as the auto-vectorized
+code was faster.
+
+[`std::simd`]: https://doc.rust-lang.org/std/simd/index.html
+
+LLVM is relatively good at vectorizing vertical operations provided:
+
+1. No conditionals within the loop body
+2. Not too much inlining , as the vectorizer gives up if the code is too 
complex
+3. No bitwise horizontal reductions or masking
+4. You've enabled SIMD instructions in the target ISA (e.g. `target-cpu` 
`RUSTFLAGS` flag)
+
+The last point is especially important as the default `target-cpu` doesn't
+support many SIMD instructions. See the Performance Tips section at the
+end of <https://crates.io/crates/arrow>
+
+To ensure your code is fully vectorized, we recommend getting familiar with

Review Comment:
   ```suggestion
   To ensure your code is fully vectorized, we recommend becoming familiar with
   ```



-- 
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]

Reply via email to