anv: reduce BT emissions & surface state writes with push descriptors
Zink on Anv running Gfxbench gl_driver2 is significantly slower than Iris. The reason is simple, whereas Iris implements uniform updates using push constants and only has to emit 3DSTATE_CONSTANT_* packets, Zink uses push descriptors with a uniform buffer, which on our implementation use both push constants & binding tables. Anv ends up doing the following for each uniform update : - allocate 2 surface states : - one for the uniform buffer as the offset specify by zink - one for the descriptor set buffer - pack the 2 RENDER_SURFACE_STATE - re-emit binding tables - re-emit push constants Of all of those operations, only the last one ends up being useful in this benchmark because all the uniforms have been promoted to push constants. This change defers the 3 first operations at draw time and executes them only if the pipeline needs them. Vkoverhead before / after : descriptor_template_1ubo_push: 40670 / 85786 descriptor_template_12ubo_push: 4050 / 13820 descriptor_template_1combined_sampler_push, 34410 / 34043 descriptor_template_16combined_sampler_push, 2746 / 2711 descriptor_template_1sampled_image_push, 34765 / 34089 descriptor_template_16sampled_image_push, 2794 / 2649 descriptor_template_1texelbuffer_push, 108537 / 111342 descriptor_template_16texelbuffer_push, 20619 / 20166 descriptor_template_1ssbo_push, 41506 / 85976 descriptor_template_8ssbo_push, 6036 / 18703 descriptor_template_1image_push, 88932 / 89610 descriptor_template_16image_push, 20937 / 20959 descriptor_template_1imagebuffer_push, 108407 / 113240 descriptor_template_16imagebuffer_push, 32661 / 34651 Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19050>
This commit is contained in:

committed by
Marge Bot

parent
ff91c5ca42
commit
b49b18f0b7
@@ -1795,6 +1795,14 @@ struct anv_descriptor_set {
|
||||
*/
|
||||
uint32_t size;
|
||||
|
||||
/* Is this descriptor set a push descriptor */
|
||||
bool is_push;
|
||||
|
||||
/* Bitfield of descriptors for which we need to generate surface states.
|
||||
* Only valid for push descriptors
|
||||
*/
|
||||
uint32_t generate_surface_states;
|
||||
|
||||
/* State relative to anv_descriptor_pool::bo */
|
||||
struct anv_state desc_mem;
|
||||
/* Surface state for the descriptor buffer */
|
||||
@@ -1908,7 +1916,6 @@ anv_descriptor_set_write_buffer_view(struct anv_device *device,
|
||||
void
|
||||
anv_descriptor_set_write_buffer(struct anv_device *device,
|
||||
struct anv_descriptor_set *set,
|
||||
struct anv_state_stream *alloc_stream,
|
||||
VkDescriptorType type,
|
||||
struct anv_buffer *buffer,
|
||||
uint32_t binding,
|
||||
@@ -1916,6 +1923,11 @@ anv_descriptor_set_write_buffer(struct anv_device *device,
|
||||
VkDeviceSize offset,
|
||||
VkDeviceSize range);
|
||||
|
||||
void
|
||||
anv_descriptor_write_surface_state(struct anv_device *device,
|
||||
struct anv_descriptor *desc,
|
||||
struct anv_state surface_state);
|
||||
|
||||
void
|
||||
anv_descriptor_set_write_acceleration_structure(struct anv_device *device,
|
||||
struct anv_descriptor_set *set,
|
||||
@@ -1934,7 +1946,6 @@ anv_descriptor_set_write_inline_uniform_data(struct anv_device *device,
|
||||
void
|
||||
anv_descriptor_set_write_template(struct anv_device *device,
|
||||
struct anv_descriptor_set *set,
|
||||
struct anv_state_stream *alloc_stream,
|
||||
const struct vk_descriptor_update_template *template,
|
||||
const void *data);
|
||||
|
||||
@@ -2545,6 +2556,7 @@ struct anv_cmd_state {
|
||||
|
||||
enum anv_pipe_bits pending_pipe_bits;
|
||||
VkShaderStageFlags descriptors_dirty;
|
||||
VkShaderStageFlags push_descriptors_dirty;
|
||||
VkShaderStageFlags push_constants_dirty;
|
||||
|
||||
struct anv_vertex_binding vertex_bindings[MAX_VBS];
|
||||
|
Reference in New Issue
Block a user