github-actions[bot] commented on code in PR #70754:
URL: https://github.com/apache/doris/pull/70754#discussion_r4628489743


##########
be/src/util/md5.cpp:
##########
@@ -142,6 +158,55 @@ struct AVX2MD5Ops {
     }
 };
 
+using NativeMD5Ops = AVX2MD5Ops;
+#elif defined(__aarch64__)
+struct NeonMD5Ops {
+    using Vec = uint32x4_t;
+    static constexpr size_t LANES = 4;
+
+    static bool prefer_serial(size_t total_blocks, size_t max_blocks) {
+        // A long message keeps both SIMD groups running after shorter lanes 
finish.
+        return max_blocks > total_blocks / LANES;
+    }
+
+    static Vec add(Vec a, Vec b) { return vaddq_u32(a, b); }
+    static Vec set1(uint32_t v) { return vdupq_n_u32(v); }
+    static void storeu(void* p, Vec v) {
+        vst1q_u8(static_cast<uint8_t*>(p), vreinterpretq_u8_u32(v));
+    }
+

Review Comment:
   [P1] Fix the AArch64 NEON rotate-left helper: `vsriq_n_u32(vshlq_n_u32(x, 
N), x, 32 - N)` shifts/inserts the wrong operands and does not compute a 
rotate-left, so vectorized MD5 batches (for example four or more same-sized SQL 
rows) can return incorrect hashes on AArch64. Use the equivalent `(x << N) | (x 
>> (32 - N))` operation (such as `vsriq_n_u32(x, x, 32 - N)`) and keep a batch 
test covering at least four inputs.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to