Skip to content

Let a device empty a copy somebody else still points at - #6

Closed
bosilca wants to merge 1 commit into
topic/host-mirror-reachablefrom
topic/device-copy-placeholder
Closed

bosilca wants to merge 1 commit into
topic/host-mirror-reachablefrom
topic/device-copy-placeholder

Conversation

@bosilca

@bosilca bosilca commented Sep 27, 2026

Copy link
Copy Markdown
Owner

When every copy on a device is still pointed at from outside it, the victim search used to find nothing and the task stayed starved. A device can now take the memory of such a copy and leave the copy object behind as a placeholder: it stays attached to its data, marked invalid, and whoever still holds it recovers the value from the host mirror on the next stage in.

Stacked on #5.

A device that runs out of memory looks for a copy in its read LRU whose
memory it can take. It passes over every copy whose reference count is
above one, on the grounds that the extra reference belongs to a task
completion that has yet to run and will drop it shortly. That is no
longer the only thing such a reference can be. A copy handed to a
successor is retained by the data repository that carries the dependency,
and a reshape promise parked there retains both the copy it was given and
the one it produced. Those references last as long as the dependency
does, which can be until the end of the taskpool, and they are not
waiting on anything this device can do.

With little enough device memory, every copy in the LRU is referenced
that way and the search comes back empty. The device has memory, all of
it spoken for by copies nobody is reading, and the tasks waiting for a
block wait for a release that is never coming.

Let the search take those copies. The copy object has to survive, since
the holders point at it, but its memory does not: emptied, it stays
attached to its data, keeps the version its content had, and is marked
invalid with nothing in flight. Anybody who needs the value again gives
it memory back and stages it in from the host mirror, which is where the
value went.

Emptying a copy is only admissible when the value can be brought back, so
examine the candidate first. A shared copy whose host mirror carries the
same version can be emptied as it is. A copy holding no value at all is
free to empty, which is what a reservation that had to be given up leaves
behind. A copy the device owns, or one that is shared but ahead of the
mirror, holds the only current value; move it to the owned list, where
the write-back hands the value and the version to the host and returns it
shared, which is precisely the state that makes it recoverable. Only
start doing any of this once a full sweep has shown there is no copy left
that this device owns outright.

Three places assumed a copy always has memory behind it. A transfer
looking for a source could pick an emptied peer, and hand the copy
routine a source pointer of nil; it now passes those over, and a flow
that also writes, which never looked for an alternate source at all,
falls back on the host mirror. A source that is invalid was taken to mean
a transfer is on its way in and is worth coming back for, which is not
true of one that was emptied, so that now keys off the transfer being in
flight. And the push completion skipped any flow whose input already sits
on this device, on the grounds that no transfer was needed to bring it
in; a copy being refilled is both the input and the output of its flow,
so it was skipped and left under transfer for good, which is a state the
eviction will never take memory back from.
@bosilca
bosilca force-pushed the topic/host-mirror-reachable branch from 3ab5dd5 to b3e3edb Compare September 27, 2026 17:46
@bosilca
bosilca force-pushed the topic/device-copy-placeholder branch from f2ac004 to a1680a4 Compare September 27, 2026 17:46
@bosilca

bosilca commented Sep 27, 2026

Copy link
Copy Markdown
Owner Author

Moved upstream as ICLDisco#813 so it is visible there.

@bosilca bosilca closed this Sep 27, 2026
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