diff options
| author | Frank Denis <124872+jedisct1@users.noreply.github.com> | 2022-11-07 12:28:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-07 12:28:37 +0100 |
| commit | 32563e68294f3ee9286e28574e1bb58e89366909 (patch) | |
| tree | 3c2939548fd30d84b8fa9ef6d636c09cfa370e2e | |
| parent | 907f3ef887776dc7e0ed3661230e5c11973ad6a6 (diff) | |
| download | zig-32563e68294f3ee9286e28574e1bb58e89366909.tar.gz zig-32563e68294f3ee9286e28574e1bb58e89366909.zip | |
crypto.core.aes: process 6 block in parallel instead of 8 on aarch64 (#13473)
* crypto.core.aes: process 6 block in parallel instead of 8 on aarch64
At least on Apple Silicon, this is slightly faster than 8 blocks.
* AES: add parallel blocks for tigerlake, rocketlake, alderlake, zen3
| -rw-r--r-- | lib/std/crypto/aes/aesni.zig | 4 | ||||
| -rw-r--r-- | lib/std/crypto/aes/armcrypto.zig | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/crypto/aes/aesni.zig b/lib/std/crypto/aes/aesni.zig index 27bda52c7b..c513e71478 100644 --- a/lib/std/crypto/aes/aesni.zig +++ b/lib/std/crypto/aes/aesni.zig @@ -101,8 +101,8 @@ pub const Block = struct { &cpu.sandybridge, &cpu.ivybridge => 8, &cpu.haswell, &cpu.broadwell => 7, &cpu.cannonlake, &cpu.skylake, &cpu.skylake_avx512 => 4, - &cpu.icelake_client, &cpu.icelake_server => 6, - &cpu.znver1, &cpu.znver2 => 8, + &cpu.icelake_client, &cpu.icelake_server, &cpu.tigerlake, &cpu.rocketlake, &cpu.alderlake => 6, + &cpu.znver1, &cpu.znver2, &cpu.znver3 => 8, else => 8, }; diff --git a/lib/std/crypto/aes/armcrypto.zig b/lib/std/crypto/aes/armcrypto.zig index b3ff7ff217..52b7433d11 100644 --- a/lib/std/crypto/aes/armcrypto.zig +++ b/lib/std/crypto/aes/armcrypto.zig @@ -109,7 +109,7 @@ pub const Block = struct { /// Perform operations on multiple blocks in parallel. pub const parallel = struct { /// The recommended number of AES encryption/decryption to perform in parallel for the chosen implementation. - pub const optimal_parallel_blocks = 8; + pub const optimal_parallel_blocks = 6; /// Encrypt multiple blocks in parallel, each their own round key. pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block { |
