aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-04-01 16:24:15 -0400
committerMarge Bot <[email protected]>2020-04-05 23:26:04 +0000
commit7c887d368e6d72f2b4d189a60a37ccee18b8a8cb (patch)
treeb9ce2622ee493e6c8a053def5a2792bcde184e0e /src/panfrost
parent14c534386742b44bc02349684b0a0e3972fec91d (diff)
pan/bit: Add helper for generating floating mod tests
We can iterate them, isn't that adorable! Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/bifrost/test/bi_test_pack.c52
-rw-r--r--src/panfrost/bifrost/test/bit.h11
2 files changed, 56 insertions, 7 deletions
diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c
index bd20252c20f..c693f8509f5 100644
--- a/src/panfrost/bifrost/test/bi_test_pack.c
+++ b/src/panfrost/bifrost/test/bi_test_pack.c
@@ -143,5 +143,55 @@ bit_test_single(struct panfrost_device *dev,
bi_pack(ctx, &prog.compiled);
return bit_vertex(dev, prog, input, 16, NULL, 0,
- s.r, 16, BIT_DEBUG_ALL);
+ s.r, 16, debug);
+}
+
+/* Utilities for generating tests */
+
+static void
+bit_generate_vector(uint32_t *mem)
+{
+ for (unsigned i = 0; i < 4; ++i)
+ mem[i] = rand();
+}
+
+/* Tests all 64 combinations of floating point modifiers for a given
+ * instruction / floating-type / test type */
+
+void
+bit_fmod_helper(struct panfrost_device *dev,
+ enum bi_class c, unsigned size, bool fma,
+ uint32_t *input, enum bit_debug debug)
+{
+ nir_alu_type T = nir_type_float | size;
+
+ bi_instruction ins = {
+ .type = c,
+ .src = {
+ BIR_INDEX_REGISTER | 0,
+ BIR_INDEX_REGISTER | 1,
+ },
+ .src_types = { T, T },
+ .dest = BIR_INDEX_REGISTER | 2,
+ .dest_type = T,
+ };
+
+ for (unsigned outmod = 0; outmod < 4; ++outmod) {
+ for (unsigned inmod = 0; inmod < 16; ++inmod) {
+ ins.outmod = outmod;
+ ins.src_abs[0] = (inmod & 0x1);
+ ins.src_abs[1] = (inmod & 0x2);
+ ins.src_neg[0] = (inmod & 0x4);
+ ins.src_neg[1] = (inmod & 0x8);
+
+ if (!bit_test_single(dev, &ins, input, fma, debug)) {
+ fprintf(stderr, "FAIL: fmod.%s%u.%s%s.%u\n",
+ bi_class_name(c),
+ size,
+ fma ? "fma" : "add",
+ outmod ? bi_output_mod_name(outmod) : ".none",
+ inmod);
+ }
+ }
+ }
}
diff --git a/src/panfrost/bifrost/test/bit.h b/src/panfrost/bifrost/test/bit.h
index a45d18af44b..5f01b345f0c 100644
--- a/src/panfrost/bifrost/test/bit.h
+++ b/src/panfrost/bifrost/test/bit.h
@@ -48,7 +48,7 @@ bool
bit_vertex(struct panfrost_device *dev, panfrost_program prog,
uint32_t *iubo, size_t sz_ubo,
uint32_t *iattr, size_t sz_attr,
- uint32_t *expected, size_t sz_expected, enum bit_debug);
+ uint32_t *expected, size_t sz_expected, enum bit_debug debug);
/* BIT interpreter */
@@ -69,11 +69,10 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA);
/* Packing tests */
-bool
-bit_test_single(struct panfrost_device *dev,
- bi_instruction *ins,
- uint32_t input[4],
- bool fma);
+void
+bit_fmod_helper(struct panfrost_device *dev,
+ enum bi_class c, unsigned size, bool fma,
+ uint32_t *input, enum bit_debug debug);
#endif