Lines Matching refs:inst

66    schedule_node(backend_instruction *inst, instruction_scheduler *sched);
71 backend_instruction *inst;
125 switch (inst->opcode) {
160 switch (inst->opcode) {
384 switch (inst->sfid) {
386 unsigned msg_type = (inst->desc >> 12) & 0x1f;
403 switch (brw_fb_desc_msg_type(isa->devinfo, inst->desc)) {
428 switch ((inst->desc >> 14) & 0x1f) {
498 switch ((inst->desc >> 14) & 0x1f) {
534 switch (lsc_msg_desc_opcode(isa->devinfo, inst->desc)) {
671 virtual int issue_time(backend_instruction *inst) = 0;
673 virtual void count_reads_remaining(backend_instruction *inst) = 0;
675 virtual void update_register_pressure(backend_instruction *inst) = 0;
676 virtual int get_register_pressure_benefit(backend_instruction *inst) = 0;
742 bool is_compressed(const fs_inst *inst);
744 int issue_time(backend_instruction *inst);
747 void count_reads_remaining(backend_instruction *inst);
749 void update_register_pressure(backend_instruction *inst);
750 int get_register_pressure_benefit(backend_instruction *inst);
763 is_src_duplicate(fs_inst *inst, int src)
766 if (inst->src[i].equals(inst->src[src]))
775 fs_inst *inst = (fs_inst *)be;
780 for (int i = 0; i < inst->sources; i++) {
781 if (is_src_duplicate(inst, i))
784 if (inst->src[i].file == VGRF) {
785 reads_remaining[inst->src[i].nr]++;
786 } else if (inst->src[i].file == FIXED_GRF) {
787 if (inst->src[i].nr >= hw_reg_count)
790 for (unsigned j = 0; j < regs_read(inst, i); j++)
791 hw_reads_remaining[inst->src[i].nr + j]++;
857 fs_inst *inst = (fs_inst *)be;
862 if (inst->dst.file == VGRF) {
863 written[inst->dst.nr] = true;
866 for (int i = 0; i < inst->sources; i++) {
867 if (is_src_duplicate(inst, i))
870 if (inst->src[i].file == VGRF) {
871 reads_remaining[inst->src[i].nr]--;
872 } else if (inst->src[i].file == FIXED_GRF &&
873 inst->src[i].nr < hw_reg_count) {
874 for (unsigned off = 0; off < regs_read(inst, i); off++)
875 hw_reads_remaining[inst->src[i].nr + off]--;
883 fs_inst *inst = (fs_inst *)be;
886 if (inst->dst.file == VGRF) {
887 if (!BITSET_TEST(livein[block_idx], inst->dst.nr) &&
888 !written[inst->dst.nr])
889 benefit -= v->alloc.sizes[inst->dst.nr];
892 for (int i = 0; i < inst->sources; i++) {
893 if (is_src_duplicate(inst, i))
896 if (inst->src[i].file == VGRF &&
897 !BITSET_TEST(liveout[block_idx], inst->src[i].nr) &&
898 reads_remaining[inst->src[i].nr] == 1)
899 benefit += v->alloc.sizes[inst->src[i].nr];
901 if (inst->src[i].file == FIXED_GRF &&
902 inst->src[i].nr < hw_reg_count) {
903 for (unsigned off = 0; off < regs_read(inst, i); off++) {
904 int reg = inst->src[i].nr + off;
922 int issue_time(backend_instruction *inst);
925 void count_reads_remaining(backend_instruction *inst);
927 void update_register_pressure(backend_instruction *inst);
928 int get_register_pressure_benefit(backend_instruction *inst);
959 schedule_node::schedule_node(backend_instruction *inst,
965 this->inst = inst;
990 foreach_inst_in_block(backend_instruction, inst, block) {
991 schedule_node *n = new(mem_ctx) schedule_node(inst, this);
1003 n->delay = issue_time(n->inst);
1024 n->unblocked_time + issue_time(n->inst) + n->child_latency[i]);
1034 n->exit = (n->inst->opcode == BRW_OPCODE_HALT ? n : NULL);
1094 is_scheduling_barrier(const backend_instruction *inst)
1096 return inst->opcode == SHADER_OPCODE_HALT_TARGET ||
1097 inst->is_control_flow() ||
1098 inst->has_side_effects();
1115 if (is_scheduling_barrier(prev->inst))
1124 if (is_scheduling_barrier(next->inst))
1135 fs_instruction_scheduler::is_compressed(const fs_inst *inst)
1137 return inst->exec_size == 16;
1163 fs_inst *inst = (fs_inst *)n->inst;
1165 if (is_scheduling_barrier(inst))
1169 for (int i = 0; i < inst->sources; i++) {
1170 if (inst->src[i].file == VGRF) {
1172 for (unsigned r = 0; r < regs_read(inst, i); r++)
1173 add_dep(last_grf_write[inst->src[i].nr + r], n);
1175 for (unsigned r = 0; r < regs_read(inst, i); r++) {
1176 add_dep(last_grf_write[inst->src[i].nr * 16 +
1177 inst->src[i].offset / REG_SIZE + r], n);
1180 } else if (inst->src[i].file == FIXED_GRF) {
1182 for (unsigned r = 0; r < regs_read(inst, i); r++)
1183 add_dep(last_grf_write[inst->src[i].nr + r], n);
1187 } else if (inst->src[i].is_accumulator()) {
1189 } else if (inst->src[i].file == ARF && !inst->src[i].is_null()) {
1194 if (inst->base_mrf != -1) {
1195 for (int i = 0; i < inst->mlen; i++) {
1200 add_dep(last_mrf_write[inst->base_mrf + i], n);
1204 if (const unsigned mask = inst->flags_read(v->devinfo)) {
1213 if (inst->reads_accumulator_implicitly()) {
1218 if (inst->dst.file == VGRF) {
1220 for (unsigned r = 0; r < regs_written(inst); r++) {
1221 add_dep(last_grf_write[inst->dst.nr + r], n);
1222 last_grf_write[inst->dst.nr + r] = n;
1225 for (unsigned r = 0; r < regs_written(inst); r++) {
1226 add_dep(last_grf_write[inst->dst.nr * 16 +
1227 inst->dst.offset / REG_SIZE + r], n);
1228 last_grf_write[inst->dst.nr * 16 +
1229 inst->dst.offset / REG_SIZE + r] = n;
1232 } else if (inst->dst.file == MRF) {
1233 int reg = inst->dst.nr & ~BRW_MRF_COMPR4;
1237 if (is_compressed(inst)) {
1238 if (inst->dst.nr & BRW_MRF_COMPR4)
1245 } else if (inst->dst.file == FIXED_GRF) {
1247 for (unsigned r = 0; r < regs_written(inst); r++) {
1248 add_dep(last_grf_write[inst->dst.nr + r], n);
1249 last_grf_write[inst->dst.nr + r] = n;
1255 } else if (inst->dst.is_accumulator()) {
1258 } else if (inst->dst.file == ARF && !inst->dst.is_null()) {
1262 if (inst->mlen > 0 && inst->base_mrf != -1) {
1263 for (unsigned i = 0; i < inst->implied_mrf_writes(); i++) {
1264 add_dep(last_mrf_write[inst->base_mrf + i], n);
1265 last_mrf_write[inst->base_mrf + i] = n;
1269 if (const unsigned mask = inst->flags_written(v->devinfo)) {
1280 if (inst->writes_accumulator_implicitly(v->devinfo) &&
1281 !inst->dst.is_accumulator()) {
1295 fs_inst *inst = (fs_inst *)n->inst;
1298 for (int i = 0; i < inst->sources; i++) {
1299 if (inst->src[i].file == VGRF) {
1301 for (unsigned r = 0; r < regs_read(inst, i); r++)
1302 add_dep(n, last_grf_write[inst->src[i].nr + r], 0);
1304 for (unsigned r = 0; r < regs_read(inst, i); r++) {
1305 add_dep(n, last_grf_write[inst->src[i].nr * 16 +
1306 inst->src[i].offset / REG_SIZE + r], 0);
1309 } else if (inst->src[i].file == FIXED_GRF) {
1311 for (unsigned r = 0; r < regs_read(inst, i); r++)
1312 add_dep(n, last_grf_write[inst->src[i].nr + r], 0);
1316 } else if (inst->src[i].is_accumulator()) {
1318 } else if (inst->src[i].file == ARF && !inst->src[i].is_null()) {
1323 if (inst->base_mrf != -1) {
1324 for (int i = 0; i < inst->mlen; i++) {
1329 add_dep(n, last_mrf_write[inst->base_mrf + i], 2);
1333 if (const unsigned mask = inst->flags_read(v->devinfo)) {
1342 if (inst->reads_accumulator_implicitly()) {
1349 if (inst->dst.file == VGRF) {
1351 for (unsigned r = 0; r < regs_written(inst); r++)
1352 last_grf_write[inst->dst.nr + r] = n;
1354 for (unsigned r = 0; r < regs_written(inst); r++) {
1355 last_grf_write[inst->dst.nr * 16 +
1356 inst->dst.offset / REG_SIZE + r] = n;
1359 } else if (inst->dst.file == MRF) {
1360 int reg = inst->dst.nr & ~BRW_MRF_COMPR4;
1364 if (is_compressed(inst)) {
1365 if (inst->dst.nr & BRW_MRF_COMPR4)
1372 } else if (inst->dst.file == FIXED_GRF) {
1374 for (unsigned r = 0; r < regs_written(inst); r++)
1375 last_grf_write[inst->dst.nr + r] = n;
1379 } else if (inst->dst.is_accumulator()) {
1381 } else if (inst->dst.file == ARF && !inst->dst.is_null()) {
1385 if (inst->mlen > 0 && inst->base_mrf != -1) {
1386 for (unsigned i = 0; i < inst->implied_mrf_writes(); i++) {
1387 last_mrf_write[inst->base_mrf + i] = n;
1391 if (const unsigned mask = inst->flags_written(v->devinfo)) {
1400 if (inst->writes_accumulator_implicitly(v->devinfo)) {
1427 vec4_instruction *inst = (vec4_instruction *)n->inst;
1429 if (is_scheduling_barrier(inst))
1434 if (inst->src[i].file == VGRF) {
1435 for (unsigned j = 0; j < regs_read(inst, i); ++j)
1436 add_dep(last_grf_write[inst->src[i].nr + j], n);
1437 } else if (inst->src[i].file == FIXED_GRF) {
1439 } else if (inst->src[i].is_accumulator()) {
1442 } else if (inst->src[i].file == ARF && !inst->src[i].is_null()) {
1447 if (inst->reads_g0_implicitly())
1450 if (!inst->is_send_from_grf()) {
1451 for (int i = 0; i < inst->mlen; i++) {
1456 add_dep(last_mrf_write[inst->base_mrf + i], n);
1460 if (inst->reads_flag()) {
1465 if (inst->reads_accumulator_implicitly()) {
1471 if (inst->dst.file == VGRF) {
1472 for (unsigned j = 0; j < regs_written(inst); ++j) {
1473 add_dep(last_grf_write[inst->dst.nr + j], n);
1474 last_grf_write[inst->dst.nr + j] = n;
1476 } else if (inst->dst.file == MRF) {
1477 add_dep(last_mrf_write[inst->dst.nr], n);
1478 last_mrf_write[inst->dst.nr] = n;
1479 } else if (inst->dst.file == FIXED_GRF) {
1482 } else if (inst->dst.is_accumulator()) {
1485 } else if (inst->dst.file == ARF && !inst->dst.is_null()) {
1489 if (inst->mlen > 0 && !inst->is_send_from_grf()) {
1490 for (unsigned i = 0; i < inst->implied_mrf_writes(); i++) {
1491 add_dep(last_mrf_write[inst->base_mrf + i], n);
1492 last_mrf_write[inst->base_mrf + i] = n;
1496 if (inst->writes_flag(v->devinfo)) {
1501 if (inst->writes_accumulator_implicitly(v->devinfo) &&
1502 !inst->dst.is_accumulator()) {
1516 vec4_instruction *inst = (vec4_instruction *)n->inst;
1520 if (inst->src[i].file == VGRF) {
1521 for (unsigned j = 0; j < regs_read(inst, i); ++j)
1522 add_dep(n, last_grf_write[inst->src[i].nr + j]);
1523 } else if (inst->src[i].file == FIXED_GRF) {
1525 } else if (inst->src[i].is_accumulator()) {
1527 } else if (inst->src[i].file == ARF && !inst->src[i].is_null()) {
1532 if (!inst->is_send_from_grf()) {
1533 for (int i = 0; i < inst->mlen; i++) {
1538 add_dep(n, last_mrf_write[inst->base_mrf + i], 2);
1542 if (inst->reads_flag()) {
1546 if (inst->reads_accumulator_implicitly()) {
1553 if (inst->dst.file == VGRF) {
1554 for (unsigned j = 0; j < regs_written(inst); ++j)
1555 last_grf_write[inst->dst.nr + j] = n;
1556 } else if (inst->dst.file == MRF) {
1557 last_mrf_write[inst->dst.nr] = n;
1558 } else if (inst->dst.file == FIXED_GRF) {
1560 } else if (inst->dst.is_accumulator()) {
1562 } else if (inst->dst.file == ARF && !inst->dst.is_null()) {
1566 if (inst->mlen > 0 && !inst->is_send_from_grf()) {
1567 for (unsigned i = 0; i < inst->implied_mrf_writes(); i++) {
1568 last_mrf_write[inst->base_mrf + i] = n;
1572 if (inst->writes_flag(v->devinfo)) {
1576 if (inst->writes_accumulator_implicitly(v->devinfo)) {
1613 fs_inst *inst = (fs_inst *)n->inst;
1618 get_register_pressure_benefit(chosen->inst);
1625 int register_pressure_benefit = get_register_pressure_benefit(n->inst);
1661 fs_inst *chosen_inst = (fs_inst *)chosen->inst;
1668 if (inst->size_written <= 4 * inst->exec_size &&
1673 } else if (inst->size_written > chosen_inst->size_written) {
1735 const fs_inst *inst = static_cast<fs_inst *>(inst0);
1736 const unsigned overhead = v->grf_used && has_bank_conflict(isa, inst) ?
1737 DIV_ROUND_UP(inst->dst.component_size(inst->exec_size), REG_SIZE) : 0;
1738 if (is_compressed(inst))
1775 chosen->inst->exec_node::remove();
1776 block->instructions.push_tail(chosen->inst);
1780 reg_pressure -= get_register_pressure_benefit(chosen->inst);
1781 update_register_pressure(chosen->inst);
1795 time += issue_time(chosen->inst);
1799 bs->dump_instruction(chosen->inst);
1817 bs->dump_instruction(child->inst);
1836 if (devinfo->ver < 6 && chosen->inst->is_math()) {
1838 if (n->inst->is_math())
1868 foreach_inst_in_block(fs_inst, inst, block)
1869 count_reads_remaining(inst);