diff --git a/src/mesa/drivers/dri/i965/brw_eu_validate.c b/src/mesa/drivers/dri/i965/brw_eu_validate.c index 2de2ea1..4cd0b0e 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_validate.c +++ b/src/mesa/drivers/dri/i965/brw_eu_validate.c @@ -364,6 +364,15 @@ is_unsupported_inst(const struct brw_device_info *devinfo, return (inst_info[brw_inst_opcode(devinfo, inst)].gen & gen) == 0; } +static bool +last_inst_no_eot(const struct brw_device_info *devinfo, + const brw_inst *inst) +{ + return (brw_inst_opcode(devinfo, inst) != BRW_OPCODE_SEND && + brw_inst_opcode(devinfo, inst) != BRW_OPCODE_SENDC) || + !brw_inst_eot(devinfo, inst); +} + bool brw_validate_instructions(const struct brw_codegen *p, int start_offset, struct annotation_info *annotation) @@ -394,6 +403,11 @@ brw_validate_instructions(const struct brw_codegen *p, int start_offset, break; } + if (src_offset == p->next_insn_offset - start_offset - sizeof(brw_inst)) { + ERROR_IF(last_inst_no_eot(devinfo, inst), + "Last instruction does not end the thread"); + } + ERROR_IF(is_unsupported_inst(devinfo, inst), "Instruction not supported on this Gen"); diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp index 46b45a5..9eb7759 100644 --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp @@ -1601,6 +1601,9 @@ instruction_scheduler::run(cfg_t *cfg) count_reads_remaining(inst); } + bool starts_with_cf = block->start()->is_control_flow() || block->start()->has_side_effects(); + bool ends_with_cf = block->end()->is_control_flow() || block->end()->has_side_effects(); + add_insts_from_block(block); calculate_deps(); @@ -1610,6 +1613,12 @@ instruction_scheduler::run(cfg_t *cfg) } schedule_instructions(block); + + if (starts_with_cf && !(block->start()->is_control_flow() || block->start()->has_side_effects())) + abort(); + + if (ends_with_cf && !(block->end()->is_control_flow() || block->end()->has_side_effects())) + abort(); } if (debug && !post_reg_alloc) {