summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-04-01 16:45:55 -0400
committerMarge Bot <[email protected]>2020-04-05 23:26:04 +0000
commit78ba6d50a42227812a3ba2b20f924f2d2cbf17db (patch)
treec32cfd66eeff2b8f491721ee86944bb4f382b8fe /src
parent40160c576d2c7f11e9690bb542a707a7cf0134af (diff)
pan/bit: Add 16-bit fmod tests
These raise another set of issues -- indeed, not all of these tests are passing, since it turns out I have an actual bug in the packing code. So after all this work, test bringup has identified an actual issue :) Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>
Diffstat (limited to 'src')
-rw-r--r--src/panfrost/bifrost/test/bi_test_pack.c26
-rw-r--r--src/panfrost/bifrost/test/bit.h4
2 files changed, 26 insertions, 4 deletions
diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c
index 36e392602f5..2755c0e879e 100644
--- a/src/panfrost/bifrost/test/bi_test_pack.c
+++ b/src/panfrost/bifrost/test/bi_test_pack.c
@@ -167,7 +167,7 @@ bit_generate_vector(uint32_t *mem)
/* Tests all 64 combinations of floating point modifiers for a given
* instruction / floating-type / test type */
-void
+static void
bit_fmod_helper(struct panfrost_device *dev,
enum bi_class c, unsigned size, bool fma,
uint32_t *input, enum bit_debug debug)
@@ -193,6 +193,10 @@ bit_fmod_helper(struct panfrost_device *dev,
ins.src_neg[0] = (inmod & 0x4);
ins.src_neg[1] = (inmod & 0x8);
+ /* Skip over tests that cannot run on FMA */
+ if (fma && (size == 16) && ins.src_abs[0] && ins.src_abs[1])
+ continue;
+
if (!bit_test_single(dev, &ins, input, fma, debug)) {
fprintf(stderr, "FAIL: fmod.%s%u.%s%s.%u\n",
bi_class_name(c),
@@ -204,3 +208,23 @@ bit_fmod_helper(struct panfrost_device *dev,
}
}
}
+
+void
+bit_fmod(struct panfrost_device *dev, enum bit_debug debug)
+{
+ float input32[4] = { 0.8, 1.7, 0.0, 0.0 };
+
+ uint32_t input16[4] = {
+ _mesa_float_to_half(input32[0]) | (_mesa_float_to_half(-1.2) << 16),
+ _mesa_float_to_half(input32[1]) | (_mesa_float_to_half(0.9) << 16),
+ 0, 0
+ };
+
+ for (unsigned sz = 16; sz <= 32; sz *= 2) {
+ uint32_t *input =
+ (sz == 16) ? input16 :
+ (uint32_t *) input32;
+
+ bit_fmod_helper(dev, BI_ADD, sz, true, input, debug);
+ }
+}
diff --git a/src/panfrost/bifrost/test/bit.h b/src/panfrost/bifrost/test/bit.h
index 5f01b345f0c..8e6279cbc72 100644
--- a/src/panfrost/bifrost/test/bit.h
+++ b/src/panfrost/bifrost/test/bit.h
@@ -70,9 +70,7 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA);
/* Packing tests */
void
-bit_fmod_helper(struct panfrost_device *dev,
- enum bi_class c, unsigned size, bool fma,
- uint32_t *input, enum bit_debug debug);
+bit_fmod(struct panfrost_device *dev, enum bit_debug debug);
#endif