Skip to content

Replaced CHECK_ by TORCH_CHECK_ #6322

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 1 commit into from
Jul 27, 2022
Merged

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Jul 27, 2022

Try to fix failing CI

Related pytorch PR: pytorch/pytorch#82032

CUDA CI jobs are failing as they still install 1.13.0.dev20220726 but CPU CI jobs are already running on 1.13.0.dev20220727
-> Check https://anaconda.org/pytorch-nightly/pytorch/files
-> Restart failing CI jobs only

@vfdev-5 vfdev-5 marked this pull request as ready for review July 27, 2022 09:37
datumbox
datumbox previously approved these changes Jul 27, 2022
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@datumbox datumbox added module: ops other if you have no clue or if you will manually handle the PR in the release notes labels Jul 27, 2022
@datumbox
Copy link
Contributor

datumbox commented Jul 27, 2022

@vfdev-5 Some test are failing, seem related.

@datumbox datumbox dismissed their stale review July 27, 2022 10:44

failing CI

@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Jul 27, 2022

Yes, it is related as these jobs are still installing yesterday's pytorch nightly where CHECK_ is still there. Let's wait for uploaded binaries and restart failing CI jobs

@vfdev-5 vfdev-5 merged commit ec0e9e1 into pytorch:main Jul 27, 2022
@vfdev-5 vfdev-5 deleted the fix-csrc-check-issue branch July 27, 2022 12:48
facebook-github-bot pushed a commit to pytorch/audio that referenced this pull request Jul 27, 2022
Summary:
Pull Request resolved: #2582

CHECK_ were deprecated in upstream so we should replace them here as
well

Similar to pytorch/vision#6322, relates to pytorch/pytorch#82032

Signed-off-by: Eli Uriegas <[email protected]>

Test Plan: Imported from OSS

Reviewed By: malfet, mthrok

Differential Revision: D38208356

Pulled By: seemethere

fbshipit-source-id: 6f42d517362f415e0775803514eee2628402918f
skim0514 pushed a commit to skim0514/audio that referenced this pull request Jul 27, 2022
Summary:
Pull Request resolved: pytorch#2582

CHECK_ were deprecated in upstream so we should replace them here as
well

Similar to pytorch/vision#6322, relates to pytorch/pytorch#82032

Signed-off-by: Eli Uriegas <[email protected]>

Test Plan: Imported from OSS

Reviewed By: malfet, mthrok

Differential Revision: D38208356

Pulled By: seemethere

fbshipit-source-id: 6f42d517362f415e0775803514eee2628402918f
facebook-github-bot pushed a commit that referenced this pull request Aug 2, 2022
Reviewed By: NicolasHug

Differential Revision: D38351759

fbshipit-source-id: 33baf079eb49590752d73bd37d0d37edb1ec87f4
Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

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

Here is how TORCH_CHECK_* is defined:

#include <glog/logging.h>

// Additional macros on top of glog
#ifndef NDEBUG
#define TORCH_CHECK_EQ(val1, val2) CHECK_EQ(val1, val2)
#else // !NDEBUG
// These versions generate no code in optimized mode.
#define TORCH_CHECK_EQ(val1, val2) \
  while (false)                    \
  CHECK_EQ(val1, val2)
#endif // NDEBUG

This PR broke FB internals. It seems that the real cause of the problem is the change on the semantics/behaviour of *CHECK* on Core. See pytorch/pytorch#82032 (comment).

Regardless, to resolve the situation I'm issuing a forward fix at D38383266 on Phabricator and at #6357 on Github.

@@ -50,7 +50,7 @@ void gotFilesStats(std::vector<VideoFileStats>& stats) {
fseek(f, 0, SEEK_END);
std::vector<uint8_t> buffer(ftell(f));
rewind(f);
CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
TORCH_CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
Copy link
Contributor

@datumbox datumbox Aug 3, 2022

Choose a reason for hiding this comment

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

This is not just a check. This is a function call that must be performed and then checked for its output. Unfortunately the new TORCH_CHECK_EQ mechanism can skip completely the method call if not in debug mode. This means that the function call will never be done causing issues.

@@ -90,7 +90,7 @@ size_t measurePerformanceUs(
fseek(f, 0, SEEK_END);
std::vector<uint8_t> buffer(ftell(f));
rewind(f);
CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
TORCH_CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
Copy link
Contributor

Choose a reason for hiding this comment

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

another one

@@ -324,7 +324,7 @@ TEST(SyncDecoder, TestMemoryBuffer) {
fseek(f, 0, SEEK_END);
std::vector<uint8_t> buffer(ftell(f));
rewind(f);
CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
TORCH_CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
Copy link
Contributor

Choose a reason for hiding this comment

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

this one too

@@ -349,7 +349,7 @@ TEST(SyncDecoder, TestMemoryBufferNoSeekableWithFullRead) {
fseek(f, 0, SEEK_END);
std::vector<uint8_t> buffer(ftell(f));
rewind(f);
CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
TORCH_CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
Copy link
Contributor

Choose a reason for hiding this comment

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

this one too

@@ -388,7 +388,7 @@ TEST(SyncDecoder, TestMemoryBufferNoSeekableWithPartialRead) {
fseek(f, 0, SEEK_END);
std::vector<uint8_t> buffer(ftell(f));
rewind(f);
CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
TORCH_CHECK_EQ(buffer.size(), fread(buffer.data(), 1, buffer.size(), f));
Copy link
Contributor

Choose a reason for hiding this comment

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

this one too

facebook-github-bot pushed a commit that referenced this pull request Aug 3, 2022
Summary:
Resolves https://www.internalfb.com/tasks/?t=128004042

Caused by TorchVision's PR at #6322 which was in response to a change on PyTorch Core at pytorch/pytorch#82032

Reviewed By: fmassa

Differential Revision: D38383266

fbshipit-source-id: 3f0ebd04a610031c4720123d1869a851f76455cd
datumbox added a commit to datumbox/vision that referenced this pull request Aug 3, 2022
Summary:
Resolves https://www.internalfb.com/tasks/?t=128004042

Caused by TorchVision's PR at pytorch#6322 which was in response to a change on PyTorch Core at pytorch/pytorch#82032

Reviewed By: fmassa

Differential Revision: D38383266

fbshipit-source-id: 3f0ebd04a610031c4720123d1869a851f76455cd
datumbox added a commit that referenced this pull request Aug 3, 2022
Summary:
Resolves https://www.internalfb.com/tasks/?t=128004042

Caused by TorchVision's PR at #6322 which was in response to a change on PyTorch Core at pytorch/pytorch#82032

Reviewed By: fmassa

Differential Revision: D38383266

fbshipit-source-id: 3f0ebd04a610031c4720123d1869a851f76455cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed module: ops other if you have no clue or if you will manually handle the PR in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants