Skip to content

Use CMake EXPORT #8954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 33 commits into
base: gh/swolchok/528/head
Choose a base branch
from
Draft

Use CMake EXPORT #8954

wants to merge 33 commits into from

Conversation

swolchok
Copy link
Contributor

@swolchok swolchok commented Mar 5, 2025

The CMake EXPORT feature makes target_compile_options/target_link_libraries etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. We are currently working around our lack of EXPORT by (incompletely and therefore incorrectly!) repeating our configuration in tools/cmake/executorch-config.cmake.

I was previously stalled here by XNNPACK's lack of use of EXPORT, but I discovered that I simply wasn't being thorough enough with installing/exporting the entire target graph.

Note that this diff raises the size test thresholds. This is because previously the size test wasn't including prim op registration, and this diff effectively fixes builds using find_package to always include that.

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Mar 5, 2025

🔗 Helpful Links

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

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

❌ 17 New Failures, 17 Unrelated Failures

As of commit 1029ce3 with merge base cfefd2c (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

swolchok added a commit that referenced this pull request Mar 5, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: e3e5b36
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
@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 Mar 5, 2025
@swolchok swolchok marked this pull request as draft March 5, 2025 01:40
Copy link

github-actions bot commented Mar 5, 2025

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@swolchok
Copy link
Contributor Author

have an update cooking, need to make sure check whether warnings I'm seeing about macOS version mismatch during install_executorch.sh are new and if so problematic

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jul 14, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: af3cc8d
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jul 22, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: 8b7ec9a
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jul 22, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: da025ca
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jul 23, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: 5823280
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
@swolchok swolchok changed the base branch from gh/swolchok/525/head to gh/swolchok/528/head July 23, 2025 04:23
@@ -371,7 +371,7 @@ jobs:
size=${arr[4]}
# threshold=48120 on devserver with gcc11.4
# todo(lfq): update once binary size is below 50kb.
threshold="55584"
threshold="63776"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bigger jump, do you know what is getting pulled in the build with these changes esp just with gcc and not with clang?

Copy link
Contributor

Choose a reason for hiding this comment

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

nvm saw this - #8954 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

why just for gcc though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's not just for gcc. they both had a significant size increase; I can't speak to the difference between them or the difference in overage in the thresholds previously.

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jul 23, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: 5e2ac91
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jul 23, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: 4368718
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
swolchok added a commit that referenced this pull request Jul 23, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: 8c35528
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
@swolchok
Copy link
Contributor Author

looks like we might finally have green CI (given the upstream repo issue) except that the arm baremetal size tests need a threshold bump!

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jul 23, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: f1615a2
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
…t failure for the EXPORT PR

[ghstack-poisoned]
swolchok added a commit that referenced this pull request Jul 23, 2025
The CMake EXPORT feature seems like it's supposed to make target_compile_options etc. work nicely for both in-project builds and also projects that consume your project by installing it and finding it with find_package. Using EXPORT would make it easy to have similar behavior to Buck's exported_preprocessor_flags, for example.

Unfortunately, I am currently stalled here by XNNPACK's lack of use of EXPORT. I tried working around dependencies that don't use EXPORT by re-installing them with EXPORT ourselves, but XNNPACK has rather a lot so I'm sending this out to highlight the problem and ask if there's another way.

I found some similar issues in TFLite: tensorflow/tensorflow#57658 tensorflow/tensorflow#87172

ghstack-source-id: efb6f61
ghstack-comment-id: 2699501745
Pull Request resolved: #8954
@swolchok swolchok requested review from jathu and removed request for shoumikhin, dbort, iseeyuan, jackzhxng and mcr229 July 24, 2025 00:05
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: build Changes related to build, including dependency upgrades, build flags, optimizations, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants