vmem_chunked: `reuse()` rollback skips free-listed blocks, leaving the heap fragmented
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 58/100
Direzione di ricerca
Start with VMemChunkedAllocator.reuse() and collect(), and check how _released, bump and free_lists interact. Read test_chunked_churn_then_large_allocation_does_not_grow and run it with the keep_every=16 case. Done when the extended test frees all kept buffers, reclaims them, allocates most of the heap, and get_num_chunks() stays unchanged. Keep the free-list state identical on every rank.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
VMemChunkedAllocator.reuse() (added in #583) returns freed blocks at the top of the heap to the bump pointer, but it only considers blocks released in the current collect(). Blocks that went to a free list in an earlier round are never rolled back, even after the blocks above them are freed. The heap then stays split into small size-class blocks, and a later large allocation grows the heap even though the space below bump is free.
This behavior predates #583 (the allocator never merged free blocks), so it isn't a regression. It came up in review and was deferred to keep #583's scope: https://github.com/ROCm/iris/pull/583#discussion_r4275470909
How it happens
round k: [ s1 ][ s2 ][ K ][ s3 ] <- bump K = long-lived buffer, still in use
s3 rolls back; s1 and s2 go to a free list (K blocks the rollback)
round k+1: [ s1 ][ s2 ][ K ] <- bump K is freed and rolls back
the rollback stops: s2 ends at bump, but it's on a free list, not among this round's offsets
Bookkeeping model (agent-assisted; pure Python, no GPU): the shape of test_chunked_churn_then_large_allocation_does_not_grow with keep_every=16 at 4 KB granularity, then all kept buffers freed, then a 48 MB allocation in the 64 MB heap.
| heap growths during the 48 MB allocation | |
|---|---|
| before #583 | 1 |
| after #583 | 1 |
| with the change below | 0 |
Proposed change
Treat free-listed blocks as rollback candidates in reuse():
with self.lock:
self._bytes_since_collect = 0
candidates = {offset: self._released.pop(offset) for offset in offsets}
# Blocks freed in earlier rounds can reach the top once the blocks above them are freed
for size_class, free in self.free_lists.items():
candidates.update((offset, size_class) for offset in free)
free.clear()
# Blocks at the top of the bump region go back to the bump pointer, not a size class
by_end = {offset + size: offset for offset, size in candidates.items()}
while self.bump in by_end:
self.bump = by_end.pop(self.bump)
del candidates[self.bump]
for offset in sorted(candidates):
self.free_lists[candidates[offset]].append(offset)
- Stays symmetric across ranks: both inputs, the intersection passed by
collect()andfree_lists, are identical on every rank. - Cost: O(F log F) per
collect()for F free blocks, small next to thegc.collect()and device synccollect()already does. - Optional: append in descending order (
sorted(candidates, reverse=True)) sopop()hands out the lowest offsets first, keeping blocks near the top free for later rollbacks.
Test
Extend test_chunked_churn_then_large_allocation_does_not_grow (keep_every=16 case): after the loop, kept.clear() and ctx.reclaim_freed(), then allocate most of the heap and assert get_num_chunks() is unchanged.
- Lingua principale
- Python
- Stelle
- 203
- Fork
- 54
- Merge medio
- 5g 4h
- PR unite (30g)
- 27
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ROCm/iris
-
get_rocm_version() spawns hipconfig on every call, and get_num_xcc() calls it every timeForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertacore examples good first issue help wanted iris python
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
benchmarks bug examples iris test
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug examples invalid iris
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
iris test
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
SDMA is Triton-only, and no collective uses itForse già presa @ariscript l’ha presa 10 giorni fa. Apertaenhancement gluon help wanted iris
Difficoltà 5/5 Più di una settimana Idoneità per principianti 18/100
ROCm/iris#593 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
tests/strategies_test.py:174 goes uncovered on about 1 run in 100, failing the coverage ratchetApertaflaky-watch
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
btclib-org/btclib#2839 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
nion-software/nionswift#2018 ·
I maintainer di solito rispondono entro 1 giorno
-
Deleting a member fails when another member's share transfer points to themForse già presa @Beerlesklopfer l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
FoodCoopX/wirgarten-tapir#1336 ·
I maintainer di solito rispondono entro 3 giorni
-
pydanty:is-working
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
pydantic/pydantic-ai#11467 ·
I maintainer di solito rispondono entro 1 giorno
-
Link Checker ReportApertaautomated issue linkchecker report
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
QuantEcon/lecture-python.myst#1098 ·
I maintainer di solito rispondono entro 1 giorno