<div class="gmail_quote">On 19 September 2012 13:28, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
<br>
Fixes an assertion failure when compiling certain shaders that need both<br>
pull constants and register spilling:<br>
<br>
brw_eu_emit.c:204: validate_reg: Assertion `execsize >= width' failed.<br>
<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 8 ++++++++<br>
1 file changed, 8 insertions(+)<br>
<br>
Patch contents by Paul; commit message by me. </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp<br>
index e7f11ae..a819ae0 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp<br>
@@ -317,11 +317,19 @@ fs_visitor::choose_spill_reg(struct ra_graph *g)<br>
for (unsigned int i = 0; i < 3; i++) {<br>
if (inst->src[i].file == GRF) {<br>
spill_costs[inst->src[i].reg] += loop_scale;<br>
+<br>
+ if (inst->src[i].smear >= 0) {<br>
+ no_spill[inst->src[i].reg] = true;<br>
+ }<br></blockquote><div><br></div><div>Can we add a comment above the if statement to alert people to why we can't spill these registers (and why it's ok that we can't)? Perhaps something like: "Register spilling logic assumes full-width registers; smeared registers have a width of 1 so if we try to spill them we'll generate invalid assembly. This shouldn't be a problem because smeared registers are only used as short-term temporaries when loading pull constants, so spilling them is unlikely to reduce register pressure anyhow."</div>
<div><br></div><div>I guess I shouldn't give this patch my "Reviewed-by" since I originated it, but assuming a comment is added, feel free to add:</div><div><br></div><div>Signed-off-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
}<br>
<br>
if (inst->dst.file == GRF) {<br>
spill_costs[inst->dst.reg] += inst->regs_written() * loop_scale;<br>
+<br>
+ if (inst->dst.smear >= 0) {<br>
+ no_spill[inst->dst.reg] = true;<br>
+ }<br>
}<br>
<br>
switch (inst->opcode) {<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.4<br>
<br>
</font></span></blockquote></div><br>