Skip to content

Conversation

larryliu0820
Copy link
Contributor

Summary:

When building the Android demo app I got:

> bash build/build_android_llm_demo.sh

/data/users/larryliu/android/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4013:39: error: call to implicitly-deleted copy constructor of '(lambda at /data/users/larryliu/executorch/extension/module/module.cpp:126:9)'
        __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
                                      ^~~
/data/users/larryliu/executorch/extension/module/module.cpp:124:16: note: in instantiation of function template specialization 'std::shared_ptr<executorch::runtime::Program>::shared_ptr<executorch::runtime::Program, (lambda at /data/users/larryliu/executorch/extension/module/module.cpp:126:9)>' requested here
    program_ = std::shared_ptr<Program>(
               ^
/data/users/larryliu/executorch/extension/module/module.cpp:126:10: note: copy constructor of '' is implicitly deleted because field '' has a deleted copy constructor
        [data_loader = std::move(data_loader_)](Program* pointer) {
         ^
/data/users/larryliu/android/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:2577:3: note: copy constructor is implicitly deleted because 'unique_ptr<executorch::runtime::DataLoader>' has a user-declared move constructor
  unique_ptr(unique_ptr&& __u) _NOEXCEPT
  ^
/data/users/larryliu/android/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:3575:39: note: passing argument to parameter '__d' here
    __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)

To fix this I am changing the deleter of Program to be capturing this (Module) assuming the lifespan of Module is always longer than Program.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Copy link

pytorch-bot bot commented Aug 27, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit f92fc56 with merge base 3fb03dc (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 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 Aug 27, 2024
@facebook-github-bot
Copy link
Contributor

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Summary:

When building the Android demo app I got:

```
> bash build/build_android_llm_demo.sh

/data/users/larryliu/android/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:4013:39: error: call to implicitly-deleted copy constructor of '(lambda at /data/users/larryliu/executorch/extension/module/module.cpp:126:9)'
        __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
                                      ^~~
/data/users/larryliu/executorch/extension/module/module.cpp:124:16: note: in instantiation of function template specialization 'std::shared_ptr<executorch::runtime::Program>::shared_ptr<executorch::runtime::Program, (lambda at /data/users/larryliu/executorch/extension/module/module.cpp:126:9)>' requested here
    program_ = std::shared_ptr<Program>(
               ^
/data/users/larryliu/executorch/extension/module/module.cpp:126:10: note: copy constructor of '' is implicitly deleted because field '' has a deleted copy constructor
        [data_loader = std::move(data_loader_)](Program* pointer) {
         ^
/data/users/larryliu/android/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:2577:3: note: copy constructor is implicitly deleted because 'unique_ptr<executorch::runtime::DataLoader>' has a user-declared move constructor
  unique_ptr(unique_ptr&& __u) _NOEXCEPT
  ^
/data/users/larryliu/android/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:3575:39: note: passing argument to parameter '__d' here
    __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
```

To fix this I am changing the deleter of Program to be capturing `this`
(Module) assuming the lifespan of `Module` is always longer than
`Program`.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@facebook-github-bot
Copy link
Contributor

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@facebook-github-bot
Copy link
Contributor

@larryliu0820 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot merged commit f92139f into main Aug 27, 2024
45 checks passed
@facebook-github-bot facebook-github-bot deleted the fix_android_demo branch August 27, 2024 11:09
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants