-
Notifications
You must be signed in to change notification settings - Fork 536
Tiny fixes to make gcc pedantic build happy #8933
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/8933
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 4c0c697 with merge base c890809 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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.
linter
Also please update the title/commit message a bit. It has more than Fixup CMake summary message |
7a24b5e
to
9e79452
Compare
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.
changes requested for strncmp bug
@@ -189,7 +189,7 @@ Tensor& constant_pad_nd_out( | |||
CTYPE value_v; | |||
ET_SWITCH_SCALAR_OBJ_TYPES( | |||
value_type, ctx, "constant_pad_nd.out", CTYPE_VALUE, [&]() { | |||
CTYPE_VALUE val; | |||
CTYPE_VALUE val{}; |
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.
what is the error message motivating this? it seems silly and reminiscent of misguided linter advice I've seen previously, but perhaps I don't know something. Is it -Wuninitialized? If so, why empty braces instead of = 0;
?
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.
yeah it was that flag. COMPLEX_TYPES
is what I was thinking about when not using =0
. But I guess I can use it when there is no complex.
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.
Done.
runtime/executor/method_meta.cpp
Outdated
@@ -233,7 +233,7 @@ bool MethodMeta::uses_backend(const char* backend_name) const { | |||
const auto delegates = s_plan_->delegates(); | |||
for (size_t i = 0; i < delegates->size(); i++) { | |||
auto delegate = delegates->Get(i); | |||
if (std::strcmp(delegate->id()->c_str(), backend_name) == 0) { | |||
if (strncmp(delegate->id()->c_str(), backend_name, delegate->id()->size()) == 0) { |
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.
- nit: why drop std::?
- this is incorrect -- it passes if the delegate ID is a prefix of the backend_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.
std::
is an oversight.
Prefix is a real issue, let me also check the length of the incoming in addition to strncmp.
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.
Thanks. Done.
9e79452
to
5110f7b
Compare
5110f7b
to
3386f13
Compare
auto backend_name_len = std::strlen(backend_name); | ||
auto delegate_id_len = delegate->id()->size(); | ||
if (backend_name_len == delegate_id_len && | ||
std::strncmp(delegate->id()->c_str(), backend_name, backend_name_len) == | ||
0) { |
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.
you know what, I'm really confused about what error we're fixing here. how is this better than strcmp?
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.
unblocking, but I'd like to hear about why we can't simply use strcmp
Thanks. Basically |
IIRC this one being buggy in some random gcc version has come up previously, possibly on @mergennachin's size_test warning stuff? In general I don't think we should be held responsible for every warning in every quasi-reasonable version of every compiler because of stuff like this. |
yeah this was arm's bare metal gcc 13, I generally agree with you. That said since this was the only one I got tempted 😅 |
Summary
Tiny fixes to make gcc 13 baremetal, pedantic build happy.
Test plan
CI