Skip to content

Conversation

@ro-i
Copy link

@ro-i ro-i commented Oct 24, 2025

Reorder mappers such that

  • on target entry: "from" mappers are handled at the end, where they only act as decayed alloc/storage mappers.
  • on target exit: "to" mappers are handled first so that they can act as decayed release/storage mappers and decrement the reference count.

This avoids that map to+from or from+to result in different outcomes than mapping with a tofrom mapper. The previous behavior:

  • target map(to: ptr[0:size]) map(from: ptr[0:size]): the from-mapper was hindered from copying the data back to the host because it was handled first on target exit which means that the to-mapper hadn't been able to decrement the reference count first.
  • target map(from: ptr[0:size]) map(to: ptr[0:size]): the to-mapper was hindered from copying the data to the device because it was handled second on target entry which means that the reference count had already been incremented by the decayed alloc/storage operation of the from-mapper.

@ro-i ro-i requested a review from mjklemm October 24, 2025 19:08
@ro-i
Copy link
Author

ro-i commented Oct 24, 2025

Testing only - DO NOT MERGE

@z1-cciauto
Copy link
Collaborator

Reorder mappers such that
- on target entry: "from" mappers are handled at the end, where they
  only act as decayed alloc/storage mappers.
- on target exit: "to" mappers are handled first so that they can act as
  decayed release/storage mappers and decrement the reference count.

This avoids that map to+from or from+to result in different outcomes
than mapping with a tofrom mapper. The previous behavior:
- `target map(to: ptr[0:size]) map(from: ptr[0:size])`: the from-mapper
  was hindered from copying the data back to the host because it was
handled first on target exit which means that the to-mapper hadn't been
able to decrement the reference count first.
- `target map(from: ptr[0:size]) map(to: ptr[0:size])`: the to-mapper
  was hindered from copying the data to the device because it was
handled second on target entry which means that the reference count had
already been incremented by the decayed alloc/storage operation of the
from-mapper.
@ro-i ro-i force-pushed the amd/dev/ro-i/omp-map-to-from branch from 769b7fe to 44a91e8 Compare October 25, 2025 14:12
@z1-cciauto
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants