| author | |
| committer | |
| log | 6a94bcbbc6fdd4cd33981f924a7bd27773889e53 |
| tree | 1121cf2ac3561e51f05c29c255be49b881cf81c2 |
| parent | 30d392a87e7ebd51269a557b6bccbc3163e8db75 |
* 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, zen32 files changed, 3 insertions(+), 3 deletions(-)
lib/std/crypto/aes/aesni.zig+2-2| ... | @@ -101,8 +101,8 @@ pub const Block = struct { | ... | @@ -101,8 +101,8 @@ pub const Block = struct { |
| 101 | &cpu.sandybridge, &cpu.ivybridge => 8, | 101 | &cpu.sandybridge, &cpu.ivybridge => 8, |
| 102 | &cpu.haswell, &cpu.broadwell => 7, | 102 | &cpu.haswell, &cpu.broadwell => 7, |
| 103 | &cpu.cannonlake, &cpu.skylake, &cpu.skylake_avx512 => 4, | 103 | &cpu.cannonlake, &cpu.skylake, &cpu.skylake_avx512 => 4, |
| 104 | &cpu.icelake_client, &cpu.icelake_server => 6, | 104 | &cpu.icelake_client, &cpu.icelake_server, &cpu.tigerlake, &cpu.rocketlake, &cpu.alderlake => 6, |
| 105 | &cpu.znver1, &cpu.znver2 => 8, | 105 | &cpu.znver1, &cpu.znver2, &cpu.znver3 => 8, |
| 106 | else => 8, | 106 | else => 8, |
| 107 | }; | 107 | }; |
| 108 | 108 |
lib/std/crypto/aes/armcrypto.zig+1-1| ... | @@ -109,7 +109,7 @@ pub const Block = struct { | ... | @@ -109,7 +109,7 @@ pub const Block = struct { |
| 109 | /// Perform operations on multiple blocks in parallel. | 109 | /// Perform operations on multiple blocks in parallel. |
| 110 | pub const parallel = struct { | 110 | pub const parallel = struct { |
| 111 | /// The recommended number of AES encryption/decryption to perform in parallel for the chosen implementation. | 111 | /// The recommended number of AES encryption/decryption to perform in parallel for the chosen implementation. |
| 112 | pub const optimal_parallel_blocks = 8; | 112 | pub const optimal_parallel_blocks = 6; |
| 113 | 113 | ||
| 114 | /// Encrypt multiple blocks in parallel, each their own round key. | 114 | /// Encrypt multiple blocks in parallel, each their own round key. |
| 115 | pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block { | 115 | pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block { |