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


##########
be/src/util/pdep_unpack.h:
##########
@@ -0,0 +1,166 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#if defined(__x86_64__) && (defined(__GNUC__) || defined(__clang__))
+
+#include <immintrin.h>
+
+#include <cstddef>
+#include <cstdint>
+#include <cstring>
+#include <limits>
+#include <type_traits>
+#include <utility>
+
+namespace doris {
+
+class PdepUnpack {
+public:
+    static bool is_supported() {
+        return __builtin_cpu_supports("bmi2") && 
__builtin_cpu_supports("avx2");

Review Comment:
   **[P1] Keep the scalar path on slow-PDEP AMD CPUs**
   
   This feature check is also true on supported Zen+/Zen 2 hosts, where 
register PDEP is microcoded: measured throughput is about 18-19 cycles (six 
micro-ops), versus one cycle on Zen 3 and mainstream Intel 
(https://uops.info/html-instr/PDEP_R64_R64_R64.html). Each 32-value kernel 
invocation here performs four PDEP instructions, or eight for the 9-15-bit 
word/generic branches, so those CPUs pay roughly 72-152 cycles for the deposits 
alone before loads, widening, and stores. The supplied benchmark covers only a 
recent Intel Xeon, while Doris's build/runtime requirements do not exclude 
these AMD generations. Please gate production dispatch on a CPU family with 
fast PDEP (at minimum retain scalar before Zen 3) and benchmark representative 
AMD hosts before enabling it there.



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