diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2025-02-24 14:37:36 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2025-02-24 15:28:42 +0300 |
commit | 072c05250a4dabc1d62450f22f8d0b7b642575e8 (patch) | |
tree | 093836de433a9f46d47e5df836d3aa71d3d6ef6b | |
parent | 6e66aaa3ff0b341f50ac8d12e3cb98f19efe9dd7 (diff) | |
download | ydb-072c05250a4dabc1d62450f22f8d0b7b642575e8.tar.gz |
Intermediate changes
commit_hash:5157eac24cb17dd6a4bf5cce411d7796a851931b
-rw-r--r-- | contrib/libs/tbb/.yandex_meta/__init__.py | 64 | ||||
-rw-r--r-- | contrib/libs/tbb/.yandex_meta/override.nix | 14 | ||||
-rw-r--r-- | contrib/libs/tbb/patches/config.patch | 14 | ||||
-rw-r--r-- | contrib/libs/tbb/patches/ucontext-darwin.patch | 10 | ||||
-rw-r--r-- | contrib/libs/tbb/ya.make | 2 | ||||
-rw-r--r-- | yt/yt/core/misc/unittests/ema_counter_ut.cpp | 4 |
6 files changed, 106 insertions, 2 deletions
diff --git a/contrib/libs/tbb/.yandex_meta/__init__.py b/contrib/libs/tbb/.yandex_meta/__init__.py new file mode 100644 index 0000000000..21e634041d --- /dev/null +++ b/contrib/libs/tbb/.yandex_meta/__init__.py @@ -0,0 +1,64 @@ +from devtools.yamaker.modules import Linkable, Switch +from devtools.yamaker.project import CMakeNinjaNixProject + + +def post_install(self): + with self.yamakes["."] as m: + m.SRCS.remove("src/tbb/itt_notify.cpp") + m.CFLAGS.remove("-D__TBB_USE_ITT_NOTIFY") + m.after( + "SRCS", + Switch( + { + "CLANG OR CLANG_CL": Switch( + { + "ARCH_I386 OR ARCH_I686 OR ARCH_X86_64": Linkable(CFLAGS=["-mrtm", "-mwaitpkg"]), + } + ), + } + ), + ) + m.after( + "SRCS", + Switch( + default=Linkable(CFLAGS=["-DUSE_PTHREAD"]), + OS_WINDOWS=Linkable(CFLAGS=["-DUSE_WINTHREAD"]), + ), + ) + m.after( + "SRCS", + Switch( + { + "GCC": Linkable(CFLAGS=["-flifetime-dse=1", "-mrtm"]), + } + ), + ) + m.after( + "SRCS", + Switch( + { + "NOT ARCH_ARM64": Linkable( + CFLAGS=["-D__TBB_USE_ITT_NOTIFY", "-DDO_ITT_NOTIFY"], + SRCS=["src/tbb/itt_notify.cpp"], + ) + } + ), + ) + + +tbb = CMakeNinjaNixProject( + license="Apache-2.0", + arcdir="contrib/libs/tbb", + nixattr="tbb", + build_targets=["tbb"], + addincl_global={".": {"./include"}}, + copy_sources=["include/"], + disable_includes=[ + # if defined(__OpenBSD__) || __TBB_has_include(<sys/futex.h>) + "sys/futex.h", + # if __TBB_CPP17_MEMORY_RESOURCE_PRESENT + "memory_resource", + "tbb_misc.h", + ], + post_install=post_install, +) diff --git a/contrib/libs/tbb/.yandex_meta/override.nix b/contrib/libs/tbb/.yandex_meta/override.nix new file mode 100644 index 0000000000..928ebd5da0 --- /dev/null +++ b/contrib/libs/tbb/.yandex_meta/override.nix @@ -0,0 +1,14 @@ +pkgs: attrs: with pkgs; rec { + version = "2021.10.0"; + + src = fetchFromGitHub { + owner = "uxlfoundation"; + repo = "oneTBB"; + rev = "v${version}"; + hash = "sha256-HhZ4TBXqIZKkMB6bafOs8kt4EqkqStFjpoVQ3G+Rn4M="; + }; + + patches = []; + + nativeBuildInputs = [ cmake ]; +} diff --git a/contrib/libs/tbb/patches/config.patch b/contrib/libs/tbb/patches/config.patch new file mode 100644 index 0000000000..c0cdb26f28 --- /dev/null +++ b/contrib/libs/tbb/patches/config.patch @@ -0,0 +1,14 @@ +--- a/include/oneapi/tbb/detail/_config.h (index) ++++ b/include/oneapi/tbb/detail/_config.h (working tree) +@@ -246,1 +246,6 @@ +- #define __TBB_CPP20_CONCEPTS_PRESENT (_MSC_VER >= 1923 && __TBB_LANG >= 202002L) // TODO: INTEL_COMPILER? ++ #if !defined(__cpp_lib_concepts) ++ // TBB's concepts use STL's concepts ++ #define __TBB_CPP20_CONCEPTS_PRESENT 0 ++ #else ++ #define __TBB_CPP20_CONCEPTS_PRESENT (_MSC_VER >= 1923 && __TBB_LANG >= 202002L) // TODO: INTEL_COMPILER? ++ #endif +@@ -258,2 +258,1 @@ +-#define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (__TBB_LANG > 201402L) || \ +- __TBB_GLIBCXX_VERSION >= 90000 && __TBB_LANG >= 201703L) ++#define __TBB_CPP17_MEMORY_RESOURCE_PRESENT 0 diff --git a/contrib/libs/tbb/patches/ucontext-darwin.patch b/contrib/libs/tbb/patches/ucontext-darwin.patch new file mode 100644 index 0000000000..d10cb7a912 --- /dev/null +++ b/contrib/libs/tbb/patches/ucontext-darwin.patch @@ -0,0 +1,10 @@ +--- contrib/libs/tbb/src/tbb/co_context.h (index) ++++ contrib/libs/tbb/src/tbb/co_context.h (working tree) +@@ -47,6 +47,7 @@ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #endif ++ #define _XOPEN_SOURCE 700 + #endif // __APPLE__ + + #include <ucontext.h> diff --git a/contrib/libs/tbb/ya.make b/contrib/libs/tbb/ya.make index b77a858a54..f5093b99b7 100644 --- a/contrib/libs/tbb/ya.make +++ b/contrib/libs/tbb/ya.make @@ -1,4 +1,4 @@ -# Generated by devtools/yamaker from nixpkgs 22.11. +# Generated by devtools/yamaker from nixpkgs 24.05. LIBRARY() diff --git a/yt/yt/core/misc/unittests/ema_counter_ut.cpp b/yt/yt/core/misc/unittests/ema_counter_ut.cpp index e7fcbb5602..dc5d23931d 100644 --- a/yt/yt/core/misc/unittests/ema_counter_ut.cpp +++ b/yt/yt/core/misc/unittests/ema_counter_ut.cpp @@ -67,7 +67,9 @@ TEST(TEmaCounterTest, MockTime) // Result should be almost 1 (recall that the initial rate value of 0 // is remembered by EMA for some time). EXPECT_NEAR(1.0, counter.WindowRates[0], 1e-3); - EXPECT_TRUE(counter.GetRate(0, currentTimestamp)); + ASSERT_TRUE(counter.GetRate(0, currentTimestamp)); + EXPECT_NEAR(1.0, *counter.GetRate(0, currentTimestamp - sec), 1e-3); + EXPECT_NEAR(1e-3, *counter.GetRate(0, currentTimestamp + 5 * min), 1e-3); // log2(1e-3) ~ -10. Window is doubled half-decay period. for (int index = 300; index < 360; ++index, currentTimestamp += sec) { currentCount += actualRate; |