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

chacha20: Process 4 blocks at a time in AVX2 backend #267

Merged
merged 7 commits into from
Aug 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/chacha20.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
matrix:
rust:
- 1.49.0 # MSRV
- 1.51.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand Down Expand Up @@ -53,15 +53,15 @@ jobs:
include:
# 32-bit Linux
- target: i686-unknown-linux-gnu
rust: 1.49.0 # MSRV
rust: 1.51.0 # MSRV
deps: sudo apt update && sudo apt install gcc-multilib
- target: i686-unknown-linux-gnu
rust: stable
deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit Linux
- target: x86_64-unknown-linux-gnu
rust: 1.49.0 # MSRV
rust: 1.51.0 # MSRV
- target: x86_64-unknown-linux-gnu
rust: stable
steps:
Expand Down Expand Up @@ -90,15 +90,15 @@ jobs:
include:
# 32-bit Linux
- target: i686-unknown-linux-gnu
rust: 1.49.0 # MSRV
rust: 1.51.0 # MSRV
deps: sudo apt update && sudo apt install gcc-multilib
- target: i686-unknown-linux-gnu
rust: stable
deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit Linux
- target: x86_64-unknown-linux-gnu
rust: 1.49.0 # MSRV
rust: 1.51.0 # MSRV
- target: x86_64-unknown-linux-gnu
rust: stable
steps:
Expand Down Expand Up @@ -126,15 +126,15 @@ jobs:
include:
# 32-bit Linux
- target: i686-unknown-linux-gnu
rust: 1.49.0 # MSRV
rust: 1.51.0 # MSRV
deps: sudo apt update && sudo apt install gcc-multilib
- target: i686-unknown-linux-gnu
rust: stable
deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit Linux
- target: x86_64-unknown-linux-gnu
rust: 1.49.0 # MSRV
rust: 1.51.0 # MSRV
- target: x86_64-unknown-linux-gnu
rust: stable
steps:
Expand All @@ -160,13 +160,13 @@ jobs:
include:
# ARM64
- target: aarch64-unknown-linux-gnu
rust: 1.49.0 # MSRV
rust: 1.51.0 # MSRV
- target: aarch64-unknown-linux-gnu
rust: stable

# PPC32
- target: powerpc-unknown-linux-gnu
rust: 1.49.0 # MSRV
rust: 1.51.0 # MSRV
- target: powerpc-unknown-linux-gnu
rust: stable

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.49.0 # MSRV (highest in repo)
toolchain: 1.51.0 # MSRV (highest in repo)
components: clippy
override: true
profile: minimal
Expand Down
4 changes: 2 additions & 2 deletions chacha20/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ stream cipher itself) are designed to execute in constant time.

## Minimum Supported Rust Version

Rust **1.49** or higher.
Rust **1.51** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand Down Expand Up @@ -94,7 +94,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/chacha20/badge.svg
[docs-link]: https://docs.rs/chacha20/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.49+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.51+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260049-stream-ciphers
[build-image]: https://github.com/RustCrypto/stream-ciphers/workflows/chacha20/badge.svg?branch=master&event=push
Expand Down
4 changes: 3 additions & 1 deletion chacha20/src/backend/autodetect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use core::mem::ManuallyDrop;

/// Size of buffers passed to `generate` and `apply_keystream` for this
/// backend, which operates on two blocks in parallel for optimal performance.
pub(crate) const BUFFER_SIZE: usize = BLOCK_SIZE * 2;
/// The backend consumes four blocks at a time, so that the AVX2 implementation
/// can additionally pipeline the pairs of blocks for better ILP.
pub(crate) const BUFFER_SIZE: usize = BLOCK_SIZE * 4;

cpufeatures::new!(avx2_cpuid, "avx2");

Expand Down