Skip to content

Create a helper to define overridable configs #10731

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

Merged
merged 4 commits into from
May 7, 2025
Merged

Conversation

jathu
Copy link
Contributor

@jathu jathu commented May 6, 2025

Summary

Context: #10661. As part #10716, this creates a helper to define ET configs.

Why define_overridable_config?

This is a simple wrapper to configure an option via the user or fallback to a default value. Instead of having people do this manually, this is convenient and consistent. More specifically:

  • If the option is set via the CLI or set, then save that value in the cache — with our own description
  • If the option is unset, then fallback to the default value

The user options will be loaded before loading the default.cmake file. This means, when we load the default file, we can use the user set options or fallback on defaults. Then finally we can do a final sweet of option validations. After this point, all options will be frozen and immutable.

Moreover, having a helper function will allow us to enforce standards on options. For example, naming standards done in this PR.

Migration plan

For now, I've only migrated a simple option EXECUTORCH_ENABLE_LOGGING. We'll incrementally migrate remaining options in future PRs.

Test plan

For changes to EXECUTORCH_ENABLE_LOGGING, I changed the release modes and checked the finaly CMakeCache.txt file. Rely on CI for full tests.

For python tests:

$ python3 -m unittest discover -s tools/cmake -p "*.py"

I will include this test in CI in the next diff.

cc @larryliu0820

Copy link

pytorch-bot bot commented May 6, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 2 Pending

As of commit 738e250 with merge base cebe051 (image):

NEW FAILURE - The following job has failed:

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 May 6, 2025
@jathu jathu added topic: not user facing and removed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels May 6, 2025
@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 May 6, 2025
@jathu jathu force-pushed the jathu/create-define-config branch 2 times, most recently from 0016cdd to ec90eda Compare May 6, 2025 20:06
@jathu jathu force-pushed the jathu/create-define-config branch 2 times, most recently from 171b0de to dcf72ee Compare May 6, 2025 21:26
@jathu jathu requested review from mergennachin and larryliu0820 May 6, 2025 21:44
@jathu jathu marked this pull request as ready for review May 6, 2025 21:44
@jathu jathu force-pushed the jathu/create-define-config branch from dcf72ee to 50c54c1 Compare May 7, 2025 16:26
return result


class CMakeTestCase(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow thanks for writing the tests! I didn't know CMake is testable

@jathu jathu merged commit c837925 into main May 7, 2025
188 checks passed
@jathu jathu deleted the jathu/create-define-config branch May 7, 2025 19:52
@jathu jathu added module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch release notes: build Changes related to build, including dependency upgrades, build flags, optimizations, etc. labels May 7, 2025
jhelsby pushed a commit to jhelsby/executorch that referenced this pull request May 9, 2025
### Summary
Context: pytorch#10661. As
part pytorch#10716, this creates a
helper to define ET configs.

#### Why define_overridable_config?

This is a simple wrapper to configure an option via the user or fallback
to a default value. Instead of having people do this manually, this is
convenient and consistent. More specifically:

- If the option is set via the CLI or `set`, then save that value in the
cache — with our own description
- If the option is unset, then fallback to the default value

The user options will be loaded *before* loading the `default.cmake`
file. This means, when we load the default file, we can use the user set
options or fallback on defaults. Then finally we can do a final sweet of
option validations. After this point, all options will be frozen and
immutable.

Moreover, having a helper function will allow us to enforce standards on
options. For example, naming standards done in this PR.

#### Migration plan

For now, I've only migrated a simple option `EXECUTORCH_ENABLE_LOGGING`.
We'll incrementally migrate remaining options in future PRs.

### Test plan

For changes to `EXECUTORCH_ENABLE_LOGGING`, I changed the release modes
and checked the finaly `CMakeCache.txt` file. Rely on CI for full tests.

For python tests:

```
$ python3 -m unittest discover -s tools/cmake -p "*.py"
```

I will include this test in CI in the next diff.
@jackzhxng jackzhxng added release notes: examples Changes to any of our example LLMs integrations, such as Llama3 and Llava and removed release notes: examples Changes to any of our example LLMs integrations, such as Llama3 and Llava labels May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/binaries ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: build/install Issues related to the cmake and buck2 builds, and to installing ExecuTorch release notes: build Changes related to build, including dependency upgrades, build flags, optimizations, etc. topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants