1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-05-19 04:56:08 +02:00
Commit Graph

20 Commits

Author SHA1 Message Date
Jack O'Connor 4e25f2e094 don't default to NEON intrinsics in build.rs for big-endian targets 2023-09-19 17:18:31 -07:00
rsdy 20fd56ac0f Add `no_neon` feature to disable NEON on aarch64 2021-10-08 11:34:35 +01:00
rsdy 0a0bb7126e Implement better target detection for NEON 2021-10-07 12:41:53 +01:00
P.M f7088f24f8
comment cleanup in build.rs (#164) 2021-03-22 11:33:54 -04:00
Matthew Krupcale d91f20dd29 Start SSE2 implementation based on SSE4.1 version
Wire up basic functions and features for SSE2 support using the SSE4.1 version
as a basis without implementing the SSE2 instructions yet.

 * Cargo.toml: add no_sse2 feature
 * benches/bench.rs: wire SSE2 benchmarks
 * build.rs: add SSE2 rust intrinsics and assembly builds
 * c/Makefile.testing: add SSE2 C and assembly targets
 * c/README.md: add SSE2 to C build instructions
 * c/blake3_c_rust_bindings/build.rs: add SSE2 C rust binding builds
 * c/blake3_c_rust_bindings/src/lib.rs: add SSE2 C rust bindings
 * c/blake3_dispatch.c: add SSE2 C dispatch
 * c/blake3_impl.h: add SSE2 C function prototypes
 * c/blake3_sse2.c: add SSE2 C intrinsic file starting with SSE4.1 version
 * c/blake3_sse2_x86-64_{unix.S,windows_gnu.S,windows_msvc.asm}: add SSE2
   assembly files starting with SSE4.1 version
 * src/ffi_sse2.rs: add rust implementation using SSE2 C rust bindings
 * src/lib.rs: add SSE2 rust intrinsics and SSE2 C rust binding rust SSE2 module
   configurations
 * src/platform.rs: add SSE2 rust platform detection and dispatch
 * src/rust_sse2.rs: add SSE2 rust intrinsic file starting with SSE4.1 version
 * tools/instruction_set_support/src/main.rs: add SSE2 feature detection
2020-08-24 00:54:46 -04:00
Jack O'Connor d5e26538fc refactor build.rs
Two main changes:
- In https://github.com/BLAKE3-team/BLAKE3/issues/79 we learned that
  older versions of Clang require AVX-512 flags even to compile AVX-512
  assembly.
- If the C compiler doesn't support AVX-512, we'd still prefer to build
  the SSE4.1 and AVX2 assembly implementations, on x86_64.
2020-04-13 20:46:42 -04:00
Jack O'Connor b8cdcb1f84 automatically fall back to the pure Rust build
There are two scenarios where compiling AVX-512 C or assembly code might
not work:

1. There might not be a C compiler installed at all. Most commonly this
   is either in cross-compiling situations, or with the Windows GNU
   target.
2. The installed C compiler might not support e.g. -mavx512f, because
   it's too old.

In both of these cases, print a relevant warning, and then automatically
fall back to using the pure Rust intrinsics build.

Note that this only affects x86 targets. Other targets always use pure
Rust, unless the "neon" feature is enabled.
2020-04-01 19:13:15 -04:00
Jack O'Connor e06a0f255a refactor the Cargo feature set
The biggest change here is that assembly implementations are enabled by
default.

Added features:
- "pure" (Pure Rust, with no C or assembly implementations.)

Removed features:
- "c" (Now basically the default.)

Renamed features;
- "c_prefer_intrinsics" -> "prefer_intrinsics"
- "c_neon" -> "neon"

Unchanged:
- "rayon"
- "std" (Still the only feature on by default.)
2020-03-29 18:02:03 -04:00
Jack O'Connor 5fad419a8d add a Windows GNU AVX-512 build break workaround
The break in question only repros under --release, and we didn't start
testing a release build of the prefer-intrinsics mode until just now.
2020-03-29 01:42:41 -04:00
Jack O'Connor fdd329ba57 check for AVX-512 compiler support even when using assembly 2020-02-14 11:59:59 -05:00
Jack O'Connor fcc14c8c1b more file renaming, use underscores more consistently 2020-02-12 18:41:41 -05:00
Erik Johansson 0281f1ae16 Rename assembly files (blake3-* -> blake3_*)
This gives the assembly files the same prefix as the intrinsics files which
simplifies building when the build system should pick between the assembly and
the intrinsics files.
2020-02-12 23:08:44 +01:00
Jack O'Connor efbfa0463c integrate assembly implementations into the blake3 crate 2020-02-12 10:23:17 -05:00
Jack O'Connor caa6622afa explicitly check for -mavx512f or /arch:AVX512 support
If AVX-512 is enabled, and the local C compiler doesn't support it, the
build is going to fail. However, if we check for this explicitly, we can
give a better error message.

Fixes https://github.com/BLAKE3-team/BLAKE3/issues/6.
2020-01-13 14:34:27 -05:00
Jack O'Connor b9b1d48545 avoid using MSVC-style flags with the GNU toolchain on Windows 2020-01-13 13:34:06 -05:00
Jack O'Connor 8be609ba9d delete the previous vendored C files and repoint the Rust code 2020-01-09 09:48:52 -05:00
Jack O'Connor 9bf1020213 make the "c_avx512" feature a no-op on non-x86
This lets us enable it by default in b3sum.
2019-12-12 15:13:04 -05:00
Jack O'Connor 52ea6487f8 switch to representing CVs as words for the compression function
The portable implementation was getting slowed down by converting back
and forth between words and bytes.

I made the corresponding change on the C side first
(12a37be8b5),
and as part of this commit I'm re-vendoring the C code. I'm also
exposing a small FFI interface to C so that blake3_neon.c can link
against portable.rs rather than blake3_portable.c, see c_neon.rs.
2019-12-11 18:05:26 -05:00
Jack O'Connor 8c4cd710c3 set ARMv7 NEON compiler flags automatically 2019-12-09 21:52:24 -05:00
Jack O'Connor c7fff32392 add Rust FFI wrappers for AVX-512 and NEON 2019-12-08 21:56:10 -05:00