Repository navigation
fix compiler warnings - #1623
Conversation
| auto compM = [&count, Debug](Entry const& e, long const M) { | ||
| if(Debug) | ||
| printf("[%ld,%ld,%ld]\n", e.key[0], e.key[1], e.key[2]); | ||
| printf("[%lld,%lld,%lld]\n", e.key[0], e.key[1], e.key[2]); |
There was a problem hiding this comment.
I'm not as familiar with this part of the code, but it looks like key can also be type float? Maybe it doesn't hit this code path if the only warning was for lld
There was a problem hiding this comment.
Can we use std::cout instead of using printf?
There was a problem hiding this comment.
@nakajee you can push a commit to this PR with cout as I just want the warning fixed, you can use whatever Tensile team prefers (these seem to be size_t members for the warnings you get in CI, see ). Is there still no run of your own windows CI run directly on Tensile?
There was a problem hiding this comment.
I pushed cout version.
Even though we changed ld to lld, I can still see the opposite version of warning as follows.
===
/var/jenkins_home/workspace/clang_precheckin_Tensile_PR-1623/ZwdxdW0y1/tensile/Tensile/Source/lib/include/Tensile/PropertyMatching.hpp:698:64: warning: format specifies type 'long long' but the argument has type '__gnu_cxx::__alloc_traits<std::allocator, long>::value_type' (aka 'long') [-Wformat]
printf("[%lld,%lld,%lld]\n", e.key[0], e.key[1], e.key[2]);
~~~~ ^~~~~~~~
%ld
===
Let's see if using cout can fix the warning or not.
There was a problem hiding this comment.
By the way, probably, this is not just win compiler issue.
TorreZuk
left a comment
There was a problem hiding this comment.
Very good, windows clang is slightly different version to linux clang, my change built rocblas without windows warnings. But yes if you are happy with that format should fix both, it's debug output so hopefully not parsed.
|
PS - someone on tensile side should probably see if the type instantiation should be the same on windows and linux (i.e. long or long long)). Unrelated to fixing the warning but could be a problem down the road. |
|
@nakajee thanks for taking this over, I assume I can leave it to you to merge as you will know what failures are the norm and can be ignored? |
…ings (#12326) ## Motivation This fixes ~500 warnings when building on Windows (see ROCm/TheRock#47), saving 1-2MB of log size per GPU family build. For example: ``` 3.4 In file included from C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/src/msgpack/MessagePack.cpp:27: 3.4 In file included from C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/msgpack/MessagePack.hpp:31: 3.4 In file included from C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/ContractionLibrary.hpp:34: 3.4 In file included from C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/GranularitySelectionLibrary.hpp:38: 3.4 C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/PropertyMatching.hpp:1106:67: warning: format specifies type 'long' but the argument has type 'long long' [-Wformat] 3.4 1106 | printf("[ %ld ,%ld,%ld,%ld]\n", e.key[0], e.key[1], e.key[2], e.key[3]); 3.4 | ~~~ ^~~~~~~~ 3.4 | %lld 3.4 C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/PropertyMatching.hpp:1106:77: warning: format specifies type 'long' but the argument has type 'long long' [-Wformat] 3.4 1106 | printf("[ %ld ,%ld,%ld,%ld]\n", e.key[0], e.key[1], e.key[2], e.key[3]); 3.4 | ~~~ ^~~~~~~~ 3.4 | %lld ... 3.4 C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/src/msgpack/MessagePack.cpp:413:9: note: in instantiation of function template specialization 'TensileLite::MessagePackLoadLibraryFile<TensileLite::ContractionProblemGemm, TensileLite::ContractionSolution>' requested here 3.4 413 | MessagePackLoadLibraryFile<ContractionProblemGemm, ContractionSolution>( 3.4 | ^ ``` ## Technical Details The `%ld` format specifier expects `long`, while the values are `int64_t`. * On 64-bit Linux, `long` is typically 64 bits * On 64-bit Windows, `long` is 32 bits while `int64_t` is always 64 bits (`long long`) See https://en.cppreference.com/cpp/types/integer#Format_macro_constants, `PRId64` is recommended for `int64_t`. > [!NOTE] > The `tensilelite/include/Tensile/PropertyMatching.hpp` fix was already applied to _Tensile_ in ROCm/Tensile#1623 / 37278db, including switching from `printf` to `std::cout`. > https://github.com/ROCm/rocm-libraries/blob/ab0a5742e4480ade753a606fab6d6945fd2c0a51/shared/tensile/Tensile/Source/lib/include/Tensile/PropertyMatching.hpp#L698-L701 ## Test Plan Check that CI logs no longer contain these warnings. Run details | Logs link | file size -- | -- | --: baseline | [35375442872-windows/...hipBLASLt_build.log](https://therock-ci-artifacts-external.s3.amazonaws.com/ROCm-rocm-libraries/35375442872-windows/logs/math-libs/gfx1151/hipBLASLt_build.log) | 1247KB this PR | [35397683840-windows/...hipBLASLt_build.log](https://therock-ci-artifacts-external.s3.amazonaws.com/ROCm-rocm-libraries/35397683840-windows/logs/math-libs/gfx1151/hipBLASLt_build.log) | 87KB ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.
fix(hipblaslt): use portable formatting for 64-bit values to fix warnings (#12326) ## Motivation This fixes ~500 warnings when building on Windows (see ROCm/TheRock#47), saving 1-2MB of log size per GPU family build. For example: ``` 3.4 In file included from C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/src/msgpack/MessagePack.cpp:27: 3.4 In file included from C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/msgpack/MessagePack.hpp:31: 3.4 In file included from C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/ContractionLibrary.hpp:34: 3.4 In file included from C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/GranularitySelectionLibrary.hpp:38: 3.4 C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/PropertyMatching.hpp:1106:67: warning: format specifies type 'long' but the argument has type 'long long' [-Wformat] 3.4 1106 | printf("[ %ld ,%ld,%ld,%ld]\n", e.key[0], e.key[1], e.key[2], e.key[3]); 3.4 | ~~~ ^~~~~~~~ 3.4 | %lld 3.4 C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/include\Tensile/PropertyMatching.hpp:1106:77: warning: format specifies type 'long' but the argument has type 'long long' [-Wformat] 3.4 1106 | printf("[ %ld ,%ld,%ld,%ld]\n", e.key[0], e.key[1], e.key[2], e.key[3]); 3.4 | ~~~ ^~~~~~~~ 3.4 | %lld ... 3.4 C:/home/runner/_work/TheRock/TheRock/rocm-libraries/projects/hipblaslt/tensilelite/src/msgpack/MessagePack.cpp:413:9: note: in instantiation of function template specialization 'TensileLite::MessagePackLoadLibraryFile<TensileLite::ContractionProblemGemm, TensileLite::ContractionSolution>' requested here 3.4 413 | MessagePackLoadLibraryFile<ContractionProblemGemm, ContractionSolution>( 3.4 | ^ ``` ## Technical Details The `%ld` format specifier expects `long`, while the values are `int64_t`. * On 64-bit Linux, `long` is typically 64 bits * On 64-bit Windows, `long` is 32 bits while `int64_t` is always 64 bits (`long long`) See https://en.cppreference.com/cpp/types/integer#Format_macro_constants, `PRId64` is recommended for `int64_t`. > [!NOTE] > The `tensilelite/include/Tensile/PropertyMatching.hpp` fix was already applied to _Tensile_ in ROCm/Tensile#1623 / ROCm/rocm-libraries@37278db, including switching from `printf` to `std::cout`. > https://github.com/ROCm/rocm-libraries/blob/ab0a5742e4480ade753a606fab6d6945fd2c0a51/shared/tensile/Tensile/Source/lib/include/Tensile/PropertyMatching.hpp#L698-L701 ## Test Plan Check that CI logs no longer contain these warnings. Run details | Logs link | file size -- | -- | --: baseline | [35375442872-windows/...hipBLASLt_build.log](https://therock-ci-artifacts-external.s3.amazonaws.com/ROCm-rocm-libraries/35375442872-windows/logs/math-libs/gfx1151/hipBLASLt_build.log) | 1247KB this PR | [35397683840-windows/...hipBLASLt_build.log](https://therock-ci-artifacts-external.s3.amazonaws.com/ROCm-rocm-libraries/35397683840-windows/logs/math-libs/gfx1151/hipBLASLt_build.log) | 87KB ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.
No description provided.