Commit bb3b13b
authored
ghash: base degree of parallelism on
We currently choose a value of 1 for the software backend, or 8 if we're
using intrinsics, where the latter can best exploit the powers-of-H
optimization (or going forward, the R/F algorithm in #290).
The "parallelism" here represents the number of blocks we process in a
single logical operation from the API perspective. The actual processing
is also parallel in that it uses ILP, but blocks are still ultimately
processed in sequence. However, the aforementioned optimizations
eliminate some of the computations we'd otherwise perform processing
input a block-at-a-time, like deferring or even completely eliminating
Montgomery reductions.
All that said, `ghash` was unconditionally always using 8-block inputs,
even if the software backend was in use. The software backend now
implements powers-of-H for consistency, but it seems unlikely to provide
much benefit, especially compared to the benefit for when intrinsics are
available, and that still holds for the R/F algorithm as explicitly
stated in the paper.
This re-exports a `polyval::DEFAULT_PARALLELISM` constant which is
conditionally set to 1 or 8 depending on if the `soft` backend is in
use, and has `ghash` use that to decide its degree of parallelism
(which, ultimately, is selecting the degree of parallelism to use in the
`polyval` core it's built on)polyval (#291)1 parent 6433e64 commit bb3b13b
2 files changed
Lines changed: 14 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 43 | + | |
| 44 | + | |
49 | 45 | | |
50 | | - | |
| 46 | + | |
51 | 47 | | |
52 | 48 | | |
53 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
50 | | - | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
59 | | - | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
0 commit comments