ROCm/rocThrust

[Issue]: Failing tests with libstdc++ assertions due to unsigned overflow

Closed this issue · 3 comments

Problem Description

The issue is similar to ROCm/rocPRIM#570.

With hardened libstdc++ (compiled with -D_GLIBCXX_ASSERTIONS), few tests rocThrust 6.1.1 fail with:

[ RUN      ] AsyncReduceTests/3.TestAsyncReduce
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/uniform_int_dist.h:108: std::uniform_int_distribution<unsigned short>::param_type::param_type(_IntType, _IntType) [_IntType = unsigned short]: Assertion '_M_a <= _M_b' failed.

[ RUN      ] AsyncTransformTests/3.TestAsyncTransformUnary
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/uniform_int_dist.h:108: std::uniform_int_distribution<unsigned short>::param_type::param_type(_IntType, _IntType) [_IntType = unsigned short]: Assertion '_M_a <= _M_b' failed.

[ RUN      ] PrimitiveGatherTests/0.Gather
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/uniform_int_dist.h:108: std::uniform_int_distribution<unsigned int>::param_type::param_type(_IntType, _IntType) [_IntType = unsigned int]: Assertion '_M_a <= _M_b' failed.

[ RUN      ] PrimitiveInnerProductTests/0.InnerProductWithRandomData
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/uniform_int_dist.h:108: std::uniform_int_distribution<short>::param_type::param_type(_IntType, _IntType) [_IntType = short]: Assertion '_M_a <= _M_b' failed.

[ RUN      ] ScanByKeyTests.TestScanByKeyMixedTypes
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/uniform_int_dist.h:108: std::uniform_int_distribution<unsigned int>::param_type::param_type(_IntType, _IntType) [_IntType = unsigned int]: Assertion '_M_a <= _M_b' failed.

In lines like get_random_data<T>(2, -100, 100, seed) tests attempt to generate T=unsigned int in range, where min (4294967196) > max (100), which is undefined behavior. Can you fix it (and maybe in rocPRIM too)? Thanks!

Operating System

Gentoo

CPU

GPU

AMD Instinct MI300X

ROCm Version

ROCm 6.1.0

ROCm Component

No response

Steps to Reproduce

No response

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

@AngryLoki Internal ticket has been created to investigate this issue. Thanks!

@ppanchad-amd Hi, this is already fixed in #431

That PR isn't merged yet 😅