mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #5938 from yandex/update-simdjson
Updated simdjson just in case
This commit is contained in:
commit
385b517630
2
contrib/simdjson
vendored
2
contrib/simdjson
vendored
@ -1 +1 @@
|
||||
Subproject commit 2151ad7f34cf773a23f086e941d661f8a8873144
|
||||
Subproject commit 3bd3116cf8faf6d482dc31423b16533bfa2696f7
|
@ -11,8 +11,9 @@ set(SIMDJSON_SRC
|
||||
${SIMDJSON_SRC_DIR}/stage2_build_tape.cpp
|
||||
${SIMDJSON_SRC_DIR}/parsedjson.cpp
|
||||
${SIMDJSON_SRC_DIR}/parsedjsoniterator.cpp
|
||||
${SIMDJSON_SRC_DIR}/simdjson.cpp
|
||||
)
|
||||
|
||||
add_library(${SIMDJSON_LIBRARY} ${SIMDJSON_SRC})
|
||||
target_include_directories(${SIMDJSON_LIBRARY} PUBLIC "${SIMDJSON_INCLUDE_DIR}")
|
||||
target_include_directories(${SIMDJSON_LIBRARY} SYSTEM PUBLIC "${SIMDJSON_INCLUDE_DIR}")
|
||||
target_compile_options(${SIMDJSON_LIBRARY} PRIVATE -mavx2 -mbmi -mbmi2 -mpclmul)
|
||||
|
@ -14,8 +14,9 @@ namespace DB
|
||||
namespace Cpu
|
||||
{
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
inline UInt64 _xgetbv(UInt32 xcr) noexcept
|
||||
#if (defined(__x86_64__) || defined(__i386__))
|
||||
/// Our version is independent of -mxsave option, because we do dynamic dispatch.
|
||||
inline UInt64 our_xgetbv(UInt32 xcr) noexcept
|
||||
{
|
||||
UInt32 eax;
|
||||
UInt32 edx;
|
||||
@ -185,7 +186,7 @@ bool haveAVX() noexcept
|
||||
// http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-optimization-manual.pdf
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=375968
|
||||
return haveOSXSAVE() // implies haveXSAVE()
|
||||
&& (_xgetbv(0) & 6u) == 6u // XMM state and YMM state are enabled by OS
|
||||
&& (our_xgetbv(0) & 6u) == 6u // XMM state and YMM state are enabled by OS
|
||||
&& ((CpuInfo(0x1).ecx >> 28) & 1u); // AVX bit
|
||||
#else
|
||||
return false;
|
||||
@ -217,8 +218,8 @@ bool haveAVX512F() noexcept
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
// https://software.intel.com/en-us/articles/how-to-detect-knl-instruction-support
|
||||
return haveOSXSAVE() // implies haveXSAVE()
|
||||
&& (_xgetbv(0) & 6u) == 6u // XMM state and YMM state are enabled by OS
|
||||
&& ((_xgetbv(0) >> 5) & 7u) == 7u // ZMM state is enabled by OS
|
||||
&& (our_xgetbv(0) & 6u) == 6u // XMM state and YMM state are enabled by OS
|
||||
&& ((our_xgetbv(0) >> 5) & 7u) == 7u // ZMM state is enabled by OS
|
||||
&& CpuInfo(0x0).eax >= 0x7 // leaf 7 is present
|
||||
&& ((CpuInfo(0x7).ebx >> 16) & 1u); // AVX512F bit
|
||||
#else
|
||||
|
@ -7,18 +7,8 @@
|
||||
#include <Common/Exception.h>
|
||||
#include <Core/Types.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
#pragma clang diagnostic ignored "-Wnewline-eof"
|
||||
#endif
|
||||
|
||||
#include <simdjson/jsonparser.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -42,7 +32,7 @@ struct SimdJSONParser
|
||||
|
||||
bool parse(const StringRef & json) { return !json_parse(json.data, json.size, pj); }
|
||||
|
||||
using Iterator = ParsedJson::iterator;
|
||||
using Iterator = simdjson::ParsedJson::iterator;
|
||||
Iterator getRoot() { return Iterator{pj}; }
|
||||
|
||||
static bool isInt64(const Iterator & it) { return it.is_integer(); }
|
||||
@ -143,7 +133,7 @@ struct SimdJSONParser
|
||||
}
|
||||
|
||||
private:
|
||||
ParsedJson pj;
|
||||
simdjson::ParsedJson pj;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
0
|
@ -0,0 +1 @@
|
||||
SELECT JSONLength(unhex('5B30000E06D7AA5D'));
|
Loading…
Reference in New Issue
Block a user