Skip to content

Commit

Permalink
Update blake3 fixups from buck2 repo
Browse files Browse the repository at this point in the history
  • Loading branch information
cormacrelf committed Jan 13, 2025
1 parent 1cd9b7f commit 30d0c2d
Showing 1 changed file with 90 additions and 4 deletions.
94 changes: 90 additions & 4 deletions example/third-party/fixups/blake3/fixups.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,93 @@
[[buildscript]]
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under both the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree and the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree.

[buildscript.cxx_library]
name = "blake3_avx512"
srcs = ["c/blake3_avx512.c"]
buildscript = []

## The various X86 platform fixups

[platform_fixup.'cfg(target_arch = "x86_64")']
cfgs = [
"blake3_sse2_ffi",
"blake3_sse41_ffi",
"blake3_avx2_ffi",
"blake3_avx512_ffi",
]
buildscript = []

# , any(target_env = "fbcode", target_env = "gnu")
[[platform_fixup.'cfg(all(target_arch = "x86_64", any(target_os = "linux", target_os = "macos")))'.buildscript]]
[platform_fixup.'cfg(all(target_arch = "x86_64", any(target_os = "linux", target_os = "macos")))'.buildscript.cxx_library]
name = "simd_x86_unix"
srcs = [
"c/blake3.c",
"c/blake3_dispatch.c",
"c/blake3_portable.c",
"c/blake3_sse2_x86-64_unix.S",
"c/blake3_sse41_x86-64_unix.S",
"c/blake3_avx2_x86-64_unix.S",
"c/blake3_avx512_x86-64_unix.S",
]
# Older versions of Clang require these flags, even for assembly. See
# https://github.com/BLAKE3-team/BLAKE3/issues/79.
compiler_flags = ["-mavx512f", "-mavx512vl"]
headers = ["c/*.h"]
compatible_with = [
"prelude//os/constraints:linux",
"prelude//os/constraints:macos",
]

[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu"))'.buildscript]]
[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "gnu"))'.buildscript.cxx_library]
name = "simd_x86_windows_gnu"
srcs = [
"c/blake3.c",
"c/blake3_dispatch.c",
"c/blake3_portable.c",
"c/blake3_sse2_x86-64_windows_gnu.S",
"c/blake3_sse41_x86-64_windows_gnu.S",
"c/blake3_avx2_x86-64_windows_gnu.S",
"c/blake3_avx512_x86-64_windows_gnu.S",
]
# Older versions of Clang require these flags, even for assembly. See
# https://github.com/BLAKE3-team/BLAKE3/issues/79.
compiler_flags = ["-mavx512f", "-mavx512vl"]
headers = ["c/*.h"]
compatible_with = ["prelude//os/constraints:windows"]

[[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc"))'.buildscript]]
[platform_fixup.'cfg(all(target_arch = "x86_64", target_os = "windows", target_env = "msvc"))'.buildscript.cxx_library]
name = "simd_x86_windows_msvc"
srcs = [
"c/blake3.c",
"c/blake3_dispatch.c",
"c/blake3_portable.c",
"c/blake3_sse2_x86-64_windows_msvc.asm",
"c/blake3_sse41_x86-64_windows_msvc.asm",
"c/blake3_avx2_x86-64_windows_msvc.asm",
"c/blake3_avx512_x86-64_windows_msvc.asm",
]
headers = ["c/*.h"]
compatible_with = ["prelude//os/constraints:windows"]

## ARM and AArch64 fixups

[platform_fixup.'cfg(any(target_arch = "aarch64", target_arch = "arm"))']
cfgs = ["blake3_neon"]
buildscript = []

[[platform_fixup.'cfg(target_arch = "aarch64")'.buildscript]]
[platform_fixup.'cfg(target_arch = "aarch64")'.buildscript.cxx_library]
name = "simd_neon-aarch64"
srcs = ["c/blake3_neon.c"]
headers = ["c/*.h"]

[[platform_fixup.'cfg(target_arch = "arm")'.buildscript]]
[platform_fixup.'cfg(target_arch = "arm")'.buildscript.cxx_library]
name = "simd_neon-armv7"
srcs = ["c/blake3_neon.c"]
compiler_flags = ["-mfpu=neon-vfpv4", "-mfloat-abi=hard"]
headers = ["c/*.h"]

0 comments on commit 30d0c2d

Please sign in to comment.