Skip to content

Conversation

@Tanish2101
Copy link

Summary:
Implemented the load_into method for SharedPtrDataLoader to support copying preallocated buffer data into a target buffer. This enables use cases where mutable model state has a meaningful initial value (e.g., on-device training or serialized read-before-write data).

Fixes
Fixes #11562

Test plan:
Added a unit test in shared_ptr_data_loader_test.cpp to verify that load_into():

  1. Copies the correct data for valid offset/size.
  2. Fails properly on invalid requests (e.g., out-of-bounds reads).

@pytorch-bot
Copy link

pytorch-bot bot commented Jun 15, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11707

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 2c3eee1 with merge base db8ef6b (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot
Copy link
Contributor

Hi @Tanish2101!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@Tanish2101
Copy link
Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot bot added the release notes: none Do not include this in the release notes label Jun 15, 2025
@Tanish2101 Tanish2101 closed this Jun 15, 2025
@Tanish2101 Tanish2101 reopened this Jun 15, 2025
@Tanish2101
Copy link
Author

Hi @JacobSzwejbka, I created a PR for this issue. This is the first time I am contributing to executorch. Please Let me know if there are any changes required.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 15, 2025
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@mergennachin
Copy link
Contributor

Hi @Tanish2101

Thank you for the contribution. Looks like @keyprocedure has started the PR for the same task (#11654)

@Tanish2101
Copy link
Author

I have implemented the load_into() function for shared_ptr data loader so the implementation done by @keyprocedure for mmap data loader is sufficient? means there is no need for seperate implementation for shared_ptr ?

@mergennachin

@Tanish2101
Copy link
Author

So now what should I do? means should I close the pull request which I have created for this issue? Let me know @mergennachin

return size_;
}

ET_NODISCARD executorch::runtime::Error SharedPtrDataLoader::load_into(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you merge the declaration and implementation?

Copy link
Author

Choose a reason for hiding this comment

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

I have merged the 'load_into' function declaration and implemention as suggested by you, please review it.

I have merge the declaration and implementation of 'load_into' function.
@Tanish2101 Tanish2101 requested a review from JacobSzwejbka June 17, 2025 13:44
Copy link
Contributor

@JacobSzwejbka JacobSzwejbka left a comment

Choose a reason for hiding this comment

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

Letting CI run, but looks good. Thanks for contributing!

@JacobSzwejbka
Copy link
Contributor

All of the failures looked like infra issues so rerunning the jobs

JacobSzwejbka and others added 3 commits June 27, 2025 14:01
- Replaced non-existent  with  in  implementation.
- Updated the corresponding unit test to match the corrected error.
- Ensures correctness and prevents enum resolution error during compilation.
@Tanish2101
Copy link
Author

Fixed: Changed invalid error code Error::OutOfBounds to Error::InvalidArgument in both implementation and test. OutOfBounds is not part of the executorch::runtime::Error enum

@JacobSzwejbka

@github-actions
Copy link

github-actions bot commented Sep 2, 2025

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the stale PRs inactive for over 60 days label Sep 2, 2025
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@lucylq
Copy link
Contributor

lucylq commented Nov 4, 2025

Hi @Tanish2101 , are you still working on this? See that it's approved, do you want to rebase and merge?

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: none Do not include this in the release notes stale PRs inactive for over 60 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement load_into for the shared_ptr data loader

5 participants