<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 1, 2016 at 3:04 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">Signed-off-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>><br>
---<br>
src/intel/vulkan/anv_cmd_buffer.c | 7 +++----<br>
src/intel/vulkan/anv_private.h | 1 -<br>
src/intel/vulkan/gen7_cmd_buffer.c | 2 +-<br>
src/intel/vulkan/gen8_cmd_buffer.c | 2 +-<br>
src/intel/vulkan/genX_cmd_buffer.c | 4 ++--<br>
src/intel/vulkan/genX_pipeline.c | 4 +---<br>
src/mesa/drivers/dri/i965/brw_compiler.h | 1 +<br>
src/mesa/drivers/dri/i965/brw_fs.cpp | 15 ++++++++++++---<br>
src/mesa/drivers/dri/i965/gen7_cs_state.c | 32 ++++++++++---------------------<br>
9 files changed, 31 insertions(+), 37 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c<br>
index 4d0fd7c..63d096c 100644<br>
--- a/src/intel/vulkan/anv_cmd_buffer.c<br>
+++ b/src/intel/vulkan/anv_cmd_buffer.c<br>
@@ -1076,9 +1076,8 @@ anv_cmd_buffer_cs_push_constants(struct anv_cmd_buffer *cmd_buffer)<br>
if (reg_aligned_constant_size == 0)<br>
return (struct anv_state) { .offset = 0 };<br>
<br>
- const unsigned threads = pipeline->cs_thread_width_max;<br>
const unsigned total_push_constants_size =<br>
- reg_aligned_constant_size * threads;<br>
+ reg_aligned_constant_size * cs_prog_data->threads;<br>
const unsigned push_constant_alignment =<br>
cmd_buffer->device->info.gen < 8 ? 32 : 64;<br>
const unsigned aligned_total_push_constants_size =<br>
@@ -1091,7 +1090,7 @@ anv_cmd_buffer_cs_push_constants(struct anv_cmd_buffer *cmd_buffer)<br>
/* Walk through the param array and fill the buffer with data */<br>
uint32_t *u32_map = state.map;<br>
<br>
- brw_cs_fill_local_id_payload(cs_prog_data, u32_map, threads,<br>
+ brw_cs_fill_local_id_payload(cs_prog_data, u32_map, cs_prog_data->threads,<br>
reg_aligned_constant_size);<br>
<br>
/* Setup uniform data for the first thread */<br>
@@ -1102,7 +1101,7 @@ anv_cmd_buffer_cs_push_constants(struct anv_cmd_buffer *cmd_buffer)<br>
<br>
/* Copy uniform data from the first thread to every other thread */<br>
const size_t uniform_data_size = prog_data->nr_params * sizeof(uint32_t);<br>
- for (unsigned t = 1; t < threads; t++) {<br>
+ for (unsigned t = 1; t < cs_prog_data->threads; t++) {<br>
memcpy(&u32_map[t * param_aligned_count + local_id_dwords],<br>
&u32_map[local_id_dwords],<br>
uniform_data_size);<br>
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h<br>
index 7325f3f..26ffbd6 100644<br>
--- a/src/intel/vulkan/anv_private.h<br>
+++ b/src/intel/vulkan/anv_private.h<br>
@@ -1474,7 +1474,6 @@ struct anv_pipeline {<br>
bool primitive_restart;<br>
uint32_t topology;<br>
<br>
- uint32_t cs_thread_width_max;<br></blockquote><div><br></div><div>Hooray! Less crap in the pipeline!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
uint32_t cs_right_mask;<br>
<br>
struct {<br>
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c<br>
index 331275e..40ab008 100644<br>
--- a/src/intel/vulkan/gen7_cmd_buffer.c<br>
+++ b/src/intel/vulkan/gen7_cmd_buffer.c<br>
@@ -271,7 +271,7 @@ flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer)<br>
.BarrierEnable = cs_prog_data->uses_barrier,<br>
.SharedLocalMemorySize = slm_size,<br>
.NumberofThreadsinGPGPUThreadGroup =<br>
- pipeline->cs_thread_width_max);<br>
+ cs_prog_data->threads);<br>
<br>
const uint32_t size = GENX(INTERFACE_DESCRIPTOR_DATA_length) * sizeof(uint32_t);<br>
anv_batch_emit(&cmd_buffer->batch,<br>
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c<br>
index 547fedd..e139e8a 100644<br>
--- a/src/intel/vulkan/gen8_cmd_buffer.c<br>
+++ b/src/intel/vulkan/gen8_cmd_buffer.c<br>
@@ -356,7 +356,7 @@ flush_compute_descriptor_set(struct anv_cmd_buffer *cmd_buffer)<br>
.BarrierEnable = cs_prog_data->uses_barrier,<br>
.SharedLocalMemorySize = slm_size,<br>
.NumberofThreadsinGPGPUThreadGroup =<br>
- pipeline->cs_thread_width_max);<br>
+ cs_prog_data->threads);<br>
<br>
uint32_t size = GENX(INTERFACE_DESCRIPTOR_DATA_length) * sizeof(uint32_t);<br>
anv_batch_emit(&cmd_buffer->batch,<br>
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c<br>
index e7d322c..d9acf58 100644<br>
--- a/src/intel/vulkan/genX_cmd_buffer.c<br>
+++ b/src/intel/vulkan/genX_cmd_buffer.c<br>
@@ -773,7 +773,7 @@ void genX(CmdDispatch)(<br>
ggw.SIMDSize = prog_data->simd_size / 16;<br>
ggw.ThreadDepthCounterMaximum = 0;<br>
ggw.ThreadHeightCounterMaximum = 0;<br>
- ggw.ThreadWidthCounterMaximum = pipeline->cs_thread_width_max - 1;<br>
+ ggw.ThreadWidthCounterMaximum = prog_data->threads - 1;<br>
ggw.ThreadGroupIDXDimension = x;<br>
ggw.ThreadGroupIDYDimension = y;<br>
ggw.ThreadGroupIDZDimension = z;<br>
@@ -874,7 +874,7 @@ void genX(CmdDispatchIndirect)(<br>
ggw.SIMDSize = prog_data->simd_size / 16;<br>
ggw.ThreadDepthCounterMaximum = 0;<br>
ggw.ThreadHeightCounterMaximum = 0;<br>
- ggw.ThreadWidthCounterMaximum = pipeline->cs_thread_width_max - 1;<br>
+ ggw.ThreadWidthCounterMaximum = prog_data->threads - 1;<br>
ggw.RightExecutionMask = pipeline->cs_right_mask;<br>
ggw.BottomExecutionMask = 0xffffffff;<br>
}<br>
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c<br>
index 918a9a4..1776577 100644<br>
--- a/src/intel/vulkan/genX_pipeline.c<br>
+++ b/src/intel/vulkan/genX_pipeline.c<br>
@@ -97,8 +97,6 @@ genX(compute_pipeline_create)(<br>
<br>
uint32_t group_size = cs_prog_data->local_size[0] *<br>
cs_prog_data->local_size[1] * cs_prog_data->local_size[2];<br>
- pipeline->cs_thread_width_max =<br>
- DIV_ROUND_UP(group_size, cs_prog_data->simd_size);<br>
uint32_t remainder = group_size & (cs_prog_data->simd_size - 1);<br>
<br>
if (remainder > 0)<br>
@@ -107,7 +105,7 @@ genX(compute_pipeline_create)(<br>
pipeline->cs_right_mask = ~0u >> (32 - cs_prog_data->simd_size);<br>
<br>
const uint32_t vfe_curbe_allocation =<br>
- push_constant_regs * pipeline->cs_thread_width_max;<br>
+ push_constant_regs * cs_prog_data->threads;<br>
<br>
anv_batch_emit(&pipeline->batch, GENX(MEDIA_VFE_STATE), vfe) {<br>
vfe.ScratchSpaceBasePointer = pipeline->scratch_start[MESA_SHADER_COMPUTE];<br>
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h<br>
index bed969c..f1f9e56 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_compiler.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h<br>
@@ -430,6 +430,7 @@ struct brw_cs_prog_data {<br>
GLuint dispatch_grf_start_reg_16;<br>
unsigned local_size[3];<br>
unsigned simd_size;<br>
+ unsigned threads;<br>
bool uses_barrier;<br>
bool uses_num_work_groups;<br>
unsigned local_invocation_id_regs;<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
index d83d9e0..7e5d583 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
@@ -6561,6 +6561,15 @@ fs_visitor::emit_cs_work_group_id_setup()<br>
return reg;<br>
}<br>
<br>
+static void<br>
+cs_set_simd_size(struct brw_cs_prog_data *cs_prog_data, unsigned size)<br>
+{<br>
+ cs_prog_data->simd_size = size;<br>
+ unsigned group_size = cs_prog_data->local_size[0] *<br>
+ cs_prog_data->local_size[1] * cs_prog_data->local_size[2];<br>
+ cs_prog_data->threads = (group_size + size - 1) / size;<br>
+}<br>
+<br>
const unsigned *<br>
brw_compile_cs(const struct brw_compiler *compiler, void *log_data,<br>
void *mem_ctx,<br>
@@ -6617,7 +6626,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,<br>
fail_msg = v8.fail_msg;<br>
} else {<br>
cfg = v8.cfg;<br>
- prog_data->simd_size = 8;<br>
+ cs_set_simd_size(prog_data, 8);<br>
prog_data->base.dispatch_grf_start_reg = v8.payload.num_regs;<br>
}<br>
}<br>
@@ -6642,7 +6651,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,<br>
}<br>
} else {<br>
cfg = v16.cfg;<br>
- prog_data->simd_size = 16;<br>
+ cs_set_simd_size(prog_data, 16);<br>
prog_data->dispatch_grf_start_reg_16 = v16.payload.num_regs;<br>
}<br>
}<br>
@@ -6669,7 +6678,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,<br>
}<br>
} else {<br>
cfg = v32.cfg;<br>
- prog_data->simd_size = 32;<br>
+ cs_set_simd_size(prog_data, 32);<br>
}<br>
}<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c<br>
index 7f484dd..619edfb 100644<br>
--- a/src/mesa/drivers/dri/i965/gen7_cs_state.c<br>
+++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c<br>
@@ -33,17 +33,6 @@<br>
#include "program/prog_statevars.h"<br>
#include "compiler/glsl/ir_uniform.h"<br>
<br>
-static unsigned<br>
-get_cs_thread_count(const struct brw_cs_prog_data *cs_prog_data)<br>
-{<br>
- const unsigned simd_size = cs_prog_data->simd_size;<br>
- unsigned group_size = cs_prog_data->local_size[0] *<br>
- cs_prog_data->local_size[1] * cs_prog_data->local_size[2];<br>
-<br>
- return (group_size + simd_size - 1) / simd_size;<br>
-}<br>
-<br>
-<br>
static void<br>
brw_upload_cs_state(struct brw_context *brw)<br>
{<br>
@@ -79,7 +68,6 @@ brw_upload_cs_state(struct brw_context *brw)<br>
(prog_data->nr_params + local_id_dwords) * sizeof(gl_constant_value);<br>
unsigned reg_aligned_constant_size = ALIGN(push_constant_data_size, 32);<br>
unsigned push_constant_regs = reg_aligned_constant_size / 32;<br>
- unsigned threads = get_cs_thread_count(cs_prog_data);<br>
<br>
uint32_t dwords = brw->gen < 8 ? 8 : 9;<br>
BEGIN_BATCH(dwords);<br>
@@ -129,7 +117,8 @@ brw_upload_cs_state(struct brw_context *brw)<br>
*<br>
* Note: The constant data is built in brw_upload_cs_push_constants below.<br>
*/<br>
- const uint32_t vfe_curbe_allocation = push_constant_regs * threads;<br>
+ const uint32_t vfe_curbe_allocation =<br>
+ push_constant_regs * cs_prog_data->threads;<br>
OUT_BATCH(SET_FIELD(vfe_urb_allocation, MEDIA_VFE_STATE_URB_ALLOC) |<br>
SET_FIELD(vfe_curbe_allocation, MEDIA_VFE_STATE_CURBE_ALLOC));<br>
OUT_BATCH(0);<br>
@@ -141,7 +130,7 @@ brw_upload_cs_state(struct brw_context *brw)<br>
BEGIN_BATCH(4);<br>
OUT_BATCH(MEDIA_CURBE_LOAD << 16 | (4 - 2));<br>
OUT_BATCH(0);<br>
- OUT_BATCH(ALIGN(reg_aligned_constant_size * threads, 64));<br>
+ OUT_BATCH(ALIGN(reg_aligned_constant_size * cs_prog_data->threads, 64));<br>
OUT_BATCH(stage_state->push_const_offset);<br>
ADVANCE_BATCH();<br>
}<br>
@@ -163,9 +152,9 @@ brw_upload_cs_state(struct brw_context *brw)<br>
desc[dw++] = SET_FIELD(push_constant_regs, MEDIA_CURBE_READ_LENGTH);<br>
const uint32_t media_threads =<br>
brw->gen >= 8 ?<br>
- SET_FIELD(threads, GEN8_MEDIA_GPGPU_THREAD_COUNT) :<br>
- SET_FIELD(threads, MEDIA_GPGPU_THREAD_COUNT);<br>
- assert(threads <= brw->max_cs_threads);<br>
+ SET_FIELD(cs_prog_data->threads, GEN8_MEDIA_GPGPU_THREAD_COUNT) :<br>
+ SET_FIELD(cs_prog_data->threads, MEDIA_GPGPU_THREAD_COUNT);<br>
+ assert(cs_prog_data->threads <= brw->max_cs_threads);<br>
<br>
assert(prog_data->total_shared <= 64 * 1024);<br>
uint32_t slm_size = 0;<br>
@@ -247,21 +236,20 @@ brw_upload_cs_push_constants(struct brw_context *brw,<br>
const unsigned param_aligned_count =<br>
reg_aligned_constant_size / sizeof(*param);<br>
<br>
- unsigned threads = get_cs_thread_count(cs_prog_data);<br>
-<br>
param = (gl_constant_value*)<br>
brw_state_batch(brw, type,<br>
- ALIGN(reg_aligned_constant_size * threads, 64),<br>
+ ALIGN(reg_aligned_constant_size *<br>
+ cs_prog_data->threads, 64),<br>
64, &stage_state->push_const_offset);<br>
assert(param);<br>
<br>
STATIC_ASSERT(sizeof(gl_constant_value) == sizeof(float));<br>
<br>
- brw_cs_fill_local_id_payload(cs_prog_data, param, threads,<br>
+ brw_cs_fill_local_id_payload(cs_prog_data, param, cs_prog_data->threads,<br>
reg_aligned_constant_size);<br>
<br>
/* _NEW_PROGRAM_CONSTANTS */<br>
- for (t = 0; t < threads; t++) {<br>
+ for (t = 0; t < cs_prog_data->threads; t++) {<br>
gl_constant_value *next_param =<br>
¶m[t * param_aligned_count + local_id_dwords];<br>
for (i = 0; i < prog_data->nr_params; i++) {<br>
<span><font color="#888888">--<br>
2.8.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>