Skip to content

feat(search): exact residual cascade CPU core (chain 2/3) - #29

Open
christopherkarani wants to merge 1 commit into
chain/1-extract-selectionfrom
chain/2-residual-core
Open

feat(search): exact residual cascade CPU core (chain 2/3)#29
christopherkarani wants to merge 1 commit into
chain/1-extract-selectionfrom
chain/2-residual-core

Conversation

@christopherkarani

Copy link
Copy Markdown
Owner

Chain Info

Chain: 2 of 3
Strategy: feature-branch-chain
Base: chain/1-extract-selection (merge 1 first)

Summary

  • Adds the exact residual-bound cascade: fp32 PCA projection head built in double precision (cblas_dsyrk + deterministic Jacobi), Pythagorean tail-norm lower bounds, parallel seed selection, exact survivor rescoring, and top-k resolution.
  • VectorBuffer gains the cache-invalidation hook the cascade requires.
  • No GPU routing yet: this slice is CPU-only and compiles green standalone.

Changes

File Change
Sources/MetalANNSCore/ResidualCascadeMath.swift Double-precision PCA, Jacobi eigendecomposition, query bounds
Sources/MetalANNSCore/ResidualCascadeSelection.swift Exact rescoring + top-k resolution
Sources/MetalANNSCore/ResidualCascade.swift Cascade orchestration, eligibility, lazy GPU-plane cache scaffolding
Sources/MetalANNSCore/VectorBuffer.swift Cache invalidation hook (+3 lines)
Tests/MetalANNSTests/ResidualCascadeTests.swift Brute-force equivalence across metrics/dims/seeds, invalidation tests

Lines

Diff: +1774 / −0 (core feature slice; split per chain plan)

Test Plan

  • Release build clean on this branch alone
  • Full suite: 325 tests / 71 suites pass
  • Residual cascade is brute-force exact across cosine/L2/inner-product, multiple dims/seeds

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant