-
Notifications
You must be signed in to change notification settings - Fork 438
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
Add safety checks when rendering kernel key strings #8327
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/8327
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit e9926e7 with merge base 8697fe4 (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D69324821 |
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.
Thank you for adding the check! Just left one comment
b6fbd2c
to
015af26
Compare
Summary: The old code assumed that it was handed a MAX_SIZE buffer, and that the list of TensorMeta values would never generate a string longer than that size. This PR adds explicit size tracking and an error code to the API, and now returns an error if the buffer is too small for the provided values. While I'm here, move MAX_SIZE out of the public API, since it's not an intrinsic aspect of kernel keys. This is technically a BC-breaking change, but I don't expect that any users are actually depending on it. Also: - Fix some unused var warnings (one of which was a real bug where we ignored an Error) - Silence the Meta-internal linter by moving to std::array in several places, code chunks I needed to touch anyway because of the new `make_kernel_key` parameter Add unit tests for all modified code. Reviewed By: larryliu0820 Differential Revision: D69324821
Summary: The old code assumed that it was handed a MAX_SIZE buffer, and that the list of TensorMeta values would never generate a string longer than that size. This PR adds explicit size tracking and an error code to the API, and now returns an error if the buffer is too small for the provided values. While I'm here, move MAX_SIZE out of the public API, since it's not an intrinsic aspect of kernel keys. This is technically a BC-breaking change, but I don't expect that any users are actually depending on it. Also: - Fix some unused var warnings (one of which was a real bug where we ignored an Error) - Silence the Meta-internal linter by moving to std::array in several code chunks I needed to touch anyway because of the new `make_kernel_key` parameter Add unit tests for all modified code. Reviewed By: larryliu0820 Differential Revision: D69324821
015af26
to
7f1f28a
Compare
This pull request was exported from Phabricator. Differential Revision: D69324821 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D69324821 |
Summary: The old code assumed that it was handed a MAX_SIZE buffer, and that the list of TensorMeta values would never generate a string longer than that size. This PR adds explicit size tracking and an error code to the API, and now returns an error if the buffer is too small for the provided values. While I'm here, move MAX_SIZE out of the public API, since it's not an intrinsic aspect of kernel keys. This is technically a BC-breaking change, but I don't expect that any users are actually depending on it. Also: - Fix some unused var warnings, which uncovered a couple places where we ignored an Error. Along similar lines, replaced EXPECT with ASSERT when validating kernel registration so we don't try to run the rest of the test after a registration error. - Silence the Meta-internal linter by moving to std::array in several code chunks I needed to touch anyway because of the new `make_kernel_key` parameter. Add unit tests for all modified code. Reviewed By: larryliu0820 Differential Revision: D69324821
7f1f28a
to
e9926e7
Compare
This pull request was exported from Phabricator. Differential Revision: D69324821 |
Summary:
The old code assumed that it was handed a MAX_SIZE buffer, and that the list of TensorMeta values would never generate a string longer than that size.
This PR adds explicit size tracking and an error code to the API, and now returns an error if the buffer is too small for the provided values.
While I'm here, move MAX_SIZE out of the public API, since it's not an intrinsic aspect of kernel keys. This is technically a BC-breaking change, but I don't expect that any users are actually depending on it.
Also:
make_kernel_key
parameter.Add unit tests for all modified code.
Differential Revision: D69324821