bkietz commented on a change in pull request #9768:
URL: https://github.com/apache/arrow/pull/9768#discussion_r630404567



##########
File path: cpp/src/arrow/compute/exec/key_hash.cc
##########
@@ -0,0 +1,247 @@
+// 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.
+
+#include "arrow/compute/exec/key_hash.h"
+
+#include <memory.h>
+
+#include <cstdint>
+
+#include "arrow/compute/exec/util.h"
+
+#ifdef _MSC_VER
+#include <intrin.h>
+#else
+#include <x86intrin.h>
+#endif
+#include <immintrin.h>
+
+#include <algorithm>
+
+namespace arrow {
+namespace compute {
+
+inline uint32_t Hashing::avalanche_helper(uint32_t acc) {
+  acc ^= (acc >> 15);
+  acc *= PRIME32_2;
+  acc ^= (acc >> 13);
+  acc *= PRIME32_3;
+  acc ^= (acc >> 16);
+  return acc;
+}
+
+void Hashing::avalanche(const arrow::internal::CpuInfo* cpu_info, uint32_t 
num_keys,

Review comment:
       If the intent is to allow functions to be called with any hardware flags 
independent of any other calls, it's worth noting that CpuInfo is a singleton. 
So for example disabling AVX2 for Hashing::avalanche will prevent it from being 
used in any other functions as well. I think what you want is to pass an 
`int64_t hardware_flags` which can be acquired with 
`CpuInfo::GetInstance()->hardware_flags()` or explicitly specified




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to