-
Notifications
You must be signed in to change notification settings - Fork 594
Fix Signed-Unsigned Comparison in Tensor Utils #4279
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for pytorch-fbgemm-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This pull request was exported from Phabricator. Differential Revision: D76093914 |
wenxin0319
added a commit
to wenxin0319/FBGEMM-1
that referenced
this pull request
Jun 6, 2025
Summary: Resolved warnings caused by comparisons between signed and unsigned integers in tensor_utils.h. Changed the loop index variable i from int to size_t to match the type of sizes.size(), ensuring consistent and safe comparisons. This change eliminates the -Wsign-compare warnings during compilation. The original error message here: ``` buck-out/v2/gen/fbcode/b43bb943fef57626/deeplearning/fbgemm/fbgemm_gpu/__fbgemm_gpu_cpu__/buck-headers/fbgemm_gpu/utils/tensor_utils.h:53:20: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 53 | for (auto i = 0; i < sizes.size(); ++i) { | ~ ^ ~~~~~~~~~~~~ buck-out/v2/gen/fbcode/b43bb943fef57626/deeplearning/fbgemm/fbgemm_gpu/__fbgemm_gpu_cpu__/buck-headers/fbgemm_gpu/utils/tensor_utils.h:55:7: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 55 | if (i != (sizes.size() - (1))) { | ~ ^ ~~~~~~~~~~~~~~~~~~ 2 errors generated. ``` Differential Revision: D76093914
0c46c72
to
440e72c
Compare
wenxin0319
added a commit
to wenxin0319/FBGEMM-1
that referenced
this pull request
Jun 6, 2025
Summary: Resolved warnings caused by comparisons between signed and unsigned integers in tensor_utils.h. Changed the loop index variable i from int to size_t to match the type of sizes.size(), ensuring consistent and safe comparisons. This change eliminates the -Wsign-compare warnings during compilation. The original error message here: ``` buck-out/v2/gen/fbcode/b43bb943fef57626/deeplearning/fbgemm/fbgemm_gpu/__fbgemm_gpu_cpu__/buck-headers/fbgemm_gpu/utils/tensor_utils.h:53:20: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 53 | for (auto i = 0; i < sizes.size(); ++i) { | ~ ^ ~~~~~~~~~~~~ buck-out/v2/gen/fbcode/b43bb943fef57626/deeplearning/fbgemm/fbgemm_gpu/__fbgemm_gpu_cpu__/buck-headers/fbgemm_gpu/utils/tensor_utils.h:55:7: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 55 | if (i != (sizes.size() - (1))) { | ~ ^ ~~~~~~~~~~~~~~~~~~ 2 errors generated. ``` Differential Revision: D76093914
440e72c
to
d9dc19d
Compare
This pull request was exported from Phabricator. Differential Revision: D76093914 |
wenxin0319
added a commit
to wenxin0319/FBGEMM-1
that referenced
this pull request
Jun 6, 2025
Summary: Pull Request resolved: pytorch#4279 Resolved warnings caused by comparisons between signed and unsigned integers in tensor_utils.h. Changed the loop index variable i from int to size_t to match the type of sizes.size(), ensuring consistent and safe comparisons. This change eliminates the -Wsign-compare warnings during compilation. The original error message here: ``` buck-out/v2/gen/fbcode/b43bb943fef57626/deeplearning/fbgemm/fbgemm_gpu/__fbgemm_gpu_cpu__/buck-headers/fbgemm_gpu/utils/tensor_utils.h:53:20: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 53 | for (auto i = 0; i < sizes.size(); ++i) { | ~ ^ ~~~~~~~~~~~~ buck-out/v2/gen/fbcode/b43bb943fef57626/deeplearning/fbgemm/fbgemm_gpu/__fbgemm_gpu_cpu__/buck-headers/fbgemm_gpu/utils/tensor_utils.h:55:7: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 55 | if (i != (sizes.size() - (1))) { | ~ ^ ~~~~~~~~~~~~~~~~~~ 2 errors generated. ``` Differential Revision: D76093914
d9dc19d
to
3732706
Compare
Summary: X-link: facebookresearch/FBGEMM#1357 Pull Request resolved: pytorch#4279 Resolved warnings caused by comparisons between signed and unsigned integers in tensor_utils.h. Changed the loop index variable i from int to size_t to match the type of sizes.size(), ensuring consistent and safe comparisons. This change eliminates the -Wsign-compare warnings during compilation. The original error message here: ``` buck-out/v2/gen/fbcode/b43bb943fef57626/deeplearning/fbgemm/fbgemm_gpu/__fbgemm_gpu_cpu__/buck-headers/fbgemm_gpu/utils/tensor_utils.h:53:20: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 53 | for (auto i = 0; i < sizes.size(); ++i) { | ~ ^ ~~~~~~~~~~~~ buck-out/v2/gen/fbcode/b43bb943fef57626/deeplearning/fbgemm/fbgemm_gpu/__fbgemm_gpu_cpu__/buck-headers/fbgemm_gpu/utils/tensor_utils.h:55:7: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare] 55 | if (i != (sizes.size() - (1))) { | ~ ^ ~~~~~~~~~~~~~~~~~~ 2 errors generated. ``` Differential Revision: D76093914
This pull request was exported from Phabricator. Differential Revision: D76093914 |
3732706
to
2e9c523
Compare
This pull request has been merged in f002739. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Resolved warnings caused by comparisons between signed and unsigned integers in tensor_utils.h. Changed the loop index variable i from int to size_t to match the type of sizes.size(), ensuring consistent and safe comparisons. This change eliminates the -Wsign-compare warnings during compilation.
The original error message here:
Differential Revision: D76093914