fhelium.compile.passes.ckks._rotation_sum
Recognize rotation sums and opt into one shared rounded quotient.
AggregateRotationSumsPass
class View source
AggregateRotationSumsPass(combine_rescale: bool = True, name: str = 'aggregate-rotation-sums')Replace compatible rotation/add trees with a shared QP quotient.
Including this pass is the caller's choice to change intermediate CKKS rounding. Matching uses SSA values and represented state. Independent intermediate users are preserved. Unknown effects, caller assignments, mismatched tables/state or partial required facts leave the region unchanged.
combine_rescale also recognizes uniformly rescaled inputs and divides the aggregate by P times the complete dropped Q group. Otherwise each original input rescale remains before the aggregate key switching.
Measured on RTX PRO 6000 Blackwell Server Edition: 128x128 @ 128x8 BSGS matrices, baby step 8, N=16384, Q=8, P=1, int64 residues, scale 2^40. Latencies include device synchronization, using resident inputs; values are medians of three process medians, with 30 samples per process.
| Execution / implementation | Matrix | Baseline (ms) | Aggregate (ms) |
|---|---|---|---|
| CUDA Graph / default fusion | PT x CT | 9.947 | 8.539 |
| CUDA Graph / default fusion | CT x CT | 17.901 | 16.444 |
| No Graph / whole operation | PT x CT | 12.702 | 11.835 |
| No Graph / whole operation | CT x CT | 21.132 | 25.383 |
Both matrix workloads improved with Graph replay. Without Graph, PT x CT improved, but CT x CT became 20.1% slower.
Attributes
| Name | Type | Default/value |
|---|---|---|
combine_rescale | bool | True |
name | str | 'aggregate-rotation-sums' |
run
method
def run(compilation): ...