Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Fix warnings #14940

Closed
wants to merge 14 commits into from
Closed

Fix warnings #14940

wants to merge 14 commits into from

Conversation

larroy
Copy link
Contributor

@larroy larroy commented May 14, 2019

Description

Fix warnings and move exec_utils implementation of functions to implementation file.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

@larroy
Copy link
Contributor Author

larroy commented May 15, 2019

@mxnet-label-bot add [pr-awaiting-review, Backend]

@marcoabreu marcoabreu added Backend Issues related to the backend of MXNet pr-awaiting-review PR is waiting for code review labels May 15, 2019
@larroy larroy force-pushed the graph_dump branch 2 times, most recently from ffbeab3 to da53b56 Compare May 20, 2019 18:29
@larroy
Copy link
Contributor Author

larroy commented May 21, 2019

@apeforest
Copy link
Contributor

Thanks @larroy for this initiative. We should aim to reduce GCC warning to zero and turn on treat warning as error by default. Do you also plan to send a proposal to the dev list for the GCC warning cleanup, so that future PRs will not add more warnings?

@larroy
Copy link
Contributor Author

larroy commented May 21, 2019

@apeforest I think everybody agreed with that. But somebody has to do it, and I think I'm one of the few moving towards zero warnings. I have spent effort in this ungrateful task, the problem is that there are many platforms and build flavours as you are aware. So it's not easy to pass CI when enabling warnings as errors.

Some of my PRs fixing warnings take a long time to merge and create long discussions, maybe you have some ideas on how we could streamline the process or add a tag to the PRs so they can be more expedited when they just fix a warning.

#14900

src/operator/nn/dropout-inl.h Outdated Show resolved Hide resolved
@larroy larroy changed the title Fix warnings and improve inline abuse Fix warnings on OMP disabled May 24, 2019
@larroy larroy force-pushed the graph_dump branch 2 times, most recently from 8fc19d8 to 705c9d2 Compare May 28, 2019 20:02
@larroy larroy changed the title Fix warnings on OMP disabled Work on warnings May 29, 2019
@larroy
Copy link
Contributor Author

larroy commented Jun 5, 2019

@mxnet-label-bot add [pr-work-in-progress]

@marcoabreu marcoabreu added the pr-work-in-progress PR is still work in progress label Jun 5, 2019
larroy added a commit to larroy/mxnet that referenced this pull request Jul 18, 2019
In file included from ../src/kvstore/kvstore.cc:28:
../src/kvstore/./kvstore_local.h:281:23: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    auto validator = [this](const int key, const NDArray& nd, bool ignore_sparse) -> bool {
                      ^
../src/kvstore/./kvstore_local.h:326:23: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    auto validator = [this](const int key, const RSPVal& val_rowid, bool ignore_sparse) -> bool {
                      ^
In file included from ../src/c_api/c_api_profile.cc:35:
../src/c_api/../profiler/./profiler.h:1160:8: warning: 'mxnet::profiler::ProfileOperator::start' hides overloaded virtual function [-Woverloaded-virtual]
  void start(mxnet::Context::DeviceType dev_type, uint32_t dev_id) {
       ^
../src/c_api/../profiler/./profiler.h:870:8: note: hidden overloaded virtual function 'mxnet::profiler::ProfileEvent::start' declared here: different number of parameters (0 vs 2)
  void start() override {
       ^
../src/c_api/../profiler/./profiler.h:1212:8: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
      [this](OprExecStat *stat) {}, name_.c_str(), dev_type_, dev_id_,
       ^

See also apache#14940
@haojin2 haojin2 self-requested a review July 19, 2019 22:02
src/common/exec_utils.h Outdated Show resolved Hide resolved
return true;
}


Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra blank lines

return str;
}


Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra blank line

Copy link
Contributor

Choose a reason for hiding this comment

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

Please address @haojin2 comments before resolving it?

}
}


Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra blank line

Copy link
Contributor

Choose a reason for hiding this comment

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

please fix before resolving.

<< oss.str();
}


Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra blank line

Copy link
Contributor

Choose a reason for hiding this comment

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

And at all applicable places.

marcoabreu pushed a commit that referenced this pull request Jul 19, 2019
In file included from ../src/kvstore/kvstore.cc:28:
../src/kvstore/./kvstore_local.h:281:23: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    auto validator = [this](const int key, const NDArray& nd, bool ignore_sparse) -> bool {
                      ^
../src/kvstore/./kvstore_local.h:326:23: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    auto validator = [this](const int key, const RSPVal& val_rowid, bool ignore_sparse) -> bool {
                      ^
In file included from ../src/c_api/c_api_profile.cc:35:
../src/c_api/../profiler/./profiler.h:1160:8: warning: 'mxnet::profiler::ProfileOperator::start' hides overloaded virtual function [-Woverloaded-virtual]
  void start(mxnet::Context::DeviceType dev_type, uint32_t dev_id) {
       ^
../src/c_api/../profiler/./profiler.h:870:8: note: hidden overloaded virtual function 'mxnet::profiler::ProfileEvent::start' declared here: different number of parameters (0 vs 2)
  void start() override {
       ^
../src/c_api/../profiler/./profiler.h:1212:8: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
      [this](OprExecStat *stat) {}, name_.c_str(), dev_type_, dev_id_,
       ^

See also #14940
@larroy
Copy link
Contributor Author

larroy commented Jul 19, 2019

Fixed the whitespace, let me know if there's something else.

@larroy
Copy link
Contributor Author

larroy commented Jul 24, 2019

@haojin2 can you please review again?

@haojin2 haojin2 self-requested a review July 24, 2019 20:02
@larroy
Copy link
Contributor Author

larroy commented Jul 30, 2019

@szha this has been opened forever, could you help with this PR? thanks.

src/common/exec_utils.h Outdated Show resolved Hide resolved
Copy link
Contributor

@samskalicky samskalicky left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@ChaiBapchya ChaiBapchya left a comment

Choose a reason for hiding this comment

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

LGTM! Wish I could merge 😛

@@ -0,0 +1,519 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

I failed to understand what warnings did this fix?

Copy link
Contributor

@apeforest apeforest left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the warnings. However, I also noticed/or didn't understand many changes which are not related to the warning fix. Please also address reviewer's comments before marking them resolved.

@apeforest
Copy link
Contributor

It seems moving the inlining functions to a .cc file is not related to fixing warnings (or please correct me if it does). Please move it to a seperate PR if that refactoring is indeed necessary. In fact, I also read this from: https://www.geeksforgeeks.org/inline-functions-cpp/

It seems the compiler will optimize unnecessary inline functions?

Remember, inlining is only a request to the compiler, not a command. Compiler can ignore the request for inlining. Compiler may not perform inlining in such circumstances like:
1) If a function contains a loop. (for, while, do-while)
2) If a function contains static variables.
3) If a function is recursive.
4) If a function return type is other than void, and the return statement doesn’t exist in function body.
5) If a function contains switch or goto statement.

@larroy
Copy link
Contributor Author

larroy commented Aug 16, 2019

So the request for changes is basically removal of two additional blank lines (which by the way are allowed by Google style guide and Pep8) this has a CI cost which I don't find justified for the request of change. I guess I also missed the extra newline when I resolved it, my bad. Moving the functions to the CC file reduces binary sizes before linking. Is there anything seriously wrong with this change that requires two vetos? Also fixing warnings and moving some functions from header to implementation is small change enough that can be merged in a single PR in my opinion. We just had a 6k lines PR merged adding numpy operators, I find that there's two different set of criteria applied to some PRs and not others. This is not really encouraging.

@larroy
Copy link
Contributor Author

larroy commented Aug 16, 2019

I don't find this way to review code is conductive to contributing to this project.

@larroy larroy closed this Aug 16, 2019
@marcoabreu
Copy link
Contributor

While I appreciate your desire to be frugal, it really bothers me how often CI costs or runtime are being brought up as reason for not making a change. As long as something is not burning, time is not of essence. CI is provided as a service to the community. Managing costs is not the responsibility of the community but of the people who provide the underlying system.

Code in a project might live for a long time. Insisting on high standards is certainly something I'd prioritize above saving a few bucks.

Something that certainly remove friction here would be to make our linting rules tighter again. We have a lot of excludes for points that people regularly bring up, so I'd recommend considering removing some of the exceptions.

But aside from that, I agree with the other contributors that while it might be easier to manage for an individual to make unrelated changes in the same PR, it causes additional friction due to confusion and mixing concerns.

You certainly have good intentions here and I really appreciate that, but these friction points make these reviews difficult. While it's true that small changes are not a problem to merge fast, the combination of multiple small and unrelated changes makes the PR actually big and thus increases the round-trip time as well as required effort to review.

@larroy
Copy link
Contributor Author

larroy commented Aug 16, 2019

@marcoabreu This is a bit of a rant but why this doesn't apply to huge PRs like this? https://github.com/apache/incubator-mxnet/pull/15581/files instead is used as nitpicking for small PRs from external collaborators. If we want PRs which addresses isolated concerns, good, but let's be consistent and not have double standards.

My point is that I think is not a good use of my time or the reviewers time to act as a linter. If some committers are so passionate about whitespace they should improve the linter and code analysis tools instead of alienating contributors. I find ok to be reminded of some whitespace issue here and there, but this is a shallow review which comes late. I think comitters should take into consideration volunteers time and effort a bit more instead of making things more difficult.

anirudhacharya pushed a commit to anirudhacharya/mxnet that referenced this pull request Aug 20, 2019
In file included from ../src/kvstore/kvstore.cc:28:
../src/kvstore/./kvstore_local.h:281:23: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    auto validator = [this](const int key, const NDArray& nd, bool ignore_sparse) -> bool {
                      ^
../src/kvstore/./kvstore_local.h:326:23: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
    auto validator = [this](const int key, const RSPVal& val_rowid, bool ignore_sparse) -> bool {
                      ^
In file included from ../src/c_api/c_api_profile.cc:35:
../src/c_api/../profiler/./profiler.h:1160:8: warning: 'mxnet::profiler::ProfileOperator::start' hides overloaded virtual function [-Woverloaded-virtual]
  void start(mxnet::Context::DeviceType dev_type, uint32_t dev_id) {
       ^
../src/c_api/../profiler/./profiler.h:870:8: note: hidden overloaded virtual function 'mxnet::profiler::ProfileEvent::start' declared here: different number of parameters (0 vs 2)
  void start() override {
       ^
../src/c_api/../profiler/./profiler.h:1212:8: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
      [this](OprExecStat *stat) {}, name_.c_str(), dev_type_, dev_id_,
       ^

See also apache#14940
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Backend Issues related to the backend of MXNet pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants