-
Notifications
You must be signed in to change notification settings - Fork 633
Support for Dtye Selective Build from Dictionary API in OSS (cmake) #12873
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/12873
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Unrelated FailureAs of commit 6828f13 with merge base 45846c8 ( NEW FAILURE - The following job has failed:
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. |
@pytorchbot label "release notes: none" |
rm -rf ${build_dir} | ||
retry cmake -DCMAKE_BUILD_TYPE=Release \ | ||
-DMAX_KERNEL_NUM=22 \ | ||
-DEXECUTORCH_SELECT_OPS_LIST='{"aten::add": [Scalar.Float.name]}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be OPS_DICT
? or are we re-using OPS_LIST
?
@@ -66,6 +66,11 @@ option(EXECUTORCH_SELECT_ALL_OPS | |||
"Whether to register all ops defined in portable kernel library." OFF | |||
) | |||
|
|||
# Option to enable parsing ops and dtypes from json formatted dictionary | |||
option(EXECUTORCH_SELECT_OPS_FROM_DICT | |||
"Enable op selection from json formattting string during build." OFF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a link to the supported dtype strings, e.g. https://github.com/pytorch/executorch/blame/0211a0346455f5b1ce445c2bdf6fce89a9aa04c9/shim_et/xplat/executorch/codegen/codegen.bzl#L51
^ actually I think this list is too broad and not all supported in ET 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are actually only 8 dtypes that are supported and tested. I remember seeing a list of them somewhere in the code base, will note them here.
6972848
to
3e541eb
Compare
849311e
to
6828f13
Compare
Summary
When attempting to build minimal binary size with only a select number of operators and dtypes, it's advantageous to simply specify only the needed selections at compile time. This PR allows one to specify a JSON formatted string to select operators and dtypes to be included in the final binary. An example is also provided.
Test plan
This feature was tested with the added example in
examples/selective_build/test_selective_build.sh
which now has a function namedtest_cmake_select_ops_in_dict()
. This function exemplifies the usage of the newly added dictionary API.