Generate random integers with uniform_int_distribution#677
Generate random integers with uniform_int_distribution#677jdemel merged 2 commits intognuradio:mainfrom
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 <argilo@gmail.com>
Signed-off-by: Clayton Smith <argilo@gmail.com>
9d9d03e to
992e7f5
Compare
|
I rebased on |
Fixes #688.
Random integer generation in
load_random_datahas 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_tvalues 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_tanduint32_tvalues are multiples of 256.uint16_tvalues 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_distributionwithstd::uniform_int_distribution.I had to keep
int16_tgeneration 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