Mesa (master): pan/bit: Add SELECT tests
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 15:06:57 UTC 2020
Module: Mesa
Branch: master
Commit: 64c33a459fa9a5c8b49a967c0fee75d5f80317d3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=64c33a459fa9a5c8b49a967c0fee75d5f80317d3
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Fri Apr 24 20:52:40 2020 -0400
pan/bit: Add SELECT tests
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4766>
---
src/panfrost/bifrost/test/bi_test_pack.c | 34 ++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c
index 0486240f230..cdbb1a27edd 100644
--- a/src/panfrost/bifrost/test/bi_test_pack.c
+++ b/src/panfrost/bifrost/test/bi_test_pack.c
@@ -373,6 +373,36 @@ bit_reduce_helper(struct panfrost_device *dev, uint32_t *input, enum bit_debug d
}
}
+static void
+bit_select_helper(struct panfrost_device *dev, uint32_t *input, unsigned size, enum bit_debug debug)
+{
+ unsigned C = 32 / size;
+ bi_instruction ins = bit_ins(BI_SELECT, C, nir_type_uint, 32);
+
+ for (unsigned c = 0; c < C; ++c)
+ ins.src_types[c] = nir_type_uint | size;
+
+ if (size == 8) {
+ /* SCHEDULER: We can only read 3 registers at once. */
+ ins.src[2] = ins.src[0];
+ }
+
+ /* Each argument has swizzle {lo, hi} so 2^C options */
+ unsigned hi = (size == 16) ? 1 : 2;
+
+ for (unsigned add = 0; add < ((size == 16) ? 2 : 1); ++add) {
+ for (unsigned swizzle = 0; swizzle < (1 << C); ++swizzle) {
+ for (unsigned i = 0; i < C; ++i)
+ ins.swizzle[i][0] = ((swizzle >> i) & 1) ? hi : 0;
+
+ if (!bit_test_single(dev, &ins, input, !add, debug)) {
+ fprintf(stderr, "FAIL: select.%u.%u\n",
+ size, swizzle);
+ }
+ }
+ }
+}
+
static void
bit_convert_helper(struct panfrost_device *dev, unsigned from_size,
unsigned to_size, unsigned cx, unsigned cy, bool FMA,
@@ -511,4 +541,8 @@ bit_packing(struct panfrost_device *dev, enum bit_debug debug)
memcpy(mscale_input, input32, sizeof(input32));
mscale_input[3] = 0x7;
bit_fma_mscale_helper(dev, mscale_input, debug);
+
+ for (unsigned sz = 8; sz <= 16; sz *= 2) {
+ bit_select_helper(dev, (uint32_t *) input32, 8, debug);
+ }
}
More information about the mesa-commit
mailing list