Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/intgemm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2020-04-04 19:49:10 +0300
committerKenneth Heafield <github@kheafield.com>2020-04-04 19:49:10 +0300
commit8fb1582b6d63d7df5f9d7b488199868d9093ff84 (patch)
tree85b081171f8e44103e0a3f444d1e93e9f5093265
parentc35e3d2281ae50af675c8a323726620f9e23332b (diff)
More thoroughly test reduction code
-rw-r--r--test/tile_test.inl31
1 files changed, 17 insertions, 14 deletions
diff --git a/test/tile_test.inl b/test/tile_test.inl
index c612ace..7e23a81 100644
--- a/test/tile_test.inl
+++ b/test/tile_test.inl
@@ -67,21 +67,24 @@ struct Pack32Test {
std::mt19937 gen;
std::uniform_int_distribution<int32_t> dist(std::numeric_limits<int32_t>::min(), std::numeric_limits<int32_t>::max());
int32_t reference[ArrayLen];
- memset(reference, 0, sizeof(reference));
- for (Index i = 0; i < Valid; ++i) {
- int32_t temp[kPack];
- for (std::size_t j = 0; j < kPack; ++j) {
- temp[j] = dist(gen);
- reference[i] += temp[j];
+ // Do 20 different loops of random numbers.
+ for (Index attempt = 0; attempt < 20; ++attempt) {
+ memset(reference, 0, sizeof(reference));
+ for (Index i = 0; i < Valid; ++i) {
+ int32_t temp[kPack];
+ for (std::size_t j = 0; j < kPack; ++j) {
+ temp[j] = dist(gen);
+ reference[i] += temp[j];
+ }
+ memcpy(&regs[i], temp, sizeof(Register));
+ }
+ // Decay type for template.
+ Register *indirect = regs;
+ Pack32<Valid, Sum32Op>(indirect);
+ const int32_t *test = reinterpret_cast<const int32_t*>(regs);
+ for (Index i = 0; i < Valid; ++i) {
+ CHECK(test[i] == reference[i]);
}
- memcpy(&regs[i], temp, sizeof(Register));
- }
- // Decay type for template.
- Register *indirect = regs;
- Pack32<Valid, Sum32Op>(indirect);
- const int32_t *test = reinterpret_cast<const int32_t*>(regs);
- for (Index i = 0; i < Valid; ++i) {
- CHECK(test[i] == reference[i]);
}
}
};