# kissat-public-pbp Ice Lake I/O Optimization

This solver is the inherited `kissat-public-pbp` seed, a Kissat 4.0.2-derived
SAT Competition solver with VeriPB proof output.  The core CDCL search,
preprocessing, restart, learning, proof semantics, and model construction paths
are preserved.  This run focuses on low-risk throughput improvements in the
proof write path and broker wrapper.

## Parent Provenance

- Parent SHA: `501d2d0b17768d5e5cf232f94b3aab3a8eed3456e4b68f6fd84d5154dba93a38`
- Parent name: `kissat-public-pbp-seed`
- Parent family: `satcomp2024`
- Parent run/eval/job: `ab3d34b2b25f4348b7fac442a3fca221` / `2` / `eval_20260510T234934Z_a0298596`
- Parent score: validation solved 34/71, PAR-2 685.417s

## Build And Entry Points

- Build entrypoint: `./build.sh`
- Solver interface: `./solver <formula.cnf> <out.pbp>`
- Real solver binary after build: `src/build/kissat`
- Active target observed during this run: `LYMPHOSAT_TARGET=satcomp2024`

`build.sh` keeps the inherited Kissat `./configure --competition` flow and
defaults to Ice Lake tuning when `CC` is not already set:

```sh
gcc -march=icelake-server -mtune=icelake-server -fomit-frame-pointer
```

The generated Kissat build then adds the competition profile flags
`-O3 -DNDEBUG -DNOPTIONS -DQUIET`.

## Implemented Changes

- Increased the VeriPB proof output buffer from 1 MiB to 4 MiB in
  `src/src/proof.c` to reduce flush frequency on proof-heavy UNSAT runs.
- Moved the proof output buffer out of the `calloc`ed proof object and into an
  explicit uninitialized allocation.  The buffer is overwritten before use, so
  this avoids zero-filling 4 MiB at proof startup.
- Added a `write_bytes` helper that copies fixed strings and formatted integers
  into the proof buffer with `memcpy` chunks instead of byte-by-byte loops.
- Converted hot proof tokens such as `rup `, `red `, `del spec `, `+1 `,
  `>= 1`, and witness separators to length-known writes.
- Batched each printed PB literal and redundance witness into one stack-format
  operation followed by one buffered copy.  This preserves the proof text while
  reducing buffer checks and tiny write-helper calls in proof-heavy runs.
- Simplified the root `solver` wrapper to directly execute `src/build/kissat`
  after validating the two lymphosat arguments.  This removes per-invocation
  probing of multiple candidate binary names.

No proof clauses are omitted, reordered, or semantically transformed by the
final candidate.

## Changes Tested And Rejected

- Link-time optimization with `-flto=auto -fuse-linker-plugin` built but
  segfaulted immediately on local train formulas, so it was not kept.
- Extra `-fno-plt -fno-semantic-interposition` flags were stable locally but
  only produced noise-level timing differences, so they were not kept.
- Kissat `--sat` and `--unsat` compile-time variants helped isolated cases but
  hurt others and changed the general-purpose balance, so the inherited
  competition configuration was preserved.
- A no-proof SAT prepass saved only modest time on solved SAT examples and
  would impose rerun overhead on UNSAT instances that still need proofs, so it
  was rejected.
- Omitting proof deletion lines shrank one local proof but made VeriPB checking
  much slower on that proof, so deletions are preserved.
- Hash-table proof deletion normalization passed local proof checks, but a
  broker run solved one fewer instance than the lower-risk proof-I/O candidate,
  so the inherited quadratic normalization was restored.

## Validation

Local checks after the final rebuild:

- Tiny SAT CNF returned exit code 10 and the emitted model satisfied the input.
- Tiny UNSAT CNF returned exit code 20 and `veripb --cnf` verified the proof.
- Train SAT instance
  `85e0d376454ba1fe286837072de8bf32-mod2c-rand3bip-sat-200-2.shuffled-as.sat05-2459.cnf`
  returned SAT in 6.93s; an independent model checker validated all 2060
  clauses with 285 assigned variables.
- Train UNSAT instance
  `0fa28db92de1b06953c018451455d746-unsat-pbl-00150.sat05-1328.reshuffled-07.cnf`
  returned UNSAT in 0.66s; `veripb --cnf` verified the 14,416,903 byte proof in
  1.06s.  The batched-literal and dynamic-buffer proof was byte-identical to
  the pre-batching proof on this instance.
- Larger UNSAT train instance
  `1fdc28d676358b7e66bdf072dbbdba0b-sgen1-unsat-73-100.cnf` returned UNSAT in
  7.90s; `veripb --cnf` verified the 98,524,634 byte proof in 38.68s.

Broker feedback during this run:

- Proof-I/O candidate: `eval_20260511T010430Z_a3ecf926`, solved 152/400
  (`sat:93`, `unsat:59`, `timeout:135`, `solver_oom:9`,
  `prover-timeout:24`, `prover-oom:9`), with no invalid answers or crashes.
- Hash-normalization experiment: `eval_20260511T020155Z_85209410`, solved
  151/400 (`sat:91`, `unsat:60`, `timeout:141`, `solver_oom:8`,
  `prover-timeout:21`, `prover-oom:8`), with no invalid answers or crashes.
- Final candidate after reverting hash normalization:
  `eval_20260511T024646Z_3b0b00e7` is the submitted broker run for the current
  source state before PB-literal batching.
- Final candidate with PB-literal batching: broker submission pending.

## Known Risks And Next Steps

- Prover timeouts and prover OOMs remain a major scoring limiter.  Proof
  deletion and proof shrinking experiments need verifier-time validation before
  they are safe to keep.
- Some solver OOMs under the broker's 8GB training limit may be less severe at
  competition time with 32GB, so this package does not add early exits or
  artificial size cutoffs.
- The best next low-risk area is targeted profiling of proof generation and
  parser/propagation hot loops on a broader train subset, without changing
  model/proof contracts.

## Changelog

- 2026-05-11: Kept Ice Lake build defaults and inherited Kissat competition
  configuration.
- 2026-05-11: Optimized VeriPB proof output buffering and fixed-token writes.
- 2026-05-11: Batched PB literal and redundance witness formatting while
  preserving byte-identical proof text on checked examples.
- 2026-05-11: Moved the multi-megabyte proof write buffer to uninitialized
  explicit allocation to avoid startup zero-fill overhead.
- 2026-05-11: Simplified the lymphosat wrapper to dispatch directly to
  `src/build/kissat`.
- 2026-05-11: Rejected LTO, SAT/UNSAT compile variants, proofless SAT prepass,
  deletion omission, and hash deletion normalization after local and broker
  validation showed correctness or score risk.
