Commit c78ff365 authored by Kagami Sascha Rosylight's avatar Kagami Sascha Rosylight
Browse files

Bug 1786069 - Update libjxl and highway r=tnikkel

parent 8c44b387
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ EXPORTS.hwy += [
EXPORTS.hwy.ops += [
    "/third_party/highway/hwy/ops/arm_neon-inl.h",
    "/third_party/highway/hwy/ops/arm_sve-inl.h",
    "/third_party/highway/hwy/ops/emu128-inl.h",
    "/third_party/highway/hwy/ops/generic_ops-inl.h",
    "/third_party/highway/hwy/ops/rvv-inl.h",
    "/third_party/highway/hwy/ops/scalar-inl.h",
+2 −2
Original line number Diff line number Diff line
@@ -20,11 +20,11 @@ origin:

  # Human-readable identifier for this version/release
  # Generally "version NNN", "tag SSS", "bookmark SSS"
  release: commit f13e3b956eb226561ac79427893ec0afd66f91a8 (2022-02-15T18:19:21Z).
  release: 7f2e26854086fba4255220fd6c77e9141f1f87cc

  # Revision to pull in
  # Must be a long or short commit SHA (long preferred)
  revision: f13e3b956eb226561ac79427893ec0afd66f91a8
  revision: 7f2e26854086fba4255220fd6c77e9141f1f87cc

  # The package's license, where possible using the mnemonic from
  # https://spdx.org/licenses/
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ SOURCES += [
    "/third_party/jpeg-xl/lib/jxl/enc_bit_writer.cc",
    "/third_party/jpeg-xl/lib/jxl/entropy_coder.cc",
    "/third_party/jpeg-xl/lib/jxl/epf.cc",
    "/third_party/jpeg-xl/lib/jxl/exif.cc",
    "/third_party/jpeg-xl/lib/jxl/fast_dct.cc",
    "/third_party/jpeg-xl/lib/jxl/fields.cc",
    "/third_party/jpeg-xl/lib/jxl/frame_header.cc",
+2 −2
Original line number Diff line number Diff line
@@ -10,9 +10,9 @@ origin:

  url: https://github.com/libjxl/libjxl

  release: 59f7d19e454bc5e1edd692187e1178f5926fdfd9 (2022-07-28T11:13:01Z).
  release: bb8eac5d6acec223e44cf8cc72ae02f0816de311

  revision: 59f7d19e454bc5e1edd692187e1178f5926fdfd9
  revision: bb8eac5d6acec223e44cf8cc72ae02f0816de311

  license: Apache-2.0

+104 −12
Original line number Diff line number Diff line
load("@bazel_skylib//lib:selects.bzl", "selects")

load("@rules_cc//cc:defs.bzl", "cc_test")
package(default_visibility = ["//visibility:public"])
package(
    default_visibility = ["//visibility:public"],
)

licenses(["notice"])

@@ -14,10 +16,33 @@ config_setting(
)

config_setting(
    name = "compiler_msvc",
    name = "compiler_clangcl",
    flag_values = {"@bazel_tools//tools/cpp:compiler": "lexan"},
)

config_setting(
    name = "compiler_msvc_actual",
    flag_values = {"@bazel_tools//tools/cpp:compiler": "msvc"},
)

# The above is insufficient for Bazel on Windows, which does not seem to
# detect/set a compiler flag. This workaround prevents compile errors due to
# passing clang-only warning flags to MSVC.
config_setting(
    name = "compiler_msvc_cpu",
    values = {
        "cpu": "x64_windows",
    },
)

selects.config_setting_group(
    name = "compiler_msvc",
    match_any = [
        ":compiler_msvc_actual",
        ":compiler_msvc_cpu",
    ],
)

config_setting(
    name = "compiler_emscripten",
    values = {"cpu": "wasm32"},
@@ -54,8 +79,8 @@ CLANG_GCC_COPTS = [
    "-Wunreachable-code",
]

# Additional warnings only supported by Clang
CLANG_ONLY_COPTS = [
# Warnings supported by Clang and Clang-cl
CLANG_OR_CLANGCL_OPTS = CLANG_GCC_COPTS + [
    "-Wfloat-overflow-conversion",
    "-Wfloat-zero-conversion",
    "-Wfor-loop-analysis",
@@ -73,11 +98,19 @@ CLANG_ONLY_COPTS = [
    "-Wunused-comparison",
]

# Warnings only supported by Clang, but not Clang-cl
CLANG_ONLY_COPTS = CLANG_OR_CLANGCL_OPTS + [
    # Do not treat the third_party headers as system headers when building
    # highway - the errors are pertinent.
    "--no-system-header-prefix=third_party/highway",
]

COPTS = select({
    ":compiler_msvc": [],
    ":compiler_gcc": CLANG_GCC_COPTS,
    ":compiler_clangcl": CLANG_OR_CLANGCL_OPTS,
    # Default to clang because compiler detection only works in Bazel
    "//conditions:default": CLANG_GCC_COPTS + CLANG_ONLY_COPTS,
    "//conditions:default": CLANG_ONLY_COPTS,
}) + select({
    "@platforms//cpu:riscv64": [
        "-march=rv64gcv1p0",
@@ -87,6 +120,12 @@ COPTS = select({
    ],
})

DEFINES = select({
    ":compiler_msvc": ["HWY_SHARED_DEFINE"],
    ":compiler_clangcl": ["HWY_SHARED_DEFINE"],
    "//conditions:default": [],
})

# Unused on Bazel builds, where this is not defined/known; Copybara replaces
# usages with an empty list.
COMPAT = [
@@ -102,6 +141,8 @@ cc_library(
    name = "hwy",
    srcs = [
        "hwy/aligned_allocator.cc",
        "hwy/per_target.cc",
        "hwy/print.cc",
        "hwy/targets.cc",
    ],
    # Normal headers with include guards
@@ -110,10 +151,12 @@ cc_library(
        "hwy/base.h",
        "hwy/cache_control.h",
        "hwy/detect_compiler_arch.h",  # private
        "hwy/highway_export.h",
        "hwy/print.h",
    ],
    compatible_with = [],
    copts = COPTS,
    defines = DEFINES,
    local_defines = ["hwy_EXPORTS"],
    textual_hdrs = [
        # These are textual because config macros influence them:
        "hwy/detect_targets.h",  # private
@@ -121,8 +164,12 @@ cc_library(
        # End of list
        "hwy/highway.h",  # public
        "hwy/foreach_target.h",  # public
        "hwy/per_target.h",  # public
        "hwy/print-inl.h",  # public
        "hwy/highway_export.h",  # public
        "hwy/ops/arm_neon-inl.h",
        "hwy/ops/arm_sve-inl.h",
        "hwy/ops/emu128-inl.h",
        "hwy/ops/generic_ops-inl.h",
        "hwy/ops/scalar-inl.h",
        "hwy/ops/set_macros-inl.h",
@@ -140,9 +187,24 @@ cc_library(
    }),
)

cc_library(
    name = "algo",
    compatible_with = [],
    copts = COPTS,
    textual_hdrs = [
        "hwy/contrib/algo/copy-inl.h",
        "hwy/contrib/algo/find-inl.h",
        "hwy/contrib/algo/transform-inl.h",
    ],
    deps = [
        ":hwy",
    ],
)

cc_library(
    name = "dot",
    compatible_with = [],
    copts = COPTS,
    textual_hdrs = [
        "hwy/contrib/dot/dot-inl.h",
    ],
@@ -160,6 +222,8 @@ cc_library(
        "hwy/contrib/image/image.h",
    ],
    compatible_with = [],
    copts = COPTS,
    local_defines = ["hwy_contrib_EXPORTS"],
    deps = [
        ":hwy",
    ],
@@ -168,6 +232,7 @@ cc_library(
cc_library(
    name = "math",
    compatible_with = [],
    copts = COPTS,
    textual_hdrs = [
        "hwy/contrib/math/math-inl.h",
    ],
@@ -181,6 +246,9 @@ cc_library(
    name = "hwy_test_util",
    srcs = ["hwy/tests/test_util.cc"],
    hdrs = ["hwy/tests/test_util.h"],
    compatible_with = [],
    copts = COPTS,
    local_defines = ["hwy_test_EXPORTS"],
    textual_hdrs = [
        "hwy/tests/test_util-inl.h",
        "hwy/tests/hwy_gtest.h",
@@ -196,12 +264,16 @@ cc_library(
    name = "nanobenchmark",
    srcs = ["hwy/nanobenchmark.cc"],
    hdrs = ["hwy/nanobenchmark.h"],
    compatible_with = [],
    copts = COPTS,
    local_defines = ["hwy_EXPORTS"],
    deps = [":hwy"],
)

cc_binary(
    name = "benchmark",
    srcs = ["hwy/examples/benchmark.cc"],
    copts = COPTS,
    deps = [
        ":hwy",
        ":nanobenchmark",
@@ -212,6 +284,8 @@ cc_library(
    name = "skeleton",
    srcs = ["hwy/examples/skeleton.cc"],
    hdrs = ["hwy/examples/skeleton.h"],
    copts = COPTS,
    local_defines = ["hwy_EXPORTS"],
    textual_hdrs = ["hwy/examples/skeleton-inl.h"],
    deps = [
        ":hwy",
@@ -226,6 +300,9 @@ cc_binary(

# path, name
HWY_TESTS = [
    ("hwy/contrib/algo/", "copy_test"),
    ("hwy/contrib/algo/", "find_test"),
    ("hwy/contrib/algo/", "transform_test"),
    ("hwy/contrib/dot/", "dot_test"),
    ("hwy/contrib/image/", "image_test"),
    ("hwy/contrib/math/", "math_test"),
@@ -238,20 +315,40 @@ HWY_TESTS = [
    ("hwy/", "targets_test"),
    ("hwy/tests/", "arithmetic_test"),
    ("hwy/tests/", "blockwise_test"),
    ("hwy/tests/", "blockwise_shift_test"),
    ("hwy/tests/", "combine_test"),
    ("hwy/tests/", "compare_test"),
    ("hwy/tests/", "compress_test"),
    ("hwy/tests/", "convert_test"),
    ("hwy/tests/", "crypto_test"),
    ("hwy/tests/", "demote_test"),
    ("hwy/tests/", "float_test"),
    ("hwy/tests/", "if_test"),
    ("hwy/tests/", "interleaved_test"),
    ("hwy/tests/", "logical_test"),
    ("hwy/tests/", "mask_test"),
    ("hwy/tests/", "mask_mem_test"),
    ("hwy/tests/", "memory_test"),
    ("hwy/tests/", "mul_test"),
    ("hwy/tests/", "reduction_test"),
    ("hwy/tests/", "reverse_test"),
    ("hwy/tests/", "shift_test"),
    ("hwy/tests/", "swizzle_test"),
    ("hwy/tests/", "test_util_test"),
]

HWY_TEST_COPTS = select({
    ":compiler_msvc": [],
    "//conditions:default": [
        # gTest triggers this warning (which is enabled by the
        # extra-semi in COPTS), so we need to disable it here,
        # but it's still enabled for :hwy.
        "-Wno-c++98-compat-extra-semi",
    ],
})

HWY_TEST_DEPS = [
    ":algo",
    ":dot",
    ":hwy",
    ":hwy_test_util",
@@ -272,12 +369,7 @@ HWY_TEST_DEPS = [
            srcs = [
                subdir + test + ".cc",
            ],
            copts = COPTS + [
                # gTest triggers this warning (which is enabled by the
                # extra-semi in COPTS), so we need to disable it here,
                # but it's still enabled for :hwy.
                "-Wno-c++98-compat-extra-semi",
            ],
            copts = COPTS + HWY_TEST_COPTS,
            features = select({
                "@platforms//cpu:riscv64": ["fully_static_link"],
                "//conditions:default": [],
Loading