Skip to content

Correct GTest print check for 128-bit ints on Windows#1029

Merged
stanleytsang-amd merged 1 commit into
developfrom
users/umfranzw/fix_rocprim_int128_print_check
Aug 12, 2025
Merged

Correct GTest print check for 128-bit ints on Windows#1029
stanleytsang-amd merged 1 commit into
developfrom
users/umfranzw/fix_rocprim_int128_print_check

Conversation

@umfranzw
Copy link
Copy Markdown
Contributor

@umfranzw umfranzw commented Aug 1, 2025

Currently, on Windows, GTest cannot print 128-bit ints. We have a check in test_utils::protected_assert_eq that avoids calling ASSERT_EQ on 128-bit int values directly, since this will cause the values to be printed in the event of an error.

This check was relying on the is_int128 alias, which was being set to false_type when ROCPRIM_HAS_INT128_SUPPORT was false. As a result, when 128-bit types were passed in, our check could not detect them and would fail to stop the printing.

In rocprim/types.hpp, the types rocprim::int128_t and rocprim::uint128_t are now defined regardless of how ROCPRIM_HAS_INT128_SUPPORT is set. This means we no longer need to guard against usage of these types in our test code (we only need to use ROCPRIM_HAS_INT128_SUPPORT in cases where we're doing some operation that explicitly won't work on 128-bit ints).

This change removes the code that sets the is_int128 alias to false_type when ROCPRIM_HAS_INT128_SUPPORT is not set. Doing this is enough to fix the check in test_utils::protected_assert_eq.

Currently, on Windows, GTest cannot print 128-bit ints.
We have a check in test_utils::protected_assert_eq that
avoids calling ASSERT_EQ on 128-bit int values directly,
since this will cause the values to be printed in the
event of an error.

This check was relying on the is_int128 alias, which was being
set to false_type when ROCPRIM_HAS_INT128_SUPPORT was false.
As a result, when 128-bit types were passed in, our check could
not detect them and would fail to stop the printing.

In rocprim/types.hpp, the types rocprim::int128_t and rocprim::uint128_t
are now defined regardless of how ROCPRIM_HAS_INT128_SUPPORT is set.
This means we no longer need to guard against usage of these types
in our test code (we only need to use ROCPRIM_HAS_INT128_SUPPORT in cases
where we're doing some operation that explicitly won't work on 128-bit ints).

This change removes the code that sets the is_int128 alias to false_type
when ROCPRIM_HAS_INT128_SUPPORT is not set. Doing this is enough
to fix the check in test_utils::protected_assert_eq.
Copy link
Copy Markdown
Contributor

@stanleytsang-amd stanleytsang-amd 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
Copy Markdown
Member

@marbre marbre left a comment

Choose a reason for hiding this comment

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

I can confirm that this unbreaks the Windows build in TheRock: https://github.com/ROCm/TheRock/actions/runs/16724375578/job/47336097097?pr=1185

Thanks for the fix!

@marbre
Copy link
Copy Markdown
Member

marbre commented Aug 6, 2025

@umfranzw @stanleytsang-amd can this be merged?

@umfranzw
Copy link
Copy Markdown
Contributor Author

umfranzw commented Aug 6, 2025

@marbre, apologies for the delay - some unrelated CI failures are blocking my ability to merge. I think they may have been fixed now. I will restart them again and see how it goes.

@umfranzw
Copy link
Copy Markdown
Contributor Author

umfranzw commented Aug 6, 2025

/azp run rocPRIM

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@marbre
Copy link
Copy Markdown
Member

marbre commented Aug 11, 2025

Seems Azure CI was not able to run. I can however confirm, that with this fix, TheRock is able to build and run rocPRIM tests successfully.

@stanleytsang-amd stanleytsang-amd merged commit 6c24aff into develop Aug 12, 2025
12 of 18 checks passed
@stanleytsang-amd stanleytsang-amd deleted the users/umfranzw/fix_rocprim_int128_print_check branch August 12, 2025 15:34
lamikr pushed a commit that referenced this pull request Aug 19, 2025
Currently, on Windows, GTest cannot print 128-bit ints.
We have a check in test_utils::protected_assert_eq that
avoids calling ASSERT_EQ on 128-bit int values directly,
since this will cause the values to be printed in the
event of an error.

This check was relying on the is_int128 alias, which was being
set to false_type when ROCPRIM_HAS_INT128_SUPPORT was false.
As a result, when 128-bit types were passed in, our check could
not detect them and would fail to stop the printing.

In rocprim/types.hpp, the types rocprim::int128_t and rocprim::uint128_t
are now defined regardless of how ROCPRIM_HAS_INT128_SUPPORT is set.
This means we no longer need to guard against usage of these types
in our test code (we only need to use ROCPRIM_HAS_INT128_SUPPORT in cases
where we're doing some operation that explicitly won't work on 128-bit ints).

This change removes the code that sets the is_int128 alias to false_type
when ROCPRIM_HAS_INT128_SUPPORT is not set. Doing this is enough
to fix the check in test_utils::protected_assert_eq.

Cherry-picked from: #1029
HPC-Ken pushed a commit to HPC-Ken/rocm-libraries that referenced this pull request Aug 22, 2025
Currently, on Windows, GTest cannot print 128-bit ints.
We have a check in test_utils::protected_assert_eq that
avoids calling ASSERT_EQ on 128-bit int values directly,
since this will cause the values to be printed in the
event of an error.

This check was relying on the is_int128 alias, which was being
set to false_type when ROCPRIM_HAS_INT128_SUPPORT was false.
As a result, when 128-bit types were passed in, our check could
not detect them and would fail to stop the printing.

In rocprim/types.hpp, the types rocprim::int128_t and rocprim::uint128_t
are now defined regardless of how ROCPRIM_HAS_INT128_SUPPORT is set.
This means we no longer need to guard against usage of these types
in our test code (we only need to use ROCPRIM_HAS_INT128_SUPPORT in cases
where we're doing some operation that explicitly won't work on 128-bit ints).

This change removes the code that sets the is_int128 alias to false_type
when ROCPRIM_HAS_INT128_SUPPORT is not set. Doing this is enough
to fix the check in test_utils::protected_assert_eq.

Cherry-picked from: ROCm#1029
marbre added a commit to ROCm/TheRock that referenced this pull request Sep 3, 2025
This patch was needed prior to
ROCm/rocm-libraries#1029. With the fixes to
upstream, the local patch is no longer needed.
stanleytsang-amd pushed a commit that referenced this pull request Oct 23, 2025
Currently, on Windows, GTest cannot print 128-bit ints. We have a check
in `test_utils::protected_assert_eq` that avoids calling `ASSERT_EQ` on
128-bit int values directly, since this will cause the values to be
printed in the event of an error.

This check was relying on the `is_int128` alias, which was being set to
`false_type` when `ROCPRIM_HAS_INT128_SUPPORT` was `false`. As a result,
when 128-bit types were passed in, our check could not detect them and
would fail to stop the printing.

In
[rocprim/types.hpp](https://github.com/ROCm/rocm-libraries/blob/develop/projects/rocprim/rocprim/include/rocprim/types.hpp#L69),
the types `rocprim::int128_t` and `rocprim::uint128_t` are now defined
regardless of how `ROCPRIM_HAS_INT128_SUPPORT` is set. This means we no
longer need to guard against usage of these types in our test code (we
only need to use `ROCPRIM_HAS_INT128_SUPPORT` in cases where we're doing
some operation that explicitly won't work on 128-bit ints).

This change removes the code that sets the `is_int128` alias to
`false_type` when `ROCPRIM_HAS_INT128_SUPPORT` is not set. Doing this is
enough to fix the check in `test_utils::protected_assert_eq`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants