implicit pointer hop for OpenMP runtime memory mapping table proper deletion https://github.com/ROCm/llvm-project/issues/287 #163878
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.
OpenMP: Fix refcounting for implicit pointer-hop entries in libomptarget (ROCm#287)
This change prevents implicit pointer-only hops (compiler-generated chained pointer members) from incrementing/decrementing reference counts in libomptarget’s mapping table. Without this, intermediate implicit entries can linger after exit data, blocking proper cleanup.
Chained mappings like s.ps->ps->ps->ps->i generate implicit member pointer hops.
These hops are entries with no explicit TO/FROM/ALWAYS/DELETE and size == 0. they get refcounted as regular objects, leaving intermediate entries with non-zero refs after exit.
Problem:
After target enter data, implicit hops +1 refcount.
On target exit data, decrements don’t fully clear the intermediate hops.
Result: stale intermediate mappings prevent proper deletion and leak entries.
Solution
Detect implicit pointer-hop entries and do not update refcounts for them in begin/end paths.
Symmetric handling in targetDataBegin and targetDataEnd to avoid negative counts and ensure full cleanup.