agx: Validate that collect sources are the same size
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 15 Apr 2023 13:39:28 +0000 (09:39 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 7 May 2023 13:10:36 +0000 (09:10 -0400)
RA asserts this, but by then if you've messed it up, the failure is inscrutable.
Let's check it in the validator for more pleasant debugging.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22891>

src/asahi/compiler/agx_validate.c

index ff6bbb8..ae17f7f 100644 (file)
@@ -96,6 +96,8 @@ agx_validate_sources(agx_instr *I)
           */
          agx_validate_assert(src.size == AGX_SIZE_16);
          agx_validate_assert(src.value < (1 << (ldst ? 16 : 8)));
+      } else if (I->op == AGX_OPCODE_COLLECT && !agx_is_null(src)) {
+         agx_validate_assert(src.size == I->src[0].size);
       }
    }