-
Notifications
You must be signed in to change notification settings - Fork 203
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
Generate random integers with uniform_int_distribution #677
Conversation
27fb752
to
9d9d03e
Compare
This has revealed that |
I'll argue that falling back to the generic implementation is OK here and we should not prioritize fixing it (instead of removing it) over fixing all our test cases |
From a build on aarch64 g++12 Ubuntu22.04:
(generic_decompose is the current generic, generic is my new proposed one.) Same picture on the older g++8 of Ubuntu 20.04. In other words, yeah, let's kill that broken neonv8 kernel. It serves no purpose that generic (even the old one) doesn't do better, in all our current builds. |
It looks like the neonv8 kernel was even slower back when it was added: #196 |
I'll rebase this after #680 is merged. |
Signed-off-by: Clayton Smith <[email protected]>
Signed-off-by: Clayton Smith <[email protected]>
9d9d03e
to
992e7f5
Compare
I rebased on |
Generate random integers with uniform_int_distribution
Fixes #688.
Random integer generation in
load_random_data
has a lot of bugs:float(uint64_t(2) << (type.size * 8))
performs a left shift by 64 bits when the type size is 8, and this results in Undefined Behaviour. On my system, the only generateduint64_t
values are 0, 1, and 18446744073709551615.float(uint64_t(2) << (type.size * 8))
calculation is also incorrect (twice as large as it should be) when the type size is smaller than 8, resulting in Undefined Behaviour when floating-point random values are cast to integers.int32_t
anduint32_t
values are multiples of 256.uint16_t
values are 0, 1, 2, 3, 4, 5, 6, 7, 65529, 65530, 65531, 65532, 65533, 65534, and 65535.Here I've fixed all these problems by replacing
std::uniform_real_distribution
withstd::uniform_int_distribution
.I had to keep
int16_t
generation in the range -7 .. +7, because various kernels added in #77 fail otherwise (due to differing integer overflow between implementations).In a separate commit, I also fixed the compiler warnings in qa_utils.cc:
icompare
, which I accidentally introduced in Fix undefined behaviour in dot product kernels #655