Conversation
CodSpeed Performance ReportMerging #216 will not alter performanceComparing Summary
|
|
I've attempted to turn off the If there's still a cost to having proof logging, maybe I can look into setting it up as a build-time option so that there's definitely 0 overhead when proof logging is off. |
|
@Dekker1 could you possibly approve another workflow run and I'll see if that's made a difference? |
|
Thanks. Okay, looking at the codspeed profiling, it seems EDIT: turns out I was missing a tracing filter on the |
|
Yes, times look much better now! I think doing the filters correctly in the The PR looks pretty good to me now. I might change a few things (e.g. names) before I merge it, but we should be mostly there. Let's meet and discuss! |
|
Hi @Dekker1 just looking back over my notes from our last meeting. In terms of what still needs done for this branch, I have:
Is that everything? Also do you need access to this branch if you want to make any changes? |
This is a rewrite of my previous branch that added proof logging to Huub. My hope is that (after review/revisions) this can merged and viewed as a complete feature, since even if all inference steps are not yet checkable, the hinted proof still constitutes a useful/trimmable log for analysis purposes, and a certificate of correctness for at least the SAT solver part of the LCG solving process.
I am still relatively new to Rust and feedback would be most appreciated.
Summary of Changes
--proveoption to the CLI to enable proof logging.--prove defaultuses the name of the fzn as the file name, otherwise a file must be provided.ProofTracertrait for theEnginestruct, allowing it to capture proof information from CaDiCaLtrace!macro (withtarget: proof), to actually log the proof information, not specific to any proof format, and then uses aTargetsfilter in thetracemodule to ensure debug log information does not end up in the proof, and vice versa. Note this requires the currenttracing_subscriber::Subscriberto be exchanged for atracing_subscriber::Registry.VeriPBEventFormatterto format generic messages as syntactically correct VeriPB proof lines. Similar formatters for e.g. DRCP/DRAT should be straightforward to add later.ProofHintstruct that stores key information that needs to be remembered and logged with clauses in the proof.Notes about Proof Hint Implementation:
What is a proof hint?
At the moment a "Proof Hint" is just:
nameexplaining what algorithm/solver function created the clause (will be needed for proof checkers/justifiers).But it might be that more propagator-specific information should be added here in future.
How am I using proof hints?
A
next_proof_hintregister is stored inStateand set/queried usingProofActions(also implemented forEngineandSolverfor convenience). Propagators, reasons, conflicts, and clauses all store an associatedOption<ProofHint>within State/Engine. The way this is intended to work isModel::to_solver, and are set as thenext_proof_hintwhen eachConstraint::to_solveris called.next_proof_hintas their default hint/next_proof_hintas soon as the propagator is taken from the propagation queue so that any clauses/reasons created by this propagator can be assigned this hintnext_proof_hintimmediately before they are posted to the SAT solver.ProofTracerimplementation, the currentnext_proof_hintis always used for the actual logging message.Limitations/Improvements
I have not yet benchmarked to see if any of these changes incur a performance cost.I would try the following improvements to try to speed things up if so:
At the moment, hints are stored and created regardless of whether logging is enabled (just not written to file): probably it would be better to add checks, and storeNonein all all the places where hints are used when logging is off.Targetsfilter might be slightly slower than the originalLevelFilter, I've not yet looked into the performance-optimal Layers and Filters.tracing::Events and must be serialized/deserialized as strings (using theirFmt::Debugrepresentation). Tracing now has the option to support customValuableimplementations for user types which might improve ergonomics and eliminate the cost of stringifying, although the feature is marked as unstable/experimental.