Skip to content

engine: run top-k CMSHeap on FastPath to match what sketch-bench measures #811

Open

Description

@milindsrivastava1997

Part of #790.

Motivation

The MILP chooses top-k deployments using sketch-bench measurements of cms-heap-topk-fastpath-vector2d. Its cost and accuracy numbers are only valid if ASAPQuery deploys that same sketch. Today ASAPQuery deploys a different one:

Hash path Counters
sketch-bench measures (sketch-bench/src/wrappers/cms_heap/sketchlib.rs) FastPath i32
ASAPQuery deploys (CountMinSketchWithHeap → asap_sketchlib portable facade) RegularPath i64

As a result, the planned CPU cost and accuracy describe a sketch the engine does not run.

Agreed scope

Switch ASAPQuery’s top-k accumulator to CMSHeap<Vector2D<i32>, FastPath> directly. This issue is intentionally limited to ASAPQuery:

  • Keep both top-k modes. The updater inserts 1 for count; for sum, it rounds the incoming sample value at the engine boundary and passes an i32 increment to the sketch.
  • Keep the accumulator integer-only.
  • Keep JSON diagnostic output, but remove unused JSON deserialization.
  • Make byte serialization explicitly unsupported. Do not preserve or test the portable MessagePack representation.
  • Update matrix memory accounting for 4-byte i32 cells.
  • Add a focused FastPath regression/parity test and retain existing end-to-end top-k coverage.

Out of scope: Go collector/back-end wire compatibility, planner changes, persisted-state migration, and asap_sketchlib changes.

Done when

  • The engine’s CountMinSketchWithHeap runs on FastPath with i32 counters, matching cms-heap-topk-fastpath-vector2d.
  • The updater preserves count and sum top-k modes at the engine boundary.
  • FastPath behavior and existing top-k end-to-end behavior are covered by tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions