-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathpacked_field_mul_alpha.rs
More file actions
66 lines (56 loc) · 1.76 KB
/
packed_field_mul_alpha.rs
File metadata and controls
66 lines (56 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2024-2025 Irreducible Inc.
mod packed_field_utils;
use binius_field::{
arch::{
packed_128::*, packed_256::*, packed_512::*, packed_aes_128::*, packed_aes_256::*,
packed_aes_512::*, packed_ghash_128::*, packed_ghash_256::*, packed_ghash_512::*,
},
arithmetic_traits::MulAlpha,
};
use cfg_if::cfg_if;
use criterion::criterion_main;
use packed_field_utils::benchmark_packed_operation;
fn mul_alpha_main<T: MulAlpha>(val: T) -> T {
val.mul_alpha()
}
cfg_if! {
if #[cfg(feature = "benchmark_alternative_strategies")] {
use binius_field::{
arch::{PackedStrategy, PairwiseRecursiveStrategy, PairwiseStrategy,
PairwiseTableStrategy, },
arithmetic_traits::TaggedMulAlpha
};
fn mul_alpha_pairwise<T: TaggedMulAlpha<PairwiseStrategy>>(val: T) -> T {
val.mul_alpha()
}
fn mul_alpha_pairwise_recursive<T: TaggedMulAlpha<PairwiseRecursiveStrategy>>(val: T) -> T {
val.mul_alpha()
}
fn mul_alpha_pairwise_table<T: TaggedMulAlpha<PairwiseTableStrategy>>(val: T) -> T {
val.mul_alpha()
}
fn mul_alpha_packed<T: TaggedMulAlpha<PackedStrategy>>(val: T) -> T {
val.mul_alpha()
}
benchmark_packed_operation!(
op_name @ mul_alpha,
bench_type @ unary_op,
strategies @ (
(main, MulAlpha, mul_alpha_main),
(pairwise, TaggedMulAlpha::<PairwiseStrategy>, mul_alpha_pairwise),
(pairwise_recursive, TaggedMulAlpha::<PairwiseRecursiveStrategy>, mul_alpha_pairwise_recursive),
(pairwise_table, TaggedMulAlpha::<PairwiseTableStrategy>, mul_alpha_pairwise_table),
(packed, TaggedMulAlpha::<PackedStrategy>, mul_alpha_packed),
)
);
} else {
benchmark_packed_operation!(
op_name @ mul_alpha,
bench_type @ unary_op,
strategies @ (
(main, MulAlpha, mul_alpha_main),
)
);
}
}
criterion_main!(mul_alpha);