mirror of https://github.com/mongodb/mongo
SERVER-107041 Have default CI build with Clang LTO PGO (#41626)
GitOrigin-RevId: 12685112b052141b84371dd9f614ae316d16f1ec
This commit is contained in:
parent
cf41a80d0f
commit
1a437f9251
3
.bazelrc
3
.bazelrc
|
|
@ -323,7 +323,7 @@ common:opt --//bazel/config:dbg=False
|
|||
common:opt --//bazel/config:dbg_level=2
|
||||
common:opt --//bazel/config:debug_symbols=True
|
||||
common:opt --//bazel/config:separate_debug=False
|
||||
common:opt --//bazel/config:compiler_type=gcc
|
||||
common:opt --//bazel/config:compiler_type=clang
|
||||
common:opt --//bazel/config:linker=auto
|
||||
common:opt --//bazel/config:linkstatic=True
|
||||
common:opt --//bazel/config:build_enterprise=True
|
||||
|
|
@ -345,7 +345,6 @@ common:opt_profiled --//bazel/config:separate_debug=True
|
|||
common:opt_profiled --//bazel/config:compiler_type=clang
|
||||
common:opt_profiled --//bazel/config:dtlto=True
|
||||
common:opt_profiled --//bazel/config:pgo_profile_use=True
|
||||
common:opt_profiled --//bazel/config:bolt_profile_use=True
|
||||
common:opt_profiled --enable_platform_specific_config=true
|
||||
|
||||
--config=evg
|
||||
|
|
|
|||
|
|
@ -2305,11 +2305,13 @@ config_setting(
|
|||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "dtlto_linux_clang_enabled_fission_disabled",
|
||||
name = "dtlto_linux_clang_enabled_fission_disabled_linkstatic_enabled",
|
||||
match_all = [
|
||||
":linux_clang",
|
||||
":linkstatic_enabled",
|
||||
":dtlto_enabled",
|
||||
":fission_disabled",
|
||||
":not_s390x_or_ppc",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -2392,17 +2394,21 @@ config_setting(
|
|||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "pgo_profile_use_clang_enabled",
|
||||
name = "pgo_profile_use_clang_enabled_linkstatic_enabled",
|
||||
match_all = [
|
||||
":linux_clang",
|
||||
":linkstatic_enabled",
|
||||
":not_s390x_or_ppc",
|
||||
":pgo_profile_use_enabled",
|
||||
],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "pgo_profile_use_gcc_enabled",
|
||||
name = "pgo_profile_use_gcc_enabled_linkstatic_enabled",
|
||||
match_all = [
|
||||
":linux_gcc",
|
||||
":linkstatic_enabled",
|
||||
":not_s390x_or_ppc",
|
||||
":pgo_profile_use_enabled",
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1108,6 +1108,21 @@ def _impl(ctx):
|
|||
],
|
||||
)
|
||||
|
||||
clang_toolchain_resource_dir_feature = feature(
|
||||
name = "clang_toolchain_resource_dir",
|
||||
enabled = ctx.attr.compiler == COMPILERS.CLANG,
|
||||
flag_sets = [
|
||||
flag_set(
|
||||
actions = all_link_actions + lto_index_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = ["-resource-dir=" + CLANG_RESOURCE_DIR],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
# Some of the linux versions are missing libatomic.so.1 - this is a hack so mold will use the one contained
|
||||
# within the mongo toolchain rather than needing one installed on the machine
|
||||
mold_shared_libraries_feature = feature(
|
||||
|
|
@ -1154,14 +1169,6 @@ def _impl(ctx):
|
|||
),
|
||||
],
|
||||
),
|
||||
flag_set(
|
||||
actions = all_link_actions + lto_index_actions,
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = ["-resource-dir=" + CLANG_RESOURCE_DIR] if ctx.attr.compiler == COMPILERS.CLANG else [""],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -1424,6 +1431,7 @@ def _impl(ctx):
|
|||
debug_types_section_feature,
|
||||
no_debug_types_section_feature,
|
||||
strip_debug_feature,
|
||||
clang_toolchain_resource_dir_feature,
|
||||
] + get_common_features(ctx)
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -98,8 +98,8 @@ PGO_PROFILE_GENERATE_ENABLED = select({
|
|||
})
|
||||
|
||||
PGO_PROFILE_USE_ENABLED = select({
|
||||
"@//bazel/config:pgo_profile_use_clang_enabled": "@pgo_data//:clang_pgo_files",
|
||||
"@//bazel/config:pgo_profile_use_gcc_enabled": "@pgo_data//:gcc_pgo_files",
|
||||
"@//bazel/config:pgo_profile_use_clang_enabled_linkstatic_enabled": "@pgo_data//:clang_pgo_files",
|
||||
"@//bazel/config:pgo_profile_use_gcc_enabled_linkstatic_enabled": "@pgo_data//:gcc_pgo_files",
|
||||
"@//conditions:default": None,
|
||||
})
|
||||
|
||||
|
|
@ -109,9 +109,9 @@ PROPELLER_PROFILE_GENERATE_ENABLED = select({
|
|||
})
|
||||
|
||||
DTLTO_ENABLED = select({
|
||||
"@//bazel/config:dtlto_linux_clang_enabled_fission_disabled": True,
|
||||
"@//bazel/config:dtlto_disabled": False,
|
||||
}, no_match_error = "Distributed Thin LTO is only available for linux clang with fission disabled.")
|
||||
"@//bazel/config:dtlto_linux_clang_enabled_fission_disabled_linkstatic_enabled": True,
|
||||
"@//conditions:default": False,
|
||||
})
|
||||
|
||||
LINK_FLAGS = ["-L" + flag for flag in COMMON_LINK_FLAGS] + LINKER_LINKFLAGS
|
||||
|
||||
|
|
@ -119,8 +119,8 @@ LINK_FLAGS = ["-L" + flag for flag in COMMON_LINK_FLAGS] + LINKER_LINKFLAGS
|
|||
filegroup(
|
||||
name = "all_files",
|
||||
srcs = glob(["**/*"]) + select({
|
||||
"@//bazel/config:pgo_profile_use_clang_enabled": ["@pgo_data//:clang_pgo_files"],
|
||||
"@//bazel/config:pgo_profile_use_gcc_enabled": ["@pgo_data//:gcc_pgo_files"],
|
||||
"@//bazel/config:pgo_profile_use_clang_enabled_linkstatic_enabled": ["@pgo_data//:clang_pgo_files"],
|
||||
"@//bazel/config:pgo_profile_use_gcc_enabled_linkstatic_enabled": ["@pgo_data//:gcc_pgo_files"],
|
||||
"@//conditions:default": [],
|
||||
})
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ def _extensions_transition_impl(settings, attr):
|
|||
"""
|
||||
return {
|
||||
"//bazel/config:allocator": "system",
|
||||
"//bazel/config:dtlto": False,
|
||||
"//bazel/config:shared_archive": True,
|
||||
"//bazel/config:linkstatic": True,
|
||||
"//bazel/config:pgo_profile_use": False,
|
||||
"//bazel/config:skip_archive": True,
|
||||
"//bazel/config:asan": settings.get("//bazel/config:asan", False),
|
||||
"//bazel/config:fsan": settings.get("//bazel/config:fsan", False),
|
||||
|
|
@ -22,8 +24,10 @@ extensions_transition = transition(
|
|||
inputs = [],
|
||||
outputs = [
|
||||
"//bazel/config:allocator",
|
||||
"//bazel/config:dtlto",
|
||||
"//bazel/config:shared_archive",
|
||||
"//bazel/config:linkstatic",
|
||||
"//bazel/config:pgo_profile_use",
|
||||
"//bazel/config:skip_archive",
|
||||
"//bazel/config:asan",
|
||||
"//bazel/config:fsan",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ ALLOW_LINES = [
|
|||
"common --config=local",
|
||||
"--experimental_throttle_remote_action_building",
|
||||
"--noexperimental_throttle_remote_action_building",
|
||||
"--dtlto=False",
|
||||
"--pgo_profile_use=False",
|
||||
"--bolt_profile_use=False",
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ tasks:
|
|||
${additional_compile_targets|}
|
||||
bazel_args: >-
|
||||
--config=evg
|
||||
--config=opt_profiled
|
||||
- func: "f_expansions_write"
|
||||
- command: subprocess.exec
|
||||
params:
|
||||
|
|
@ -282,6 +283,7 @@ tasks:
|
|||
archive-dist-test-debug install-dist-test
|
||||
bazel_args: >-
|
||||
--config=evg
|
||||
--config=opt_profiled
|
||||
- func: "upload debugsymbols"
|
||||
- func: "f_expansions_write"
|
||||
- command: subprocess.exec
|
||||
|
|
@ -419,6 +421,7 @@ tasks:
|
|||
${additional_package_targets|}
|
||||
bazel_args: >-
|
||||
--config=evg
|
||||
--config=opt_profiled
|
||||
- command: subprocess.exec
|
||||
params:
|
||||
binary: bash
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ buildvariants:
|
|||
--jobs=1600
|
||||
--build_atlas=True
|
||||
--config=opt_profiled
|
||||
--bolt_profile_use=True
|
||||
unittest_library_compile_flags: >-
|
||||
--config=evg
|
||||
--linkstatic=False
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ buildvariants:
|
|||
# We need to compensate for SMT8 setting the cpu count very high and lower the amount of parallelism down
|
||||
bazel_compile_flags: >-
|
||||
--define=MONGO_DISTMOD=rhel81
|
||||
--compiler_type=gcc
|
||||
core_analyzer_distro_name: rhel81-power8-large
|
||||
resmoke_jobs_factor: 0.25
|
||||
has_packages: true
|
||||
|
|
@ -89,6 +90,7 @@ buildvariants:
|
|||
# We need to compensate for SMT8 setting the cpu count very high and lower the amount of parallelism down
|
||||
bazel_compile_flags: >-
|
||||
--define=MONGO_DISTMOD=rhel9
|
||||
--compiler_type=gcc
|
||||
core_analyzer_distro_name: rhel9-power-large
|
||||
resmoke_jobs_factor: 0.25
|
||||
has_packages: true
|
||||
|
|
@ -134,6 +136,7 @@ buildvariants:
|
|||
bazel_compile_flags: >-
|
||||
--linkstatic=False
|
||||
--define=MONGO_DISTMOD=rhel9
|
||||
--compiler_type=gcc
|
||||
compile_variant: enterprise-rhel-9-ppc64le-shared
|
||||
tasks:
|
||||
- name: compile_test_serial_TG
|
||||
|
|
@ -159,6 +162,7 @@ buildvariants:
|
|||
test_flags: --excludeWithAnyTags=incompatible_with_s390x
|
||||
bazel_compile_flags: >-
|
||||
--define=MONGO_DISTMOD=rhel83
|
||||
--compiler_type=gcc
|
||||
core_analyzer_distro_name: rhel83-zseries-large
|
||||
resmoke_jobs_max: 2
|
||||
has_packages: true
|
||||
|
|
@ -200,6 +204,7 @@ buildvariants:
|
|||
bazel_compile_flags: >-
|
||||
--linkstatic=False
|
||||
--define=MONGO_DISTMOD=rhel83
|
||||
--compiler_type=gcc
|
||||
compile_variant: enterprise-rhel-83-s390x-shared
|
||||
exec_timeout_secs: 86400 # 24 hours exec timeout
|
||||
tasks:
|
||||
|
|
@ -226,6 +231,7 @@ buildvariants:
|
|||
test_flags: --excludeWithAnyTags=incompatible_with_s390x
|
||||
bazel_compile_flags: >-
|
||||
--define=MONGO_DISTMOD=rhel9
|
||||
--compiler_type=gcc
|
||||
core_analyzer_distro_name: rhel9-zseries-large
|
||||
resmoke_jobs_max: 2
|
||||
has_packages: true
|
||||
|
|
@ -267,6 +273,7 @@ buildvariants:
|
|||
bazel_compile_flags: >-
|
||||
--linkstatic=False
|
||||
--define=MONGO_DISTMOD=rhel9
|
||||
--compiler_type=gcc
|
||||
compile_variant: enterprise-rhel-9-s390x-shared
|
||||
exec_timeout_secs: 86400 # 24 hours exec timeout
|
||||
tasks:
|
||||
|
|
|
|||
|
|
@ -91,6 +91,10 @@ variables:
|
|||
bazel_compile_flags: >-
|
||||
--remote_execution_priority=3
|
||||
--dbg=True
|
||||
--compiler_type=gcc
|
||||
--dtlto=False
|
||||
--pgo_profile_use=False
|
||||
--bolt_profile_use=False
|
||||
--opt=on
|
||||
--build_otel=True
|
||||
--build_enterprise=False
|
||||
|
|
@ -756,6 +760,8 @@ buildvariants:
|
|||
--opt=on
|
||||
--ubsan=True
|
||||
--compiler_type=clang
|
||||
--dtlto=False
|
||||
--pgo_profile_use=False
|
||||
--allocator=tcmalloc-gperf
|
||||
--separate_debug=False
|
||||
compile_variant: *rhel8-debug-ubsan-roll-back-incremental-feature-flags
|
||||
|
|
|
|||
|
|
@ -405,6 +405,8 @@ buildvariants:
|
|||
--opt=on
|
||||
--ubsan=True
|
||||
--compiler_type=clang
|
||||
--dtlto=False
|
||||
--pgo_profile_use=False
|
||||
--allocator=tcmalloc-gperf
|
||||
--separate_debug=False
|
||||
compile_variant: *rhel8-debug-ubsan-all-feature-flags
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ buildvariants:
|
|||
bazel_compile_flags: >-
|
||||
--define=MONGO_DISTMOD=ubuntu2204
|
||||
--compiler_type=clang
|
||||
--dtlto=False
|
||||
--pgo_profile_use=False
|
||||
--copt=-fsanitize-coverage=trace-pc-guard
|
||||
--linkopt=-lvoidstar
|
||||
|
||||
|
|
|
|||
|
|
@ -49,5 +49,5 @@ tests:
|
|||
- thread_level: 1
|
||||
metrics:
|
||||
- name: instructions_per_iteration_mean
|
||||
threshold_limit: 350
|
||||
threshold_limit: 13000
|
||||
bound_direction: upper
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
load("@poetry//:dependencies.bzl", "dependency")
|
||||
load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_benchmark", "mongo_cc_binary", "mongo_cc_fuzzer_test", "mongo_cc_integration_test", "mongo_cc_library", "mongo_cc_unit_test", "mongo_idl_library")
|
||||
load("//bazel/config:render_template.bzl", "render_template")
|
||||
load("//bazel/toolchains/cc/mongo_linux:mongo_toolchain_flags_v5.bzl", "CLANG_RESOURCE_DIR")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
|
|
@ -3683,7 +3682,6 @@ mongo_cc_binary(
|
|||
"//bazel/config:pgo_profile_generate_clang_enabled": [
|
||||
"-fprofile-generate=mongod_perf",
|
||||
"-fno-data-sections",
|
||||
"-resource-dir=" + CLANG_RESOURCE_DIR,
|
||||
],
|
||||
"//bazel/config:pgo_profile_generate_gcc_enabled": [
|
||||
"-fprofile-generate=mongod_perf",
|
||||
|
|
|
|||
|
|
@ -85,9 +85,11 @@ if __name__ == "__main__":
|
|||
try:
|
||||
gdb.execute("run")
|
||||
gdb.execute("frame function main")
|
||||
test_decorable()
|
||||
# TODO(SERVER-110170): Currently bugged in clang
|
||||
# test_decorable()
|
||||
test_dbname_nss()
|
||||
test_string_map()
|
||||
# TODO(SERVER-110170): Currently bugged in clang
|
||||
# test_string_map()
|
||||
test_boost_optional()
|
||||
gdb.write("TEST PASSED\n")
|
||||
except Exception as err:
|
||||
|
|
|
|||
|
|
@ -550,6 +550,10 @@ mongo_cc_library(
|
|||
"dist/absl/base/internal/unscaledcycleclock.cc",
|
||||
],
|
||||
hdrs = ABSEIL_HEADERS,
|
||||
copts = select({
|
||||
"//bazel/config:ppc_or_s390x": ["-Wno-sign-conversion"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
includes = ["dist"],
|
||||
skip_global_deps = ABSEIL_SKIP_GLOBAL_DEPS,
|
||||
deps = [
|
||||
|
|
@ -779,6 +783,10 @@ mongo_cc_library(
|
|||
"dist/absl/debugging/stacktrace.cc",
|
||||
],
|
||||
hdrs = ABSEIL_HEADERS,
|
||||
copts = select({
|
||||
"//bazel/config:ppc_or_s390x": ["-Wno-shorten-64-to-32"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
includes = ["dist"],
|
||||
skip_global_deps = ABSEIL_SKIP_GLOBAL_DEPS,
|
||||
deps = [
|
||||
|
|
@ -1943,7 +1951,14 @@ mongo_cc_library(
|
|||
],
|
||||
hdrs = ABSEIL_HEADERS,
|
||||
copts = select({
|
||||
"//bazel/config:gcc_or_clang": ["-Wno-pass-failed"],
|
||||
"//bazel/config:gcc_or_clang": [
|
||||
"-Wno-pass-failed",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"//bazel/config:ppc_or_s390x": [
|
||||
"-Wno-deprecate-lax-vec-conv-all",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
includes = ["dist"],
|
||||
|
|
|
|||
|
|
@ -79,6 +79,11 @@ mongo_cc_library(
|
|||
"-Wno-deprecated-volatile",
|
||||
"-Wno-sign-compare",
|
||||
],
|
||||
}) + select({
|
||||
"//bazel/config:ppc_or_s390x": [
|
||||
"-Wno-unused-but-set-variable",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
features = select({
|
||||
"//bazel/config:compiler_type_gcc": ["no_volatile"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue