Skip to content

Compact hop cost storage for port-to-region search#119

Merged
0hmX merged 1 commit into
mainfrom
codex/reapply-memory-fix-no-empty-skip
Jun 12, 2026
Merged

Compact hop cost storage for port-to-region search#119
0hmX merged 1 commit into
mainfrom
codex/reapply-memory-fix-no-empty-skip

Conversation

@0hmX

@0hmX 0hmX commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

This change reduces TinyHyperGraphSolver memory usage by changing how per-hop best-cost state is indexed and stored during route search.

Previously, dense candidate-cost arrays were allocated at portCount * regionCount, because hop ids were encoded directly from (portId, nextRegionId). That forced the solver to reserve dense storage for every possible port/region pair, even though each port can only transition into a small subset of incident regions.

This patch replaces that layout with compact incident-slot indexing:

  • dense hop-state arrays are sized at portCount * hopSlotStride
  • hopSlotStride is the maximum incident-region count across all ports
  • hops are keyed by (portId, incident-region-slot) for normal dense access
  • non-incident hops fall back to a small overflow Map

The result is that dense hop bookkeeping scales with actual per-port connectivity instead of global region count, which removes the dominant source of memory blowup on large port-point-pathing hypergraphs.

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tiny-hypergraph Ready Ready Preview, Comment Jun 12, 2026 6:56am

Request Review

@tscircuitbot

Copy link
Copy Markdown

Benchmark This PR

Run benchmarks by commenting on this PR:

/benchmark [benchmark.sh args...]
/benchmark --dataset <hg07|srj18> --limit <n> --solver <core|poly> --families <default|default+deep|all> --concurrency <n|auto>

Everything after /benchmark is forwarded directly to ./benchmark.sh.
The result comment shows the matching dataset from the latest stored main-branch benchmark artifact beside the PR run; main is not rerun for each PR benchmark request.

Examples:

  • /benchmark -> hg07, all samples, core solver
  • /benchmark --dataset srj18 --limit 20 -> first 20 srj18 samples
  • /benchmark --dataset srj18 --concurrency auto -> srj18 samples with runner CPU-count concurrency
  • /benchmark --sample sample002 -> one hg07 sample
  • /benchmark --limit 20 --solver poly -> first 20 hg07 samples with the poly solver
  • /benchmark --limit 40 --families default+deep -> first 40 hg07 samples with deeper candidate families

Any PR whose title contains [BENCHMARK TEST] will automatically run the benchmark workflow on PR updates.

@0hmX 0hmX changed the title [codex] Reapply memory fix without empty section skip Compact hop cost storage for port-to-region search Jun 12, 2026
@0hmX 0hmX merged commit 4715b50 into main Jun 12, 2026
9 checks passed
@tscircuitbot

Copy link
Copy Markdown

Thank you for your contribution! 🎉

PR Rating: ⭐⭐⭐
Impact: Major

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


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.

3 participants