feat(compiler): pack dynamic pool allocs by lifetime (hip-pool-allocs) - #570
Open
fhanuman wants to merge 2 commits into
Open
feat(compiler): pack dynamic pool allocs by lifetime (hip-pool-allocs)#570fhanuman wants to merge 2 commits into
fhanuman wants to merge 2 commits into
Conversation
Default `hip-pool-allocs` to lifetime-only dynamic packing: each runtime-sized alloc is its own group, and a cross-group lifetime coloring lets any two lifetime-disjoint allocs share one pool slab regardless of their dynamic dimensions. A slab's cost is the MAX of its concurrently-live members rather than the SUM of every alloc routed to it. Only provably-disjoint groups ever share, so overlapping their address ranges is always safe (no mis-pairing). Small (non-alignment-multiple) allocs ride the same path; a slab that holds one rounds its width up so the next slab stays aligned. Keep the previous strategy as a fallback (`lifetime-only=false`): group by dynamic dimension and best-fit-pack the integer static factors within a group before the same cross-group coloring, sending non-multiple allocs to per-size byte-space bins. It is strictly <= the default's per-group footprint and never mis-pairs. Rework the debug-only fragmentation report to compare the emitted dynamic-pool coefficient against the max-load lower bound (single dynamic factor only), which is the meaningful signal under the new default. Tests: `hip-pool-allocs-lifetime-only.mlir` covers slab sharing across different dynamic dims, the overlap-must-not-share guardrail, and the small-alloc round-up; `hip-pool-allocs-dynamic-binning.mlir` now covers the fallback path; the fragmentation-report expectations track the new remark. Validated end-to-end on GPU with a byte-identical pool. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Made-with: Cursor
fhanuman
requested review from
amd-mingw,
edelaye,
qianglin-amd and
wcy123
as code owners
July 27, 2026 21:00
|
Thanks for opening a PR! This project follows LLVM's incremental-development and AI-tool-use Before requesting review, please check that:
Reviewers are assigned through |
Collaborator
Author
|
/run-test models=all |
Contributor
|
ROCm OGA CI finished with result: SUCCESS.
|
L2 Accuracy Results (EP vs CPU)
Threshold: 0.01 | Run: 3432 - Commit: |
MorphiZen EP Performance Results
EPContext Export Performance
EPContext Import Performance
OGA Benchmark Results
OGA Wheel Smoke (Python benchmark_e2e.py)
Run: 3432 - Commit: |
Collaborator
Author
|
/run-test models=all |
Contributor
|
ROCm OGA CI finished with result: UNSTABLE.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of closed PR #469. Its precursor, #468, is already merged into
main.Problem
Dynamic allocs can currently share a pool slab only when they have the same dynamic dimensions. Two lifetime-disjoint allocs with different dynamic dimensions therefore consume the sum of their footprints even though they are never live together.
Fix
Default
hip-pool-allocsto lifetime-only dynamic packing:The previous per-dynamic-dimension best-fit strategy remains available with
lifetime-only=false.Example IR
Two disjoint allocs sized by different dynamic dimensions (
%d0,%d1):Before (stacked — pool = A + B):
After (shared slab — pool = max(A, B)):
Test plan
Made with Cursor