Skip to content

memory: regression test for pinned hipMemPoolAttrReleaseThreshold - #612

Open
xcwang1999 wants to merge 1 commit into
ROCm:developfrom
xcwang1999:mempool-release-threshold-test
Open

xcwang1999 wants to merge 1 commit into
ROCm:developfrom
xcwang1999:mempool-release-threshold-test

Conversation

@xcwang1999

Copy link
Copy Markdown

Regression test for ROCm/rocm-systems#11690, fixed by ROCm/clr#287.

Pinning hipMemPoolAttrReleaseThreshold to UINT64_MAX must stop the pool from releasing any reserved memory, including when the free-pressure path fires. On current clr develop the threshold is silently dropped on the release paths (VmHeap::TrimPhysMemory overwrites it with the caller's value, VmHeapArray::SetUnmapThreshold never reaches lazily created heaps, and the two-arg Heap::ReleaseAllMemory never consults it), so reserved bytes fall right after the frees.

The test pins the threshold on the default pool (readback confirms), reserves 3 x 64 MiB with a touch kernel, then frees A+B, lets the free markers retire on the idle stream, and frees C so the pressure path (freed 128 MiB > busy 64 MiB) runs the release logic. Reserved memory must stay at 192 MiB.

Red/green on RX 9070 XT (gfx1201), ROCm 7.2.1, MemoryTest2 built from this branch (three unrelated files excluded locally: hipMemPrefetchBatchAsync.cc, hipMemGetMemPool.cc, hipMemSetMemPool.cc need HIP headers newer than 7.2.1):

configuration result
stock libamdhip64, default env (VM heap path) FAILED (reserved drops)
stock libamdhip64, DEBUG_HIP_MEM_POOL_VMHEAP=0 (direct alloc path) FAILED
libamdhip64 with ROCm/clr#287, default env passed (3 assertions)
libamdhip64 with ROCm/clr#287, DEBUG_HIP_MEM_POOL_VMHEAP=0 passed

The two stock rows cover the VM heap release paths and the direct-allocation path separately; both fail without the fix, so the test would have caught all three defect sites.

Pinning the release threshold to UINT64_MAX must stop the pool from
releasing any reserved memory, including when the free-pressure path
fires. On affected runtimes the threshold is silently dropped on the
release paths and reserved bytes fall right after the frees.

The test pins the threshold (readback confirms), reserves 3 x 64 MiB,
then frees A+B, lets the free markers retire, and frees C so the
pressure path (freed 128 MiB > busy 64 MiB) runs the release logic.
Reserved memory must stay at 192 MiB.

Fails on current clr develop (reserved drops to ~64 MiB), passes with
ROCm/clr#287 applied. Runtime defect tracked in
ROCm/rocm-systems#11690.
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