intel/compiler: Validate fuzzed instructions
... before giving them to the instruction compactor. Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2635>
This commit is contained in:
@@ -1243,6 +1243,9 @@ void brw_debug_compact_uncompact(const struct gen_device_info *devinfo,
|
|||||||
brw_inst *orig, brw_inst *uncompacted);
|
brw_inst *orig, brw_inst *uncompacted);
|
||||||
|
|
||||||
/* brw_eu_validate.c */
|
/* brw_eu_validate.c */
|
||||||
|
bool brw_validate_instruction(const struct gen_device_info *devinfo,
|
||||||
|
const brw_inst *inst, int offset,
|
||||||
|
struct disasm_info *disasm);
|
||||||
bool brw_validate_instructions(const struct gen_device_info *devinfo,
|
bool brw_validate_instructions(const struct gen_device_info *devinfo,
|
||||||
const void *assembly, int start_offset, int end_offset,
|
const void *assembly, int start_offset, int end_offset,
|
||||||
struct disasm_info *disasm);
|
struct disasm_info *disasm);
|
||||||
|
@@ -1937,7 +1937,7 @@ instruction_restrictions(const struct gen_device_info *devinfo,
|
|||||||
return error_msg;
|
return error_msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
bool
|
||||||
brw_validate_instruction(const struct gen_device_info *devinfo,
|
brw_validate_instruction(const struct gen_device_info *devinfo,
|
||||||
const brw_inst *inst, int offset,
|
const brw_inst *inst, int offset,
|
||||||
struct disasm_info *disasm)
|
struct disasm_info *disasm)
|
||||||
|
@@ -160,6 +160,9 @@ test_fuzz_compact_instruction(struct brw_codegen *p, brw_inst src)
|
|||||||
|
|
||||||
clear_pad_bits(p->devinfo, &instr);
|
clear_pad_bits(p->devinfo, &instr);
|
||||||
|
|
||||||
|
if (!brw_validate_instruction(p->devinfo, &instr, 0, NULL))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!test_compact_instruction(p, instr)) {
|
if (!test_compact_instruction(p, instr)) {
|
||||||
printf(" twiddled bits for fuzzing %d, %d\n", bit0, bit1);
|
printf(" twiddled bits for fuzzing %d, %d\n", bit0, bit1);
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user