<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Indeed it would be better to move it, will be done.<br>
</p>
<div class="moz-cite-prefix">On 10.07.18 18:04, Jason Ekstrand
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOFGe96vWNagfYysE11x-SX9MbHDtCOb0V7S8hxudx36PWi89g@mail.gmail.com">
<div dir="ltr">I think we can just move it up a couple of loops to
the place where we do the final lowering and call gather_info.
Other than that, this seems like a good idea to me. NIR passes
are pretty sloppy about memory and assume nir_sweep gets
called. Hanging on to linked shaders with all that garbage
floating around is a bad plan.<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, Jul 10, 2018 at 1:53 AM Danylo Piliaiev
<<a href="mailto:danylo.piliaiev@gmail.com"
moz-do-not-send="true">danylo.piliaiev@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">After
optimization passes and many trasfromations most of memory<br>
NIR holds is a garbage which was being freed only after shader
deletion.<br>
Freeing it at the end of linking will save memory which would
be useful<br>
in case there are a lot of complex shaders being compiled.<br>
The common case for this issue is 32bit game running under
Wine.<br>
<br>
The cost of the optimization is around ~3-5% of compilation
speed<br>
with complex shaders.<br>
<br>
Bugzilla: <a
href="https://bugs.freedesktop.org/show_bug.cgi?id=103274"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://bugs.freedesktop.org/show_bug.cgi?id=103274</a><br>
<br>
Signed-off-by: Danylo Piliaiev <<a
href="mailto:danylo.piliaiev@globallogic.com"
target="_blank" moz-do-not-send="true">danylo.piliaiev@globallogic.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_link.cpp | 9 +++++++++<br>
1 file changed, 9 insertions(+)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp
b/src/mesa/drivers/dri/i965/brw_link.cpp<br>
index 1071056f14..8f34a58ce7 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_link.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp<br>
@@ -359,6 +359,15 @@ brw_link_shader(struct gl_context *ctx,
struct gl_shader_program *shProg)<br>
}<br>
}<br>
<br>
+ for (stage = 0; stage <
ARRAY_SIZE(shProg->_LinkedShaders); stage++) {<br>
+ struct gl_linked_shader *shader =
shProg->_LinkedShaders[stage];<br>
+ if (!shader)<br>
+ continue;<br>
+<br>
+ struct gl_program *prog = shader->Program;<br>
+ nir_sweep(prog->nir);<br>
+ }<br>
+<br>
if (brw->ctx.Cache) {<br>
for (stage = 0; stage <
ARRAY_SIZE(shProg->_LinkedShaders); stage++) {<br>
struct gl_linked_shader *shader =
shProg->_LinkedShaders[stage];<br>
-- <br>
2.17.1<br>
<br>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>