char *error_str = NULL;
const unsigned *program =
brw_compile_vs(compiler, &ice->dbg, mem_ctx, &key_no_ucp, vs_prog_data,
- nir, -1, &error_str);
+ nir, -1, NULL, &error_str);
if (program == NULL) {
dbg_printf("Failed to compile vertex shader: %s\n", error_str);
ralloc_free(mem_ctx);
char *error_str = NULL;
const unsigned *program =
brw_compile_tcs(compiler, &ice->dbg, mem_ctx, key, tcs_prog_data, nir,
- -1, &error_str);
+ -1, NULL, &error_str);
if (program == NULL) {
dbg_printf("Failed to compile control shader: %s\n", error_str);
ralloc_free(mem_ctx);
char *error_str = NULL;
const unsigned *program =
brw_compile_tes(compiler, &ice->dbg, mem_ctx, key, &input_vue_map,
- tes_prog_data, nir, NULL, -1, &error_str);
+ tes_prog_data, nir, NULL, -1, NULL, &error_str);
if (program == NULL) {
dbg_printf("Failed to compile evaluation shader: %s\n", error_str);
ralloc_free(mem_ctx);
char *error_str = NULL;
const unsigned *program =
brw_compile_gs(compiler, &ice->dbg, mem_ctx, key, gs_prog_data, nir,
- NULL, -1, &error_str);
+ NULL, -1, NULL, &error_str);
if (program == NULL) {
dbg_printf("Failed to compile geometry shader: %s\n", error_str);
ralloc_free(mem_ctx);
char *error_str = NULL;
const unsigned *program =
brw_compile_fs(compiler, &ice->dbg, mem_ctx, key, fs_prog_data,
- nir, NULL, -1, -1, -1, true, false, vue_map, &error_str);
+ nir, NULL, -1, -1, -1, true, false, vue_map,
+ NULL, &error_str);
if (program == NULL) {
dbg_printf("Failed to compile fragment shader: %s\n", error_str);
ralloc_free(mem_ctx);
char *error_str = NULL;
const unsigned *program =
brw_compile_cs(compiler, &ice->dbg, mem_ctx, key, cs_prog_data,
- nir, -1, &error_str);
+ nir, -1, NULL, &error_str);
if (program == NULL) {
dbg_printf("Failed to compile compute shader: %s\n", error_str);
ralloc_free(mem_ctx);
const unsigned *program =
brw_compile_fs(compiler, blorp->driver_ctx, mem_ctx, wm_key,
wm_prog_data, nir, NULL, -1, -1, -1, false, use_repclear,
- NULL, NULL);
+ NULL, NULL, NULL);
return program;
}
const unsigned *program =
brw_compile_vs(compiler, blorp->driver_ctx, mem_ctx,
- &vs_key, vs_prog_data, nir, -1, NULL);
+ &vs_key, vs_prog_data, nir, -1, NULL, NULL);
return program;
}
DEFINE_PROG_DATA_DOWNCAST(sf)
#undef DEFINE_PROG_DATA_DOWNCAST
+struct brw_compile_stats {
+ uint32_t dispatch_width; /**< 0 for vec4 */
+ uint32_t instructions;
+ uint32_t loops;
+ uint32_t cycles;
+ uint32_t spills;
+ uint32_t fills;
+};
+
/** @} */
struct brw_compiler *
struct brw_vs_prog_data *prog_data,
struct nir_shader *shader,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str);
/**
struct brw_tcs_prog_data *prog_data,
struct nir_shader *nir,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str);
/**
struct nir_shader *shader,
struct gl_program *prog,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str);
/**
struct nir_shader *shader,
struct gl_program *prog,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str);
/**
int shader_time_index32,
bool allow_spilling,
bool use_rep_send, struct brw_vue_map *vue_map,
+ struct brw_compile_stats *stats, /**< Array of three stats */
char **error_str);
/**
struct brw_cs_prog_data *prog_data,
const struct nir_shader *shader,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str);
void brw_debug_key_recompile(const struct brw_compiler *c, void *log,
int shader_time_index8, int shader_time_index16,
int shader_time_index32, bool allow_spilling,
bool use_rep_send, struct brw_vue_map *vue_map,
+ struct brw_compile_stats *stats,
char **error_str)
{
const struct gen_device_info *devinfo = compiler->devinfo;
if (simd8_cfg) {
prog_data->dispatch_8 = true;
- g.generate_code(simd8_cfg, 8);
+ g.generate_code(simd8_cfg, 8, stats);
+ stats = stats ? stats + 1 : NULL;
}
if (simd16_cfg) {
prog_data->dispatch_16 = true;
- prog_data->prog_offset_16 = g.generate_code(simd16_cfg, 16);
+ prog_data->prog_offset_16 = g.generate_code(simd16_cfg, 16, stats);
+ stats = stats ? stats + 1 : NULL;
}
if (simd32_cfg) {
prog_data->dispatch_32 = true;
- prog_data->prog_offset_32 = g.generate_code(simd32_cfg, 32);
+ prog_data->prog_offset_32 = g.generate_code(simd32_cfg, 32, stats);
+ stats = stats ? stats + 1 : NULL;
}
return g.get_assembly();
struct brw_cs_prog_data *prog_data,
const nir_shader *src_shader,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str)
{
prog_data->base.total_shared = src_shader->info.cs.shared_size;
g.enable_debug(name);
}
- g.generate_code(v->cfg, prog_data->simd_size);
+ g.generate_code(v->cfg, prog_data->simd_size, stats);
ret = g.get_assembly();
}
~fs_generator();
void enable_debug(const char *shader_name);
- int generate_code(const cfg_t *cfg, int dispatch_width);
+ int generate_code(const cfg_t *cfg, int dispatch_width,
+ struct brw_compile_stats *stats);
const unsigned *get_assembly();
private:
}
int
-fs_generator::generate_code(const cfg_t *cfg, int dispatch_width)
+fs_generator::generate_code(const cfg_t *cfg, int dispatch_width,
+ struct brw_compile_stats *stats)
{
/* align to 64 byte boundary. */
while (p->next_insn_offset % 64)
shader_stats.scheduler_mode,
shader_stats.promoted_constants,
before_size, after_size);
+ if (stats) {
+ stats->dispatch_width = dispatch_width;
+ stats->instructions = before_size / 16;
+ stats->loops = loop_count;
+ stats->cycles = cfg->cycle_count;
+ stats->spills = spill_count;
+ stats->fills = fill_count;
+ }
return start_offset;
}
nir_shader *nir,
struct gl_program *prog,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str)
{
const struct gen_device_info *devinfo = compiler->devinfo;
nir->info.name));
}
- g.generate_code(v.cfg, 8);
+ g.generate_code(v.cfg, 8, stats);
assembly = g.get_assembly();
} else {
v.dump_instructions();
assembly = brw_vec4_generate_assembly(compiler, log_data, mem_ctx, nir,
- &prog_data->base, v.cfg);
+ &prog_data->base, v.cfg, stats);
}
return assembly;
struct brw_vs_prog_data *prog_data,
nir_shader *shader,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str)
{
const bool is_scalar = compiler->scalar_stage[MESA_SHADER_VERTEX];
g.enable_debug(debug_name);
}
- g.generate_code(v.cfg, 8);
+ g.generate_code(v.cfg, 8, stats);
assembly = g.get_assembly();
}
}
assembly = brw_vec4_generate_assembly(compiler, log_data, mem_ctx,
- shader, &prog_data->base, v.cfg);
+ shader, &prog_data->base,
+ v.cfg, stats);
}
return assembly;
void *mem_ctx,
const nir_shader *nir,
struct brw_vue_prog_data *prog_data,
- const struct cfg_t *cfg);
+ const struct cfg_t *cfg,
+ struct brw_compile_stats *stats);
#ifdef __cplusplus
} /* extern "C" */
void *log_data,
const nir_shader *nir,
struct brw_vue_prog_data *prog_data,
- const struct cfg_t *cfg)
+ const struct cfg_t *cfg,
+ struct brw_compile_stats *stats)
{
const struct gen_device_info *devinfo = p->devinfo;
const char *stage_abbrev = _mesa_shader_stage_to_abbrev(nir->info.stage);
stage_abbrev, before_size / 16,
loop_count, cfg->cycle_count, spill_count,
fill_count, before_size, after_size);
-
+ if (stats) {
+ stats->dispatch_width = 0;
+ stats->instructions = before_size / 16;
+ stats->loops = loop_count;
+ stats->cycles = cfg->cycle_count;
+ stats->spills = spill_count;
+ stats->fills = fill_count;
+ }
}
extern "C" const unsigned *
void *mem_ctx,
const nir_shader *nir,
struct brw_vue_prog_data *prog_data,
- const struct cfg_t *cfg)
+ const struct cfg_t *cfg,
+ struct brw_compile_stats *stats)
{
struct brw_codegen *p = rzalloc(mem_ctx, struct brw_codegen);
brw_init_codegen(compiler->devinfo, p, mem_ctx);
brw_set_default_access_mode(p, BRW_ALIGN_16);
- generate_code(p, compiler, log_data, nir, prog_data, cfg);
+ generate_code(p, compiler, log_data, nir, prog_data, cfg, stats);
return brw_get_program(p, &prog_data->base.program_size);
}
nir_shader *shader,
struct gl_program *prog,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str)
{
struct brw_gs_compile c;
label, shader->info.name);
g.enable_debug(name);
}
- g.generate_code(v.cfg, 8);
+ g.generate_code(v.cfg, 8, stats);
return g.get_assembly();
}
}
/* Success! Backup is not needed */
ralloc_free(param);
return brw_vec4_generate_assembly(compiler, log_data, mem_ctx,
- shader, &prog_data->base, v.cfg);
+ shader, &prog_data->base,
+ v.cfg, stats);
} else {
/* These variables could be modified by the execution of the GS
* visitor if it packed the uniforms in the push constant buffer.
*error_str = ralloc_strdup(mem_ctx, gs->fail_msg);
} else {
ret = brw_vec4_generate_assembly(compiler, log_data, mem_ctx, shader,
- &prog_data->base, gs->cfg);
+ &prog_data->base, gs->cfg, stats);
}
delete gs;
struct brw_tcs_prog_data *prog_data,
nir_shader *nir,
int shader_time_index,
+ struct brw_compile_stats *stats,
char **error_str)
{
const struct gen_device_info *devinfo = compiler->devinfo;
nir->info.name));
}
- g.generate_code(v.cfg, 8);
+ g.generate_code(v.cfg, 8, stats);
assembly = g.get_assembly();
} else {
assembly = brw_vec4_generate_assembly(compiler, log_data, mem_ctx, nir,
- &prog_data->base, v.cfg);
+ &prog_data->base, v.cfg, stats);
}
return assembly;
vs_stage->nir->info.separate_shader);
return brw_compile_vs(compiler, device, mem_ctx, &vs_stage->key.vs,
- &vs_stage->prog_data.vs, vs_stage->nir, -1, NULL);
+ &vs_stage->prog_data.vs, vs_stage->nir, -1,
+ NULL, NULL);
}
static void
return brw_compile_tcs(compiler, device, mem_ctx, &tcs_stage->key.tcs,
&tcs_stage->prog_data.tcs, tcs_stage->nir,
- -1, NULL);
+ -1, NULL, NULL);
}
static void
return brw_compile_tes(compiler, device, mem_ctx, &tes_stage->key.tes,
&tcs_stage->prog_data.tcs.base.vue_map,
&tes_stage->prog_data.tes, tes_stage->nir,
- NULL, -1, NULL);
+ NULL, -1, NULL, NULL);
}
static void
return brw_compile_gs(compiler, device, mem_ctx, &gs_stage->key.gs,
&gs_stage->prog_data.gs, gs_stage->nir,
- NULL, -1, NULL);
+ NULL, -1, NULL, NULL);
}
static void
const unsigned *code =
brw_compile_fs(compiler, device, mem_ctx, &fs_stage->key.wm,
&fs_stage->prog_data.wm, fs_stage->nir,
- NULL, -1, -1, -1, true, false, NULL, NULL);
+ NULL, -1, -1, -1, true, false, NULL, NULL, NULL);
if (fs_stage->key.wm.nr_color_regions == 0 &&
!fs_stage->prog_data.wm.has_side_effects &&
const unsigned *shader_code =
brw_compile_cs(compiler, pipeline->device, mem_ctx, &stage.key.cs,
- &stage.prog_data.cs, stage.nir, -1, NULL);
+ &stage.prog_data.cs, stage.nir, -1, NULL, NULL);
if (shader_code == NULL) {
ralloc_free(mem_ctx);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
char *error_str;
program = brw_compile_cs(brw->screen->compiler, brw, mem_ctx, key,
- &prog_data, nir, st_index, &error_str);
+ &prog_data, nir, st_index, NULL, &error_str);
if (program == NULL) {
cp->program.sh.data->LinkStatus = LINKING_FAILURE;
ralloc_strcat(&cp->program.sh.data->InfoLog, error_str);
char *error_str;
const unsigned *program =
brw_compile_gs(brw->screen->compiler, brw, mem_ctx, key,
- &prog_data, nir, &gp->program, st_index, &error_str);
+ &prog_data, nir, &gp->program, st_index,
+ NULL, &error_str);
if (program == NULL) {
ralloc_strcat(&gp->program.sh.data->InfoLog, error_str);
_mesa_problem(NULL, "Failed to compile geometry shader: %s\n", error_str);
char *error_str;
const unsigned *program =
brw_compile_tcs(compiler, brw, mem_ctx, key, &prog_data, nir, st_index,
- &error_str);
+ NULL, &error_str);
if (program == NULL) {
if (tep) {
tep->program.sh.data->LinkStatus = LINKING_FAILURE;
char *error_str;
const unsigned *program =
brw_compile_tes(compiler, brw, mem_ctx, key, &input_vue_map, &prog_data,
- nir, &tep->program, st_index, &error_str);
+ nir, &tep->program, st_index, NULL, &error_str);
if (program == NULL) {
tep->program.sh.data->LinkStatus = LINKING_FAILURE;
ralloc_strcat(&tep->program.sh.data->InfoLog, error_str);
*/
char *error_str;
program = brw_compile_vs(compiler, brw, mem_ctx, key, &prog_data,
- nir, st_index, &error_str);
+ nir, st_index, NULL, &error_str);
if (program == NULL) {
if (!vp->program.is_arb_asm) {
vp->program.sh.data->LinkStatus = LINKING_FAILURE;
key, &prog_data, nir,
&fp->program, st_index8, st_index16, st_index32,
true, false, vue_map,
- &error_str);
+ NULL, &error_str);
if (program == NULL) {
if (!fp->program.is_arb_asm) {