fhelium.compile.passes.ckks._rotation_hoisting
Share key-switch preparation across data-dependent rotation groups.
RotationHoistingPass
class View source
RotationHoistingPass(max_group_size: int | None = None, name: str = 'rotation-hoisting')Share preparation among rotations of the same ciphertext data.
A rotation has the form Finish(c0, Prepare(c1, tables), key, step). Rotations with the same input SSA value, parameter operands, and compatible attributes can share Prepare despite interleaved consumers or rotations of other inputs. The emitted RotateManyOp retains each key operand, result type, and rotation step. Its common output domain and execution attributes must agree across the group.
Matching and placement stay inside a block's known-pure effect interval. Unknown operations, effects, control flow, and assigned implementations end that interval; known nested regions are processed independently. Every group is placed after its computed operands and before its first result use. Material references may move within the interval, but producer computations are not speculated or reordered.
max_group_size bounds the number of results produced together. Grouping can extend result lifetimes.
Attributes
| Name | Type | Default/value |
|---|---|---|
max_group_size | int | None | None |
name | str | 'rotation-hoisting' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...Identify compatible rotations and place legal multi-result groups.