<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">I've looked at this patch and I think it's correct. I'd like to see how it's used before I pass any judgements on whether or not I like it. If we are going to go this direction, I'd like to see some follow-up that deletes the final_assembly_size parameter from all of the brw_compile_* functions.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Wed, Oct 18, 2017 at 10:32 PM, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Carl Worth <<a href="mailto:cworth@cworth.org">cworth@cworth.org</a>><br></blockquote><div><br></div><div>Hey look, a patch from cworth. :)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This will be used by the on disk shader cache.<br>
<br>
v2:<br>
* Set in brw_compile_* rather than brw_codegen_*. (Jason)<br>
<br>
Signed-off-by: Timothy Arceri <<a href="mailto:timothy.arceri@collabora.com">timothy.arceri@collabora.com</a>><br>
[<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>: Only add to brw_stage_prog_data]<br>
Signed-off-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
---<br>
src/intel/compiler/brw_<wbr>compiler.h | 2 ++<br>
src/intel/compiler/brw_fs.cpp | 8 ++++++--<br>
src/intel/compiler/brw_shader.<wbr>cpp | 12 ++++++++----<br>
src/intel/compiler/brw_vec4.<wbr>cpp | 1 +<br>
src/intel/compiler/brw_vec4_<wbr>gs_visitor.cpp | 14 ++++++++++----<br>
src/intel/compiler/brw_vec4_<wbr>tcs.cpp | 12 ++++++++----<br>
6 files changed, 35 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/intel/compiler/brw_<wbr>compiler.h b/src/intel/compiler/brw_<wbr>compiler.h<br>
index 014202d36c..b57834ddaa 100644<br>
--- a/src/intel/compiler/brw_<wbr>compiler.h<br>
+++ b/src/intel/compiler/brw_<wbr>compiler.h<br>
@@ -588,6 +588,8 @@ struct brw_stage_prog_data {<br>
unsigned total_scratch;<br>
unsigned total_shared;<br>
<br>
+ unsigned program_size;<br>
+<br>
/**<br>
* Register where the thread expects to find input data from the URB<br>
* (typically uniforms, followed by vertex or fragment attributes).<br>
diff --git a/src/intel/compiler/brw_fs.<wbr>cpp b/src/intel/compiler/brw_fs.<wbr>cpp<br>
index 66cb33131b..77f704ec99 100644<br>
--- a/src/intel/compiler/brw_fs.<wbr>cpp<br>
+++ b/src/intel/compiler/brw_fs.<wbr>cpp<br>
@@ -6666,7 +6666,9 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,<br>
prog_data->reg_blocks_0 = brw_register_blocks(simd16_<wbr>grf_used);<br>
}<br>
<br>
- return g.get_assembly(final_assembly_<wbr>size);<br>
+ const unsigned *assembly = g.get_assembly(final_assembly_<wbr>size);<br>
+ prog_data->base.program_size = *final_assembly_size;<br>
+ return assembly;<br>
}<br>
<br>
fs_reg *<br>
@@ -6865,7 +6867,9 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,<br>
<br>
g.generate_code(cfg, prog_data->simd_size);<br>
<br>
- return g.get_assembly(final_assembly_<wbr>size);<br>
+ const unsigned *assembly = g.get_assembly(final_assembly_<wbr>size);<br>
+ prog_data->base.program_size = *final_assembly_size;<br>
+ return assembly;<br>
}<br>
<br>
/**<br>
diff --git a/src/intel/compiler/brw_<wbr>shader.cpp b/src/intel/compiler/brw_<wbr>shader.cpp<br>
index 83ad152f89..f00da96f68 100644<br>
--- a/src/intel/compiler/brw_<wbr>shader.cpp<br>
+++ b/src/intel/compiler/brw_<wbr>shader.cpp<br>
@@ -1166,6 +1166,7 @@ brw_compile_tes(const struct brw_compiler *compiler,<br>
{<br>
const struct gen_device_info *devinfo = compiler->devinfo;<br>
const bool is_scalar = compiler->scalar_stage[MESA_<wbr>SHADER_TESS_EVAL];<br>
+ const unsigned *assembly;<br>
<br>
nir_shader *nir = nir_shader_clone(mem_ctx, src_shader);<br>
nir->info.inputs_read = key->inputs_read;<br>
@@ -1274,7 +1275,7 @@ brw_compile_tes(const struct brw_compiler *compiler,<br>
<br>
g.generate_code(v.cfg, 8);<br>
<br>
- return g.get_assembly(final_assembly_<wbr>size);<br>
+ assembly = g.get_assembly(final_assembly_<wbr>size);<br>
} else {<br>
brw::vec4_tes_visitor v(compiler, log_data, key, prog_data,<br>
nir, mem_ctx, shader_time_index);<br>
@@ -1287,8 +1288,11 @@ brw_compile_tes(const struct brw_compiler *compiler,<br>
if (unlikely(INTEL_DEBUG & DEBUG_TES))<br>
v.dump_instructions();<br>
<br>
- return brw_vec4_generate_assembly(<wbr>compiler, log_data, mem_ctx, nir,<br>
- &prog_data->base, v.cfg,<br>
- final_assembly_size);<br>
+ assembly = brw_vec4_generate_assembly(<wbr>compiler, log_data, mem_ctx, nir,<br>
+ &prog_data->base, v.cfg,<br>
+ final_assembly_size);<br>
}<br>
+<br>
+ prog_data->base.base.program_<wbr>size = *final_assembly_size;<br>
+ return assembly;<br>
}<br>
diff --git a/src/intel/compiler/brw_vec4.<wbr>cpp b/src/intel/compiler/brw_vec4.<wbr>cpp<br>
index 04304fcb45..b7af8860e8 100644<br>
--- a/src/intel/compiler/brw_vec4.<wbr>cpp<br>
+++ b/src/intel/compiler/brw_vec4.<wbr>cpp<br>
@@ -2905,6 +2905,7 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,<br>
final_assembly_size);<br>
}<br>
<br>
+ prog_data->base.base.program_<wbr>size = *final_assembly_size;<br>
return assembly;<br>
}<br>
<br>
diff --git a/src/intel/compiler/brw_vec4_<wbr>gs_visitor.cpp b/src/intel/compiler/brw_vec4_<wbr>gs_visitor.cpp<br>
index 5df6d562ce..11b73f187c 100644<br>
--- a/src/intel/compiler/brw_vec4_<wbr>gs_visitor.cpp<br>
+++ b/src/intel/compiler/brw_vec4_<wbr>gs_visitor.cpp<br>
@@ -868,7 +868,9 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,<br>
g.enable_debug(name);<br>
}<br>
g.generate_code(v.cfg, 8);<br>
- return g.get_assembly(final_assembly_<wbr>size);<br>
+ const unsigned *ret = g.get_assembly(final_assembly_<wbr>size);<br>
+ prog_data->base.base.program_<wbr>size = *final_assembly_size;<br>
+ return ret;<br>
}<br>
}<br>
<br>
@@ -897,9 +899,12 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,<br>
if (v.run()) {<br>
/* Success! Backup is not needed */<br>
ralloc_free(param);<br>
- return brw_vec4_generate_assembly(<wbr>compiler, log_data, mem_ctx,<br>
- shader, &prog_data->base, v.cfg,<br>
- final_assembly_size);<br>
+ const unsigned *ret =<br>
+ brw_vec4_generate_assembly(<wbr>compiler, log_data, mem_ctx, shader,<br>
+ &prog_data->base, v.cfg,<br>
+ final_assembly_size);<br>
+ prog_data->base.base.program_<wbr>size = *final_assembly_size;<br>
+ return ret;<br>
} else {<br>
/* These variables could be modified by the execution of the GS<br>
* visitor if it packed the uniforms in the push constant buffer.<br>
@@ -967,6 +972,7 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,<br>
}<br>
<br>
delete gs;<br>
+ prog_data->base.base.program_<wbr>size = *final_assembly_size;<br>
return ret;<br>
}<br>
<br>
diff --git a/src/intel/compiler/brw_vec4_<wbr>tcs.cpp b/src/intel/compiler/brw_vec4_<wbr>tcs.cpp<br>
index c4d9f89a91..04feb6bdf1 100644<br>
--- a/src/intel/compiler/brw_vec4_<wbr>tcs.cpp<br>
+++ b/src/intel/compiler/brw_vec4_<wbr>tcs.cpp<br>
@@ -388,6 +388,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,<br>
const struct gen_device_info *devinfo = compiler->devinfo;<br>
struct brw_vue_prog_data *vue_prog_data = &prog_data->base;<br>
const bool is_scalar = compiler->scalar_stage[MESA_<wbr>SHADER_TESS_CTRL];<br>
+ const unsigned *assembly;<br>
<br>
nir_shader *nir = nir_shader_clone(mem_ctx, src_shader);<br>
nir->info.outputs_written = key->outputs_written;<br>
@@ -487,7 +488,7 @@ brw_compile_tcs(const struct brw_compiler *compiler,<br>
<br>
g.generate_code(v.cfg, 8);<br>
<br>
- return g.get_assembly(final_assembly_<wbr>size);<br>
+ assembly = g.get_assembly(final_assembly_<wbr>size);<br>
} else {<br>
vec4_tcs_visitor v(compiler, log_data, key, prog_data,<br>
nir, mem_ctx, shader_time_index, &input_vue_map);<br>
@@ -501,10 +502,13 @@ brw_compile_tcs(const struct brw_compiler *compiler,<br>
v.dump_instructions();<br>
<br>
<br>
- return brw_vec4_generate_assembly(<wbr>compiler, log_data, mem_ctx, nir,<br>
- &prog_data->base, v.cfg,<br>
- final_assembly_size);<br>
+ assembly = brw_vec4_generate_assembly(<wbr>compiler, log_data, mem_ctx, nir,<br>
+ &prog_data->base, v.cfg,<br>
+ final_assembly_size);<br>
}<br>
+<br>
+ prog_data->base.base.program_<wbr>size = *final_assembly_size;<br>
+ return assembly;<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
2.15.0.rc0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>