Orbit: Level-dependent Cost Model - #3187
Conversation
j2kun
left a comment
There was a problem hiding this comment.
Great work! Only minor nits and notes.
| const llvm::json::Array* latencies = latencyTable->getArray(opName); | ||
| // Read one op's per-level latency array (index i holds the latency at level | ||
| // i + 1). | ||
| static std::optional<SmallVector<double>> readLatencies( |
There was a problem hiding this comment.
just FYI, my intention is to eventually replace the json config/parsing code with a tablegen-based backend configuration.
There was a problem hiding this comment.
do we have a real cost model file to use? I think it would be worth checking in at some point (doesn't have to be this PR)
There was a problem hiding this comment.
Perhaps on a separate PR, I could pull in the cost modeling script used in Orbit for Lattigo? The gist of how it works is it finds the average latency of each HE operation at various levels.
On another note, it seems worthwhile to build a general cost model script for both the layout assignment, bootstrap placement, and any foreseeable optimization passes.
There was a problem hiding this comment.
Yes, please see the neighboring PR on backend configuration: #2607
IMO the better long-term design does not compute any values on the fly, as in this PR, and instead the construction of the cost model and any postprocessing is a separate script from the loading and use in the compiler.
cc88fec to
d25f10c
Compare
|
For some reason it doesn't like my coauthorship on these commits. Please amend that commit and remove my coauthorship and it should get merged. |
d25f10c to
b72a6a1
Compare
Level-dependent cost model
orbit-cost-model=PATHloads a JSON cost model whoselatencyTablemapseach key to a per-level latency array (index
i= latency at leveli + 1).All keys are required:
bootstrap,rescale: constant per-decision costs in the objective(positive-sample average / per-level max), overriding the
bootstrap-costand
rescale-costoptions.addCtCt,addCtPt,mulCtCt,mulCtPt,rotate,negate: each arrayis least-squares fitted to
cost(level) = slope * level + intercept, andevery tracked op is charged its fitted cost at its ILP-chosen input level.
Ciphertext-ciphertext vs ciphertext-plaintext is decided per op from
secretness analysis.
Solver configuration
The ILP is solved to a fixed 1% relative optimality gap with no time limit,
matching Orbit's solver setup (Gurobi
MIPGap/ CBCgapRel= 0.01).