<div dir="ltr"><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Patch is:
Tested-by: Bartosz Tomczyk <<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">bartosz.tomczyk86 at gmail.com</a>></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 7, 2017 at 10:30 PM, Heiko Przybyl <span dir="ltr"><<a href="mailto:lil_tux@web.de" target="_blank">lil_tux@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When fixing the stalls on evergreen I introduced leaking of the useinfo<br>
structure(s). Sorry. Instead of allocating a new object to hold 3 values<br>
where only one is actually used, rework the list to just store the node<br>
pointer. Thus no allocating and deallocation is needed. Since use_info<br>
and use_kind aren't used anywhere, drop them and reduce code complexity.<br>
This might also save some small amount of cycles.<br>
<br>
Thanks to Bartosz Tomczyk for finding the bug.<br>
<br>
Reported-by: Bartosz Tomczyk <<a href="mailto:bartosz.tomczyk86@gmail.com">bartosz.tomczyk86@gmail.com</a>><br>
Signed-off-by: Heiko Przybyl <<a href="mailto:lil_tux@web.de">lil_tux@web.de</a>><br>
Supersedes: <a href="https://patchwork.freedesktop.org/patch/135852" rel="noreferrer" target="_blank">https://patchwork.freedesktop.<wbr>org/patch/135852</a><br>
---<br>
src/gallium/drivers/r600/sb/<wbr>sb_def_use.cpp | 29 +++++++++++------------------<br>
src/gallium/drivers/r600/sb/<wbr>sb_gcm.cpp | 16 ++++++++--------<br>
src/gallium/drivers/r600/sb/<wbr>sb_ir.h | 23 ++---------------------<br>
src/gallium/drivers/r600/sb/<wbr>sb_valtable.cpp | 13 ++++++-------<br>
4 files changed, 27 insertions(+), 54 deletions(-)<br>
<br>
diff --git a/src/gallium/drivers/r600/sb/<wbr>sb_def_use.cpp b/src/gallium/drivers/r600/sb/<wbr>sb_def_use.cpp<br>
index a512d92086..68ab4ca26c 100644<br>
--- a/src/gallium/drivers/r600/sb/<wbr>sb_def_use.cpp<br>
+++ b/src/gallium/drivers/r600/sb/<wbr>sb_def_use.cpp<br>
@@ -106,58 +106,51 @@ void def_use::process_defs(node *n, vvec &vv, bool arr_def) {<br>
}<br>
<br>
void def_use::process_uses(node* n) {<br>
- unsigned k = 0;<br>
-<br>
- for (vvec::iterator I = n->src.begin(), E = n->src.end(); I != E;<br>
- ++I, ++k) {<br>
+ for (vvec::iterator I = n->src.begin(), E = n->src.end(); I != E; ++I) {<br>
value *v = *I;<br>
if (!v || v->is_readonly())<br>
continue;<br>
<br>
if (v->is_rel()) {<br>
if (!v->rel->is_readonly())<br>
- v->rel->add_use(n, UK_SRC_REL, k);<br>
+ v->rel->add_use(n);<br>
<br>
- unsigned k2 = 0;<br>
for (vvec::iterator I = v->muse.begin(), E = v->muse.end();<br>
- I != E; ++I, ++k2) {<br>
+ I != E; ++I) {<br>
value *v = *I;<br>
if (!v)<br>
continue;<br>
<br>
- v->add_use(n, UK_MAYUSE, k2);<br>
+ v->add_use(n);<br>
}<br>
} else<br>
- v->add_use(n, UK_SRC, k);<br>
+ v->add_use(n);<br>
}<br>
<br>
- k = 0;<br>
- for (vvec::iterator I = n->dst.begin(), E = n->dst.end(); I != E;<br>
- ++I, ++k) {<br>
+ for (vvec::iterator I = n->dst.begin(), E = n->dst.end(); I != E; ++I) {<br>
value *v = *I;<br>
if (!v || !v->is_rel())<br>
continue;<br>
<br>
if (!v->rel->is_readonly())<br>
- v->rel->add_use(n, UK_DST_REL, k);<br>
- unsigned k2 = 0;<br>
+ v->rel->add_use(n);<br>
for (vvec::iterator I = v->muse.begin(), E = v->muse.end();<br>
- I != E; ++I, ++k2) {<br>
+ I != E; ++I) {<br>
value *v = *I;<br>
if (!v)<br>
continue;<br>
<br>
- v->add_use(n, UK_MAYDEF, k2);<br>
+ v->add_use(n);<br>
}<br>
}<br>
<br>
if (n->pred)<br>
- n->pred->add_use(n, UK_PRED, 0);<br>
+ n->pred->add_use(n);<br>
<br>
if (n->type == NT_IF) {<br>
if_node *i = static_cast<if_node*>(n);<br>
if (i->cond)<br>
- i->cond->add_use(i, UK_COND, 0);<br>
+ i->cond->add_use(i);<br>
}<br>
}<br>
<br>
diff --git a/src/gallium/drivers/r600/sb/<wbr>sb_gcm.cpp b/src/gallium/drivers/r600/sb/<wbr>sb_gcm.cpp<br>
index 9c75389ada..7b43a32818 100644<br>
--- a/src/gallium/drivers/r600/sb/<wbr>sb_gcm.cpp<br>
+++ b/src/gallium/drivers/r600/sb/<wbr>sb_gcm.cpp<br>
@@ -200,27 +200,27 @@ void gcm::td_release_val(value *v) {<br>
);<br>
<br>
for (uselist::iterator I = v->uses.begin(), E = v->uses.end(); I != E; ++I) {<br>
- use_info *u = *I;<br>
- if (u->op->parent != &pending) {<br>
+ node *op = *I;<br>
+ if (op->parent != &pending) {<br>
continue;<br>
}<br>
<br>
GCM_DUMP(<br>
sblog << "td used in ";<br>
- dump::dump_op(u->op);<br>
+ dump::dump_op(op);<br>
sblog << "\n";<br>
);<br>
<br>
- assert(uses[u->op] > 0);<br>
- if (--uses[u->op] == 0) {<br>
+ assert(uses[op] > 0);<br>
+ if (--uses[op] == 0) {<br>
GCM_DUMP(<br>
sblog << "td released : ";<br>
- dump::dump_op(u->op);<br>
+ dump::dump_op(op);<br>
sblog << "\n";<br>
);<br>
<br>
- pending.remove_node(u->op);<br>
- ready.push_back(u->op);<br>
+ pending.remove_node(op);<br>
+ ready.push_back(op);<br>
}<br>
}<br>
<br>
diff --git a/src/gallium/drivers/r600/sb/<wbr>sb_ir.h b/src/gallium/drivers/r600/sb/<wbr>sb_ir.h<br>
index 74c0549a81..ec973e7bfc 100644<br>
--- a/src/gallium/drivers/r600/sb/<wbr>sb_ir.h<br>
+++ b/src/gallium/drivers/r600/sb/<wbr>sb_ir.h<br>
@@ -435,26 +435,7 @@ sb_ostream& operator << (sb_ostream &o, value &v);<br>
<br>
typedef uint32_t value_hash;<br>
<br>
-enum use_kind {<br>
- UK_SRC,<br>
- UK_SRC_REL,<br>
- UK_DST_REL,<br>
- UK_MAYDEF,<br>
- UK_MAYUSE,<br>
- UK_PRED,<br>
- UK_COND<br>
-};<br>
-<br>
-struct use_info {<br>
- node *op;<br>
- use_kind kind;<br>
- int arg;<br>
-<br>
- use_info(node *n, use_kind kind, int arg)<br>
- : op(n), kind(kind), arg(arg) {}<br>
-};<br>
-<br>
-typedef std::list< use_info * > uselist;<br>
+typedef std::list< node * > uselist;<br>
<br>
enum constraint_kind {<br>
CK_SAME_REG,<br>
@@ -585,7 +566,7 @@ public:<br>
&& literal_value != literal(1.0);<br>
}<br>
<br>
- void add_use(node *n, use_kind kind, int arg);<br>
+ void add_use(node *n);<br>
void remove_use(const node *n);<br>
<br>
value_hash hash();<br>
diff --git a/src/gallium/drivers/r600/sb/<wbr>sb_valtable.cpp b/src/gallium/drivers/r600/sb/<wbr>sb_valtable.cpp<br>
index a8b7b49cd4..a85537c2ad 100644<br>
--- a/src/gallium/drivers/r600/sb/<wbr>sb_valtable.cpp<br>
+++ b/src/gallium/drivers/r600/sb/<wbr>sb_valtable.cpp<br>
@@ -212,21 +212,20 @@ void value_table::get_values(vvec& v) {<br>
}<br>
}<br>
<br>
-void value::add_use(node* n, use_kind kind, int arg) {<br>
+void value::add_use(node* n) {<br>
if (0) {<br>
sblog << "add_use ";<br>
dump::dump_val(this);<br>
sblog << " => ";<br>
dump::dump_op(n);<br>
- sblog << " kind " << kind << " arg " << arg << "\n";<br>
}<br>
- uses.push_back(new use_info(n, kind, arg));<br>
+ uses.push_back(n);<br>
}<br>
<br>
struct use_node_comp {<br>
explicit use_node_comp(const node *n) : n(n) {}<br>
- bool operator() (const use_info *u) {<br>
- return u->op->hash() == n->hash();<br>
+ bool operator() (const node *o) {<br>
+ return o->hash() == n->hash();<br>
}<br>
<br>
private:<br>
@@ -239,8 +238,7 @@ void value::remove_use(const node *n) {<br>
<br>
if (it != uses.end())<br>
{<br>
- // TODO assert((*it)->kind == kind) ?<br>
- // TODO assert((*it)->arg == arg) ?<br>
+ // We only ever had a pointer, so don't delete it here<br>
uses.erase(it);<br>
}<br>
}<br>
@@ -290,6 +288,7 @@ bool value::is_prealloc() {<br>
}<br>
<br>
void value::delete_uses() {<br>
+ // We only ever had pointers, so don't delete them here<br>
uses.erase(uses.begin(), uses.end());<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.11.1<br>
<br>
</font></span></blockquote></div><br></div>