Skip to content

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Jan 8, 2026

This replaces malloc/free with mpool in macro-op fusion, eliminating per-allocation overhead and reduces memory fragmentation.

The fixed-size pool approach trades some memory (unused slot space for short sequences) for allocation speed and cache locality. Sequences exceeding 16 instructions gracefully degrade to non-fused execution.


Summary by cubic

Switch macro-op fusion arrays to a fixed-size memory pool to cut allocation overhead and fragmentation. Fused sequences are capped at 16 ops; longer sequences fall back to non-fused execution.

  • Refactors
    • Replace malloc/free with mpool_alloc/mpool_free for ir->fuse arrays.
    • Add fuse_mp pool and FUSE_MAX_ENTRIES/FUSE_SLOT_SIZE constants.
    • Update cleanup paths: block_map_clear, block_map_destroy, rv_create failure handling, and rv_delete.

Written for commit 7dad667. Summary will update on new commits.

This replaces malloc/free with mpool in macro-op fusion, eliminating
per-allocation overhead and reduces memory fragmentation.

The fixed-size pool approach trades some memory (unused slot space for
short sequences) for allocation speed and cache locality. Sequences
exceeding 16 instructions gracefully degrade to non-fused execution.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Copy link
Contributor Author

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Details
Benchmark suite Current: 7dad667 Previous: f4aff45 Ratio
Dhrystone 1657 DMIPS 1659 DMIPS 1.00
CoreMark 1017.224 iterations/sec 1022.858 iterations/sec 1.01

This comment was automatically generated by workflow using github-action-benchmark.

@jserv jserv added this to the release-2026.1 milestone Jan 8, 2026
@jserv jserv merged commit 1591e88 into master Jan 8, 2026
23 checks passed
@jserv jserv deleted the refine-fuse branch January 8, 2026 09:39
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.

2 participants