mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
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
This commit is contained in:
parent
907f3ef887
commit
32563e6829
2 changed files with 3 additions and 3 deletions
|
|
@ -101,8 +101,8 @@ pub const Block = struct {
|
||||||
&cpu.sandybridge, &cpu.ivybridge => 8,
|
&cpu.sandybridge, &cpu.ivybridge => 8,
|
||||||
&cpu.haswell, &cpu.broadwell => 7,
|
&cpu.haswell, &cpu.broadwell => 7,
|
||||||
&cpu.cannonlake, &cpu.skylake, &cpu.skylake_avx512 => 4,
|
&cpu.cannonlake, &cpu.skylake, &cpu.skylake_avx512 => 4,
|
||||||
&cpu.icelake_client, &cpu.icelake_server => 6,
|
&cpu.icelake_client, &cpu.icelake_server, &cpu.tigerlake, &cpu.rocketlake, &cpu.alderlake => 6,
|
||||||
&cpu.znver1, &cpu.znver2 => 8,
|
&cpu.znver1, &cpu.znver2, &cpu.znver3 => 8,
|
||||||
else => 8,
|
else => 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ pub const Block = struct {
|
||||||
/// Perform operations on multiple blocks in parallel.
|
/// Perform operations on multiple blocks in parallel.
|
||||||
pub const parallel = struct {
|
pub const parallel = struct {
|
||||||
/// The recommended number of AES encryption/decryption to perform in parallel for the chosen implementation.
|
/// 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.
|
/// 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 {
|
pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue