Mesa (main): intel/validator: validate dst/src types against devinfo support
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 17 16:10:34 UTC 2022
Module: Mesa
Branch: main
Commit: 03e543a4221c27327266883a6fc0afb34eab7564
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=03e543a4221c27327266883a6fc0afb34eab7564
Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date: Sat Jun 11 00:23:44 2022 +0300
intel/validator: validate dst/src types against devinfo support
v2: deal with src3_a1/src3_a16 instruction types (Curro)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16985>
---
src/intel/compiler/brw_eu_validate.c | 52 +++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)
diff --git a/src/intel/compiler/brw_eu_validate.c b/src/intel/compiler/brw_eu_validate.c
index 8e36e655d09..a22e8719ddc 100644
--- a/src/intel/compiler/brw_eu_validate.c
+++ b/src/intel/compiler/brw_eu_validate.c
@@ -716,6 +716,57 @@ general_restrictions_based_on_operand_types(const struct intel_device_info *devi
}
}
+ enum brw_reg_type dst_type;
+
+ if (num_sources == 3) {
+ if (brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1)
+ dst_type = brw_inst_3src_a1_dst_type(devinfo, inst);
+ else
+ dst_type = brw_inst_3src_a16_dst_type(devinfo, inst);
+ } else {
+ dst_type = inst_dst_type(devinfo, inst);
+ }
+
+ ERROR_IF(dst_type == BRW_REGISTER_TYPE_DF &&
+ !devinfo->has_64bit_float,
+ "64-bit float destination, but platform does not support it");
+
+ ERROR_IF((dst_type == BRW_REGISTER_TYPE_Q ||
+ dst_type == BRW_REGISTER_TYPE_UQ) &&
+ !devinfo->has_64bit_int,
+ "64-bit int destination, but platform does not support it");
+
+ for (unsigned s = 0; s < num_sources; s++) {
+ enum brw_reg_type src_type;
+ if (num_sources == 3) {
+ if (brw_inst_access_mode(devinfo, inst) == BRW_ALIGN_1) {
+ switch (s) {
+ case 0: src_type = brw_inst_3src_a1_src0_type(devinfo, inst); break;
+ case 1: src_type = brw_inst_3src_a1_src1_type(devinfo, inst); break;
+ case 2: src_type = brw_inst_3src_a1_src2_type(devinfo, inst); break;
+ default: unreachable("invalid src");
+ }
+ } else {
+ src_type = brw_inst_3src_a16_src_type(devinfo, inst);
+ }
+ } else {
+ switch (s) {
+ case 0: src_type = brw_inst_src0_type(devinfo, inst); break;
+ case 1: src_type = brw_inst_src1_type(devinfo, inst); break;
+ default: unreachable("invalid src");
+ }
+ }
+
+ ERROR_IF(src_type == BRW_REGISTER_TYPE_DF &&
+ !devinfo->has_64bit_float,
+ "64-bit float source, but platform does not support it");
+
+ ERROR_IF((src_type == BRW_REGISTER_TYPE_Q ||
+ src_type == BRW_REGISTER_TYPE_UQ) &&
+ !devinfo->has_64bit_int,
+ "64-bit int source, but platform does not support it");
+ }
+
if (num_sources == 3)
return error_msg;
@@ -741,7 +792,6 @@ general_restrictions_based_on_operand_types(const struct intel_device_info *devi
*/
unsigned dst_stride = STRIDE(brw_inst_dst_hstride(devinfo, inst));
- enum brw_reg_type dst_type = inst_dst_type(devinfo, inst);
bool dst_type_is_byte =
inst_dst_type(devinfo, inst) == BRW_REGISTER_TYPE_B ||
inst_dst_type(devinfo, inst) == BRW_REGISTER_TYPE_UB;
More information about the mesa-commit
mailing list