For longer context, check BGV: Count Add/Keyswitch in one level for OpenFHE by ZenithalHourlyRate · Pull Request #1254 · google/heir · GitHub.
We are trying to provide EvalAddCount and KeySwitchCount parameter from compiler, and we encounter the question what is the exact definition of them. Is it the number of add/keyswitch operations (then we would simply count the number of operations), or is it the number of addition/keyswitch op when the circuit is flattened. My own understanding is the second one.
They are initially defined in “Revisiting Homomorphic Encryption Schemes for Finite Fields, Section 4”, yet later attacks revealed that correctly setting them is crucial, see “Application-Aware Approximate Homomorphic Encryption: Configuring FHE for Practical Use, Introduction, Attacks by Guo et al”, which said that when the circuit is repeated addition of one ciphertext then the EvalAddCount should be set higher, yet neither of these papers gives exact way to calculate EvalAddCount.
We ask for clarification and detailed step to calculate these quantities in the documentation of these APIs in OpenFHE.
Cc @j2kun