Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bazel cpu constraints usage #1797

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions absl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,12 @@ selects.config_setting_group(
],
visibility = [":__subpackages__"],
)

selects.config_setting_group(
name = "windows_x86_64",
match_all = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
visibility = [":__subpackages__"],
)
36 changes: 4 additions & 32 deletions absl/copts/configure_copts.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ load(
"ABSL_MSVC_FLAGS",
"ABSL_MSVC_LINKOPTS",
"ABSL_MSVC_TEST_FLAGS",
"ABSL_RANDOM_HWAES_ARM32_FLAGS",
"ABSL_RANDOM_HWAES_ARM64_FLAGS",
"ABSL_RANDOM_HWAES_MSVC_X64_FLAGS",
"ABSL_RANDOM_HWAES_X64_FLAGS",
Expand Down Expand Up @@ -45,38 +44,11 @@ ABSL_DEFAULT_LINKOPTS = select({
# ABSL_RANDOM_RANDEN_COPTS blaze copts flags which are required by each
# environment to build an accelerated RandenHwAes library.
ABSL_RANDOM_RANDEN_COPTS = select({
# APPLE
":cpu_darwin_x86_64": ABSL_RANDOM_HWAES_X64_FLAGS,
":cpu_darwin": ABSL_RANDOM_HWAES_X64_FLAGS,
":cpu_x64_windows_msvc": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
":cpu_x64_windows": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
":cpu_k8": ABSL_RANDOM_HWAES_X64_FLAGS,
":cpu_ppc": ["-mcrypto"],
":cpu_aarch64": ABSL_RANDOM_HWAES_ARM64_FLAGS,
"//absl:windows_x86_64": ABSL_RANDOM_HWAES_MSVC_X64_FLAGS,
"@platforms//cpu:x86_64": ABSL_RANDOM_HWAES_X64_FLAGS,
"@platforms//cpu:ppc": ["-mcrypto"],
"@platforms//cpu:aarch64": ABSL_RANDOM_HWAES_ARM64_FLAGS,

# Supported by default or unsupported.
"//conditions:default": [],
})

# absl_random_randen_copts_init:
# Initialize the config targets based on cpu, os, etc. used to select
# the required values for ABSL_RANDOM_RANDEN_COPTS
def absl_random_randen_copts_init():
"""Initialize the config_settings used by ABSL_RANDOM_RANDEN_COPTS."""

# CPU configs.
# These configs have consistent flags to enable HWAES intsructions.
cpu_configs = [
"ppc",
"k8",
"darwin_x86_64",
"darwin",
"x64_windows_msvc",
"x64_windows",
"aarch64",
]
for cpu in cpu_configs:
native.config_setting(
name = "cpu_%s" % cpu,
values = {"cpu": cpu},
)
3 changes: 0 additions & 3 deletions absl/random/internal/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ load(
"ABSL_DEFAULT_LINKOPTS",
"ABSL_RANDOM_RANDEN_COPTS",
"ABSL_TEST_COPTS",
"absl_random_randen_copts_init",
)

default_package_visibility = [
Expand Down Expand Up @@ -321,8 +320,6 @@ cc_library(
],
)

absl_random_randen_copts_init()

cc_library(
name = "randen_hwaes",
srcs = [
Expand Down