From: Dave Airlie Date: Wed, 10 Jan 2018 04:36:37 +0000 (+0000) Subject: r600/sb: adding lds oq tracking to the scheduler X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=46549bd6b62f251c588bead63866721f7cf9ea1c;p=mesa.git r600/sb: adding lds oq tracking to the scheduler This adds support for tracking the lds oq read/writes so can avoid scheduling other things in between. This patch just adds the tracking and assert to show problems. Acked-By: Roland Scheidegger Signed-off-by: Dave Airlie --- diff --git a/src/gallium/drivers/r600/sb/sb_sched.cpp b/src/gallium/drivers/r600/sb/sb_sched.cpp index 6d7ab671ff5..26e4811b1ce 100644 --- a/src/gallium/drivers/r600/sb/sb_sched.cpp +++ b/src/gallium/drivers/r600/sb/sb_sched.cpp @@ -312,7 +312,7 @@ alu_group_tracker::alu_group_tracker(shader &sh) gpr(), lt(), slots(), max_slots(sh.get_ctx().is_cayman() ? 4 : 5), has_mova(), uses_ar(), has_predset(), has_kill(), - updates_exec_mask(), chan_count(), interp_param(), next_id() { + updates_exec_mask(), consumes_lds_oqa(), produces_lds_oqa(), chan_count(), interp_param(), next_id() { available_slots = sh.get_ctx().has_trans ? 0x1F : 0x0F; } @@ -680,6 +680,8 @@ void alu_group_tracker::reset(bool keep_packed) { memset(slots, 0, sizeof(slots)); vmap.clear(); next_id = 0; + produces_lds_oqa = 0; + consumes_lds_oqa = 0; has_mova = false; uses_ar = false; has_predset = false; @@ -703,7 +705,8 @@ void alu_group_tracker::update_flags(alu_node* n) { has_mova |= (flags & AF_MOVA); has_predset |= (flags & AF_ANY_PRED); uses_ar |= n->uses_ar(); - + consumes_lds_oqa |= n->consumes_lds_oq(); + produces_lds_oqa |= n->produces_lds_oq(); if (flags & AF_ANY_PRED) { if (n->dst[2] != NULL) updates_exec_mask = true; @@ -1958,6 +1961,7 @@ void alu_kcache_tracker::reset() { void alu_clause_tracker::reset() { group = 0; slot_count = 0; + outstanding_lds_oqa_reads = 0; grp0.reset(); grp1.reset(); } @@ -1966,7 +1970,7 @@ alu_clause_tracker::alu_clause_tracker(shader &sh) : sh(sh), kt(sh.get_ctx().hw_class), slot_count(), grp0(sh), grp1(sh), group(), clause(), - push_exec_mask(), + push_exec_mask(), outstanding_lds_oqa_reads(), current_ar(), current_pr(), current_idx() {} void alu_clause_tracker::emit_group() { @@ -1988,6 +1992,8 @@ void alu_clause_tracker::emit_group() { clause->push_front(g); + outstanding_lds_oqa_reads += grp().get_consumes_lds_oqa(); + outstanding_lds_oqa_reads -= grp().get_produces_lds_oqa(); slot_count += grp().slot_count(); new_group(); @@ -2000,6 +2006,7 @@ void alu_clause_tracker::emit_clause(container_node *c) { kt.init_clause(clause->bc); + assert(!outstanding_lds_oqa_reads); assert(!current_ar); assert(!current_pr); diff --git a/src/gallium/drivers/r600/sb/sb_sched.h b/src/gallium/drivers/r600/sb/sb_sched.h index 5a2663442bc..91a34e078d9 100644 --- a/src/gallium/drivers/r600/sb/sb_sched.h +++ b/src/gallium/drivers/r600/sb/sb_sched.h @@ -127,6 +127,8 @@ class alu_group_tracker { bool has_kill; bool updates_exec_mask; + bool consumes_lds_oqa; + bool produces_lds_oqa; unsigned chan_count[4]; // param index + 1 (0 means that group doesn't refer to Params) @@ -166,6 +168,8 @@ public: unsigned literal_slot_count() { return (literal_count() + 1) >> 1; }; unsigned slot_count() { return inst_count() + literal_slot_count(); } + bool get_consumes_lds_oqa() { return consumes_lds_oqa; } + bool get_produces_lds_oqa() { return produces_lds_oqa; } alu_group_node* emit(); rp_kcache_tracker& kcache() { return kc; } @@ -212,6 +216,7 @@ class alu_clause_tracker { bool push_exec_mask; + unsigned outstanding_lds_oqa_reads; public: container_node conflict_nodes;