This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 6e85737106f brach-3.1: [Fix](SIMDJson) manually selecting the
implementation for different CPU architecture #52732 (#53894)
6e85737106f is described below
commit 6e85737106f5762cb876ad39c25dab860977b8fa
Author: lihangyu <[email protected]>
AuthorDate: Mon Jul 28 10:33:57 2025 +0800
brach-3.1: [Fix](SIMDJson) manually selecting the implementation for
different CPU architecture #52732 (#53894)
cherry-pick #52732
---
be/src/runtime/exec_env_init.cpp | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index fd215be258f..33a00d15658 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -19,6 +19,7 @@
#include <common/multi_version.h>
#include <gen_cpp/HeartbeatService_types.h>
#include <gen_cpp/Metrics_types.h>
+#include <simdjson.h>
#include <sys/resource.h>
#include <cerrno> // IWYU pragma: keep
@@ -132,6 +133,7 @@
#endif
namespace doris {
+
class PBackendService_Stub;
class PFunctionService_Stub;
@@ -179,6 +181,26 @@ Status ExecEnv::init(ExecEnv* env, const
std::vector<StorePath>& store_paths,
return env->_init(store_paths, spill_store_paths, broken_paths);
}
+// pick simdjson implementation based on CPU capabilities
+inline void init_simdjson_parser() {
+ // haswell: AVX2 (2013 Intel Haswell or later, all AMD Zen processors)
+ const auto* haswell_implementation =
simdjson::get_available_implementations()["haswell"];
+ if (!haswell_implementation ||
!haswell_implementation->supported_by_runtime_system()) {
+ // pick available implementation
+ for (const auto* implementation :
simdjson::get_available_implementations()) {
+ if (implementation->supported_by_runtime_system()) {
+ LOG(INFO) << "Using SimdJSON implementation : " <<
implementation->name() << ": "
+ << implementation->description();
+ simdjson::get_active_implementation() = implementation;
+ return;
+ }
+ }
+ LOG(WARNING) << "No available SimdJSON implementation found.";
+ } else {
+ LOG(INFO) << "Using SimdJSON Haswell implementation";
+ }
+}
+
Status ExecEnv::_init(const std::vector<StorePath>& store_paths,
const std::vector<StorePath>& spill_store_paths,
const std::set<std::string>& broken_paths) {
@@ -371,6 +393,8 @@ Status ExecEnv::_init(const std::vector<StorePath>&
store_paths,
_runtime_query_statistics_mgr->start_report_thread();
_s_ready = true;
+ init_simdjson_parser();
+
// Make aws-sdk-cpp InitAPI and ShutdownAPI called in the same thread
S3ClientFactory::instance();
return Status::OK();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]