Do CKKS evalSumRows/Cols implicitly use hoisting for rotations?

Hi, I was trying to understand whether the EvalSumRows and EvalSumCols functions implemented in OpenFHE for CKKS implicitly leverage hoisting.

By looking at the code, I found thatEvalFastRotate, which does use hoisting as per the documentation, calls EvalFastKeySwitchCore ( openfhe-development/src/pke/lib/schemebase/base-leveledshe.cpp at main · openfheorg/openfhe-development · GitHub ).

On the other hand,EvalSumRows and EvalSumColsperform the following sequence of calls: EvalSum2nComplexRowsEvalAutomorphismKeySwitchInPlaceKeySwitchCoreEvalFastKeySwitchCore ( openfhe-development/src/pke/lib/keyswitch/keyswitch-hybrid.cpp at main · openfheorg/openfhe-development · GitHub ).

Does this mean that hoisting is also leveraged under the hood for these two functions?

Thank for your response.

No, hoisting does not give any benefit for EvalSumRows/Cols as each rotation is applied to a different ciphertext. The confusion comes from the fact that the key switching operation is broken down into more granular subroutines such as EvalFastKeySwitchCore and EvalKeySwitchPrecomputeCore. In the case of hoisted rotations, EvalKeySwitchPrecomputeCore is called once EvalFastKeySwitchCore is called multiple times. But in the case KeySwitchCore, both of them are called once. In summary, the same subroutine is used in both hoisted and non-hoisted scenarios.

1 Like