iris/compute: Push subgroup-id

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Jordan Justen
2018-09-18 16:24:13 -07:00
committed by Kenneth Graunke
parent 229450a2a6
commit b35c8f2182
3 changed files with 37 additions and 6 deletions

View File

@@ -485,6 +485,8 @@ void iris_init_resource_functions(struct pipe_context *ctx);
void iris_init_query_functions(struct pipe_context *ctx); void iris_init_query_functions(struct pipe_context *ctx);
void iris_update_compiled_shaders(struct iris_context *ice); void iris_update_compiled_shaders(struct iris_context *ice);
void iris_update_compiled_compute_shader(struct iris_context *ice); void iris_update_compiled_compute_shader(struct iris_context *ice);
void iris_fill_cs_push_const_buffer(struct brw_cs_prog_data *cs_prog_data,
uint32_t *dst);
/* iris_blit.c */ /* iris_blit.c */

View File

@@ -1058,6 +1058,19 @@ iris_update_compiled_compute_shader(struct iris_context *ice)
UNUSED bool success = iris_compile_cs(ice, ish, &key); UNUSED bool success = iris_compile_cs(ice, ish, &key);
} }
void
iris_fill_cs_push_const_buffer(struct brw_cs_prog_data *cs_prog_data,
uint32_t *dst)
{
struct brw_stage_prog_data *prog_data = &cs_prog_data->base;
assert(cs_prog_data->push.total.size > 0);
assert(cs_prog_data->push.cross_thread.size == 0);
assert(cs_prog_data->push.per_thread.dwords == 1);
assert(prog_data->param[0] == BRW_PARAM_BUILTIN_SUBGROUP_ID);
for (unsigned t = 0; t < cs_prog_data->threads; t++)
dst[8 * t] = t;
}
void void
iris_init_program_functions(struct pipe_context *ctx) iris_init_program_functions(struct pipe_context *ctx)
{ {

View File

@@ -4357,12 +4357,23 @@ iris_upload_compute_state(struct iris_context *ice,
// XXX: hack iris_set_constant_buffers to upload compute shader constants // XXX: hack iris_set_constant_buffers to upload compute shader constants
// XXX: differently...? // XXX: differently...?
if (cs_prog_data->push.total.size > 0) { uint32_t curbe_data_offset = 0;
iris_emit_cmd(batch, GENX(MEDIA_CURBE_LOAD), curbe) { // TODO: Move subgroup-id into uniforms ubo so we can push uniforms
curbe.CURBETotalDataLength = assert(cs_prog_data->push.cross_thread.dwords == 0 &&
ALIGN(cs_prog_data->push.total.size, 64); cs_prog_data->push.per_thread.dwords == 1 &&
// XXX: curbe.CURBEDataStartAddress = stage_state->push_const_offset; cs_prog_data->base.param[0] == BRW_PARAM_BUILTIN_SUBGROUP_ID);
} struct pipe_resource *curbe_data_res = NULL;
uint32_t *curbe_data_map =
stream_state(batch, ice->state.dynamic_uploader, &curbe_data_res,
ALIGN(cs_prog_data->push.total.size, 64), 64,
&curbe_data_offset);
assert(curbe_data_map);
memset(curbe_data_map, 0x5a, ALIGN(cs_prog_data->push.total.size, 64));
iris_fill_cs_push_const_buffer(cs_prog_data, curbe_data_map);
iris_emit_cmd(batch, GENX(MEDIA_CURBE_LOAD), curbe) {
curbe.CURBETotalDataLength =
ALIGN(cs_prog_data->push.total.size, 64);
curbe.CURBEDataStartAddress = curbe_data_offset;
} }
struct pipe_resource *desc_res = NULL; struct pipe_resource *desc_res = NULL;
@@ -4371,6 +4382,11 @@ iris_upload_compute_state(struct iris_context *ice,
iris_pack_state(GENX(INTERFACE_DESCRIPTOR_DATA), desc, idd) { iris_pack_state(GENX(INTERFACE_DESCRIPTOR_DATA), desc, idd) {
idd.SamplerStatePointer = shs->sampler_table.offset; idd.SamplerStatePointer = shs->sampler_table.offset;
idd.BindingTablePointer = binder->bt_offset[MESA_SHADER_COMPUTE]; idd.BindingTablePointer = binder->bt_offset[MESA_SHADER_COMPUTE];
idd.ConstantURBEntryReadLength = cs_prog_data->push.per_thread.regs;
#if GEN_GEN >= 8 || GEN_IS_HASWELL
idd.CrossThreadConstantDataReadLength =
cs_prog_data->push.cross_thread.regs;
#endif
} }
for (int i = 0; i < GENX(INTERFACE_DESCRIPTOR_DATA_length); i++) for (int i = 0; i < GENX(INTERFACE_DESCRIPTOR_DATA_length); i++)