tvl-depot/absl/random/internal/BUILD.bazel
Abseil Team e6b050212c Export of internal Abseil changes.
--
c2e2e2b21c3fe59b63279e7418c93c7289ee3e27 by Mark Barolak <mbar@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 256220326

--
3996b01f0c3eb60f72825b154dce8019b6215f1d by Derek Mauro <dmauro@google.com>:

Add GCC 4.9 test script. This will become our new minumum version and
GCC 4.8 will be removed soon.

PiperOrigin-RevId: 256160891

--
2c13aa44bc8e497ebae9abe8b8adf73c2152622d by Abseil Team <absl-team@google.com>:

[Trivial] tweak flat_hash_map.h doc comment

The comment is probably right both ways, but the lack of an "if" here seemed jarring to me.

PiperOrigin-RevId: 256089069

--
16bc03b9b30fbf08d7dc61025fa8ec4b57077be8 by Abseil Team <absl-team@google.com>:

Fix symbolization for elf files whose SYMTAB section is stripped, but have a DYNSYM section.

Previously, if we did not find a SYMTAB section, we would bail out of symbolization early, rather than checking the DYNSYM section.

PiperOrigin-RevId: 256061954

--
4c60ee329b1eeb0b0d10c4f76f282e5fbae2c5b2 by Derek Mauro <dmauro@google.com>:

Update to LLVM r363242 and Bazel 0.27.0

PiperOrigin-RevId: 256024405

--
18e1ba970d33f122026803d8ca90035b9088949d by Eric Fiselier <ericwf@google.com>:

Disable variant tests that break with P0608R3

PiperOrigin-RevId: 255975764

--
0a89858464977e86096b62476faa3b64eb94aa1d by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 255891019

--
9b7424cac66f5407f0ed74ed288bf3099a4fa330 by CJ Johnson <johnsoncj@google.com>:

Updates the implementation of InlinedVector::insert(...) to be exception safe and adds an exception safety tests for insert(...)

PiperOrigin-RevId: 255881809

--
1288f4ba3883c510d92b09437fb8b051c19aa241 by CJ Johnson <johnsoncj@google.com>:

Updates the implementation of InlinedVector::insert(...) to be exception safe and adds an exception safety tests for insert(...)

PiperOrigin-RevId: 255875277

--
39c04f3621491eaff9e2eda619718d5b5f20fbd9 by Abseil Team <absl-team@google.com>:

Use a typedef to allow building with NVCC

Without this change NVCC fails to compile compressed_tuple.h.  NVCC is relevant
because TensorFlow uses NVCC on Ubuntu and inclues abseil.

PiperOrigin-RevId: 255850176

--
e23f0309ccad69eb508ca02c9034cd4cdd740da0 by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 255787167

--
054aafcebf595077054164f1da3703124ab209b4 by Abseil Team <absl-team@google.com>:

Updates the ScopedAllocatorWorks test for InlinedVector to not rely on the byte count allocated by the standard library

In doing so, removes LegacyNextCapacityFrom(...) impl function from InlinedVector

Also applies clang-format to the test file

PiperOrigin-RevId: 255760356

--
eb05fc9f78e3a163c93f1866e9fe9a8ad0d01622 by Abseil Team <absl-team@google.com>:

Internal change

PiperOrigin-RevId: 255706834

--
97abb824417604c45d9fcbb3e4ff1aa3000836f2 by Jorg Brown <jorg@google.com>:

Enhance compatibility of abseil's strings package with nvcc.

PiperOrigin-RevId: 255688500

--
efc5b9c221ee31e15d10b35d31c8f3ae6eddaa8c by Abseil Team <absl-team@google.com>:

Follow CCTZ's lead and allow GetWeekday() and GetYearDay() to be
called with any civil-time type.  A CivilSecond, for example, has
a weekday just as much as a CivilDay does.

PiperOrigin-RevId: 255659840

--
a75acbe954457919d8c6c8f4c2339b543760b375 by Derek Mauro <dmauro@google.com>:

Increase the timeout of randen_engine_test.
It seems to timeout under TSAN often enough to justify the increase.

PiperOrigin-RevId: 255628086

--
160976ba47c7c6eb57af08e21f8eb640aa51e91b by Derek Mauro <dmauro@google.com>:

Update CMake documentation
Fixes https://github.com/abseil/abseil-cpp/issues/332

PiperOrigin-RevId: 255607313
GitOrigin-RevId: c2e2e2b21c3fe59b63279e7418c93c7289ee3e27
Change-Id: Iba4ac7ed23cbcdb22965b4958601f689be92cda4
2019-07-02 17:23:45 -04:00

658 lines
14 KiB
Python

# Internal-only implementation classes for Abseil Random
load(
"//absl:copts/configure_copts.bzl",
"ABSL_DEFAULT_COPTS",
"ABSL_DEFAULT_LINKOPTS",
"ABSL_RANDOM_RANDEN_COPTS",
"ABSL_TEST_COPTS",
"absl_random_randen_copts_init",
)
package(default_visibility = [
"//absl/random:__pkg__",
])
licenses(["notice"]) # Apache 2.0
cc_library(
name = "traits",
hdrs = ["traits.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl/random:__pkg__",
],
deps = ["//absl/base:config"],
)
cc_library(
name = "distribution_caller",
hdrs = ["distribution_caller.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl/random:__pkg__",
],
)
cc_library(
name = "distributions",
hdrs = [
"distributions.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":distribution_caller",
":fast_uniform_bits",
":fastmath",
":traits",
":uniform_helper",
"//absl/meta:type_traits",
"//absl/strings",
"//absl/types:span",
],
)
cc_library(
name = "fast_uniform_bits",
hdrs = [
"fast_uniform_bits.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
visibility = [
"//absl/random:__pkg__",
],
)
cc_library(
name = "seed_material",
srcs = [
"seed_material.cc",
],
hdrs = [
"seed_material.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":fast_uniform_bits",
"//absl/base",
"//absl/base:core_headers",
"//absl/strings",
"//absl/types:optional",
"//absl/types:span",
],
)
cc_library(
name = "pool_urbg",
srcs = [
"pool_urbg.cc",
],
hdrs = [
"pool_urbg.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = select({
"//absl:windows": [],
"//conditions:default": ["-pthread"],
}) + ABSL_DEFAULT_LINKOPTS,
deps = [
":randen",
":seed_material",
":traits",
"//absl/base",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:endian",
"//absl/random:seed_gen_exception",
"//absl/types:span",
],
)
cc_library(
name = "explicit_seed_seq",
testonly = 1,
hdrs = [
"explicit_seed_seq.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
)
cc_library(
name = "sequence_urbg",
testonly = 1,
hdrs = [
"sequence_urbg.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
)
cc_library(
name = "salted_seed_seq",
hdrs = [
"salted_seed_seq.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":seed_material",
"//absl/container:inlined_vector",
"//absl/meta:type_traits",
"//absl/types:optional",
"//absl/types:span",
],
)
cc_library(
name = "iostream_state_saver",
hdrs = ["iostream_state_saver.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/meta:type_traits",
"//absl/numeric:int128",
],
)
cc_library(
name = "distribution_impl",
hdrs = [
"distribution_impl.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":fastmath",
":traits",
"//absl/base:bits",
"//absl/base:config",
"//absl/numeric:int128",
],
)
cc_library(
name = "fastmath",
hdrs = [
"fastmath.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = ["//absl/base:bits"],
)
cc_library(
name = "nonsecure_base",
hdrs = ["nonsecure_base.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":pool_urbg",
":salted_seed_seq",
":seed_material",
"//absl/base:core_headers",
"//absl/meta:type_traits",
"//absl/strings",
"//absl/types:optional",
"//absl/types:span",
],
)
cc_library(
name = "pcg_engine",
hdrs = ["pcg_engine.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":fastmath",
":iostream_state_saver",
"//absl/base:config",
"//absl/meta:type_traits",
"//absl/numeric:int128",
],
)
cc_library(
name = "randen_engine",
hdrs = ["randen_engine.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":iostream_state_saver",
":randen",
"//absl/meta:type_traits",
],
)
cc_library(
name = "platform",
hdrs = [
"randen_traits.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
textual_hdrs = [
"randen-keys.inc",
"platform.h",
],
)
cc_library(
name = "randen",
srcs = [
"randen.cc",
],
hdrs = [
"randen.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":platform",
":randen_hwaes",
":randen_slow",
"//absl/base",
],
)
cc_library(
name = "randen_slow",
srcs = ["randen_slow.cc"],
hdrs = ["randen_slow.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":platform",
],
)
absl_random_randen_copts_init()
cc_library(
name = "randen_hwaes",
srcs = [
"randen_detect.cc",
],
hdrs = [
"randen_detect.h",
"randen_hwaes.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":platform",
":randen_hwaes_impl",
],
)
# build with --save_temps to see assembly language output.
cc_library(
name = "randen_hwaes_impl",
srcs = [
"randen_hwaes.cc",
"randen_hwaes.h",
],
copts = ABSL_DEFAULT_COPTS + ABSL_RANDOM_RANDEN_COPTS + select({
"//absl:windows": [],
"//conditions:default": ["-Wno-pass-failed"],
}),
# copts in RANDEN_HWAES_COPTS can make this target unusable as a module
# leading to a Clang diagnostic. Furthermore, it only has a private header
# anyway and thus there wouldn't be any gain from using it as a module.
features = ["-header_modules"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [":platform"],
)
cc_binary(
name = "gaussian_distribution_gentables",
srcs = [
"gaussian_distribution_gentables.cc",
],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/base:core_headers",
"//absl/random:distributions",
],
)
cc_library(
name = "distribution_test_util",
testonly = 1,
srcs = [
"chi_square.cc",
"distribution_test_util.cc",
],
hdrs = [
"chi_square.h",
"distribution_test_util.h",
],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/base",
"//absl/base:core_headers",
"//absl/strings",
"//absl/strings:str_format",
"//absl/types:span",
],
)
# Common tags for tests, etc.
ABSL_RANDOM_NONPORTABLE_TAGS = [
"no_test_android_arm",
"no_test_android_arm64",
"no_test_android_x86",
"no_test_darwin_x86_64",
"no_test_ios_x86_64",
"no_test_loonix",
"no_test_msvc_x64",
"no_test_wasm",
]
cc_test(
name = "traits_test",
size = "small",
srcs = ["traits_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":traits",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "distribution_impl_test",
size = "small",
srcs = ["distribution_impl_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":distribution_impl",
"//absl/base:bits",
"//absl/flags:flag",
"//absl/numeric:int128",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "distribution_test_util_test",
size = "small",
srcs = ["distribution_test_util_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":distribution_test_util",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "fastmath_test",
size = "small",
srcs = ["fastmath_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":fastmath",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "explicit_seed_seq_test",
size = "small",
srcs = ["explicit_seed_seq_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":explicit_seed_seq",
"//absl/random:seed_sequences",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "salted_seed_seq_test",
size = "small",
srcs = ["salted_seed_seq_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":salted_seed_seq",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "chi_square_test",
size = "small",
srcs = [
"chi_square_test.cc",
],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":distribution_test_util",
"//absl/base:core_headers",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "fast_uniform_bits_test",
size = "small",
srcs = [
"fast_uniform_bits_test.cc",
],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":fast_uniform_bits",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "nonsecure_base_test",
size = "small",
srcs = [
"nonsecure_base_test.cc",
],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":nonsecure_base",
"//absl/random",
"//absl/random:distributions",
"//absl/random:seed_sequences",
"//absl/strings",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "seed_material_test",
size = "small",
srcs = ["seed_material_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":seed_material",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "pool_urbg_test",
size = "small",
srcs = [
"pool_urbg_test.cc",
],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":pool_urbg",
"//absl/meta:type_traits",
"//absl/types:span",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "pcg_engine_test",
size = "medium", # Trying to measure accuracy.
srcs = ["pcg_engine_test.cc"],
copts = ABSL_TEST_COPTS,
flaky = 1,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":explicit_seed_seq",
":pcg_engine",
"//absl/time",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "randen_engine_test",
size = "medium",
srcs = [
"randen_engine_test.cc",
],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":explicit_seed_seq",
":randen_engine",
"//absl/base",
"//absl/strings",
"//absl/time",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "randen_test",
size = "small",
srcs = ["randen_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":randen",
"//absl/meta:type_traits",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "randen_slow_test",
size = "small",
srcs = ["randen_slow_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":randen_slow",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "randen_hwaes_test",
size = "small",
srcs = ["randen_hwaes_test.cc"],
copts = ABSL_TEST_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
tags = ABSL_RANDOM_NONPORTABLE_TAGS,
deps = [
":platform",
":randen_hwaes",
":randen_hwaes_impl", # build_cleaner: keep
"//absl/base",
"//absl/strings:str_format",
"@com_google_googletest//:gtest",
],
)
cc_library(
name = "nanobenchmark",
srcs = ["nanobenchmark.cc"],
linkopts = ABSL_DEFAULT_LINKOPTS,
textual_hdrs = ["nanobenchmark.h"],
deps = [
":platform",
":randen_engine",
"//absl/base",
],
)
cc_library(
name = "uniform_helper",
hdrs = ["uniform_helper.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":distribution_impl",
":fast_uniform_bits",
":iostream_state_saver",
":traits",
"//absl/base:core_headers",
"//absl/meta:type_traits",
],
)
cc_test(
name = "nanobenchmark_test",
size = "small",
srcs = ["nanobenchmark_test.cc"],
flaky = 1,
linkopts = ABSL_DEFAULT_LINKOPTS,
tags = [
"benchmark",
"no_test_ios_x86_64",
"no_test_loonix", # Crashing.
],
deps = [
":nanobenchmark",
"//absl/base",
"//absl/strings",
],
)
cc_test(
name = "randen_benchmarks",
size = "medium",
srcs = ["randen_benchmarks.cc"],
copts = ABSL_TEST_COPTS + ABSL_RANDOM_RANDEN_COPTS,
flaky = 1,
linkopts = ABSL_DEFAULT_LINKOPTS,
tags = ABSL_RANDOM_NONPORTABLE_TAGS + ["benchmark"],
deps = [
":nanobenchmark",
":platform",
":randen",
":randen_engine",
":randen_hwaes",
":randen_hwaes_impl",
":randen_slow",
"//absl/base",
"//absl/strings",
],
)
cc_test(
name = "iostream_state_saver_test",
size = "small",
srcs = ["iostream_state_saver_test.cc"],
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":iostream_state_saver",
"@com_google_googletest//:gtest_main",
],
)