Skip to content

Conversation

@ipdemes
Copy link
Contributor

@ipdemes ipdemes commented Aug 25, 2023

No description provided.

@ipdemes ipdemes added the category:bug-fix PR is a bug fix and will be classified as such in release notes label Aug 25, 2023
@ipdemes ipdemes requested a review from magnatelee August 25, 2023 05:00
@ipdemes ipdemes changed the title WIP:Supporting unordered detach operation Supporting unordered detach operation Aug 30, 2023
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Aug 30, 2023

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment on lines 162 to 163
if self.detach_future and not self.detach_future.is_ready():
self.detach_future.wait()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right place to do this check. it should be done when the region field is recycled. and the recycling logic should be tweaked such that it favors free region fields with no pending detach over those with one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magnatelee : I believe I have added requested logic. Do you think I should still keep the check here? Can there be the case when RegionField is re-attached without going through the FieldManager ?

Copy link
Contributor

@magnatelee magnatelee Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think I should still keep the check here?

The check should be changed to an assertion or an exception, as the store at this line shouldn't have any outstanding detach op.

Can there be the case when RegionField is re-attached without going through the FieldManager ?

Re-attaching is illegal. Look at the check at line 160.

@marcinz
Copy link
Collaborator

marcinz commented Sep 11, 2023

/ok to test

else:
free_fields.append(field_info)
count -= 1
# FIXME: should I return None here instead waiting for future?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magnatelee : what would you suggest doing in the case when all fields in the free_fields container have not been deallocated yet: should we call wait on the detach_future or return None?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait on the future for now. Though any stores with attachments are expected to be small (otherwise, attached allocations couldn't even have been created in a single memory), we don't want to spew stores in the pathological case where the client code keeps creating a store and attaching an allocation to it.

# guaranteed to be ordered across all the shards even with
# control replication
self.free_fields: Deque[tuple[Region, int]] = deque()
self.free_fields: Deque[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel _try_reuse_field would become much simpler if we had two deques, one for those free of pending detach ops and one for those with them.

@magnatelee
Copy link
Contributor

@ipdemes I didn't do a thorough review on this, as we know that this code won't be maintained in the future. Let's just merge it for now and move on.

ipdemes and others added 4 commits September 20, 2023 22:11
Co-authored-by: Manolis Papadakis <manopapad@gmail.com>
Co-authored-by: Manolis Papadakis <manopapad@gmail.com>
Co-authored-by: Manolis Papadakis <manopapad@gmail.com>
Copy link
Contributor

@manopapad manopapad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor suggestion, otherwise looks good

@ipdemes ipdemes merged commit da7fdf4 into nv-legate:branch-23.09 Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:bug-fix PR is a bug fix and will be classified as such in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants