anv: Enable UBO pushing
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 2 Dec 2017 00:10:48 +0000 (16:10 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 8 Dec 2017 23:43:26 +0000 (15:43 -0800)
Push constants on Intel hardware are significantly more performant than
pull constants.  Since most Vulkan applications don't actively use push
constants on Vulkan or at least don't use it heavily, we're pulling way
more than we should be.  By enabling pushing chunks of UBOs we can get
rid of a lot of those pulls.

On my SKL GT4e, this improves the performance of Dota 2 and Talos by
around 2.5% and improves Aztec Ruins by around 2%.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_pipeline.c

index 8eb5a9342ae3cb290a06a0d0fdd91b985565aa49..597444467c214b873f9aa159740e5817824cecf9 100644 (file)
@@ -419,6 +419,7 @@ anv_physical_device_init(struct anv_physical_device *device,
    device->compiler->shader_debug_log = compiler_debug_log;
    device->compiler->shader_perf_log = compiler_perf_log;
    device->compiler->supports_pull_constants = false;
+   device->compiler->constant_buffer_0_is_relative = true;
 
    isl_device_init(&device->isl_dev, &device->info, swizzled);
 
index cf2079db4e2d3f5c6218096f2fd07d10dbc1a40a..f2d4d113219c5c0a7298df2c58df53949a319a63 100644 (file)
@@ -389,6 +389,9 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
                      struct brw_stage_prog_data *prog_data,
                      struct anv_pipeline_bind_map *map)
 {
+   const struct brw_compiler *compiler =
+      pipeline->device->instance->physicalDevice.compiler;
+
    nir_shader *nir = anv_shader_compile_to_nir(pipeline, mem_ctx,
                                                module, entrypoint, stage,
                                                spec_info);
@@ -438,6 +441,9 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
    if (pipeline->layout)
       anv_nir_apply_pipeline_layout(pipeline, nir, prog_data, map);
 
+   if (stage != MESA_SHADER_COMPUTE)
+      brw_nir_analyze_ubo_ranges(compiler, nir, prog_data->ubo_ranges);
+
    assert(nir->num_uniforms == prog_data->nr_params * 4);
 
    return nir;