Skip to content

Implement SharedPtrDataLoader load_into - #22004

Open
CatNebulaaaa wants to merge 1 commit into
pytorch:mainfrom
CatNebulaaaa:fix-shared-ptr-data-loader-load-into
Open

Implement SharedPtrDataLoader load_into#22004
CatNebulaaaa wants to merge 1 commit into
pytorch:mainfrom
CatNebulaaaa:fix-shared-ptr-data-loader-load-into

Conversation

@CatNebulaaaa

Copy link
Copy Markdown

Summary

  • Implement SharedPtrDataLoader::load_into using the loader's existing bounds and overflow validation.
  • Reject null destination buffers consistently with the other data loaders.
  • Add tests for successful copies, null destinations, and out-of-bounds requests.

Fixes #11562

Test plan

  • Built and ran shared_ptr_data_loader_test.cpp against GoogleTest on WSL/Ubuntu 24.04 with GCC 13.3: 4 tests passed.
  • git diff --check

AI usage

This change was developed with assistance from OpenAI Codex. I reviewed the resulting diff and ran the tests listed above.

Copilot AI lite review requested due to automatic review settings August 21, 2026 04:07
@pytorch-bot

pytorch-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 20 Awaiting Approval

As of commit a3e6c96 with merge base 6a8eae9 (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

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

@meta-cla

meta-cla Bot commented Aug 21, 2026

Copy link
Copy Markdown

Hi @CatNebulaaaa!

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 cla@meta.com. Thanks!

@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 21, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: CatNebulaaaa / name: Pleiades (a3e6c96)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Implements SharedPtrDataLoader::load_into() so callers can copy data directly into a provided destination buffer, reusing the loader’s existing bounds/overflow validation and matching the null-destination behavior of other DataLoader implementations.

Changes:

  • Add SharedPtrDataLoader::load_into() implementation that validates destination buffer and delegates range validation to load().
  • Add unit tests covering null destination handling, successful copies, and out-of-bounds requests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
extension/data_loader/shared_ptr_data_loader.h Implements load_into() for SharedPtrDataLoader using existing validation and memcpy.
extension/data_loader/test/shared_ptr_data_loader_test.cpp Adds tests for load_into() success, null destination, and invalid range handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +182 to +184
buffer),
Error::Ok);
EXPECT_EQ(0, std::memcmp(buffer, data.get() + kDataSize - sizeof(buffer), 3));
@CatNebulaaaa

Copy link
Copy Markdown
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 Aug 21, 2026
@meta-cla meta-cla 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 Aug 21, 2026
@meta-cla

meta-cla Bot commented Aug 21, 2026

Copy link
Copy Markdown

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement load_into for the shared_ptr data loader

3 participants