intel/compiler: Validation for SRND instructions

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36529>
This commit is contained in:
Sushma Venkatesh Reddy 2025-07-30 22:19:32 +00:00 committed by Marge Bot
parent fe6d364ca8
commit a1c5f1ccf6
2 changed files with 42 additions and 0 deletions

View file

@ -641,6 +641,17 @@ general_restrictions_based_on_operand_types(const struct brw_isa_info *isa,
}
}
if (devinfo->ver >= 20) {
if (inst->opcode == BRW_OPCODE_SRND) {
bool valid = false;
if (inst->dst.type == BRW_TYPE_HF &&
inst->src[0].type == BRW_TYPE_F &&
inst->src[1].type == BRW_TYPE_F)
valid = true;
ERROR_IF(!valid, "Invalid type combination for SRND.");
}
}
enum brw_reg_type dst_type = inst->dst.type;
ERROR_IF(brw_type_is_bfloat(dst_type) &&

View file

@ -3921,3 +3921,34 @@ TEST_P(validation_test, bfloat_restrictions)
clear_instructions(p);
}
}
TEST_P(validation_test, srnd_type_and_immediate_restrictions)
{
if (devinfo.ver < 20)
return;
struct brw_reg dst = retype(g0, BRW_TYPE_HF);
dst.hstride = 2;
brw_SRND(p,
dst,
retype(g0, BRW_TYPE_F),
retype(g0, BRW_TYPE_F));
EXPECT_TRUE(validate(p));
clear_instructions(p);
brw_SRND(p,
dst,
retype(g0, BRW_TYPE_F),
brw_imm_f(42.0f));
EXPECT_TRUE(validate(p));
clear_instructions(p);
/* Invalid type combinations */
brw_SRND(p,
dst,
retype(g0, BRW_TYPE_F),
retype(g0, BRW_TYPE_UW));
EXPECT_FALSE(validate(p));
clear_instructions(p);
}