zink: decrease aggressiveness of increasing descriptor data space adaptive

An increase by factor 10 with each re-allocation is a bit aggressive and
we hit the available limit easily on lavapipe.

By starting of with an initial larger scale, but decreasing this over time
this error can be avoided.

Specifically with
  "spec@arb_shader_texture_lod@execution@tex-miplevel-selection *gradarb 1d"
originally the buffer sizes would be 250, 2500, 25000, and 250000,
with the patch it's 250, 4000, and 32000.

v2: use minimum scale of 4 instead of 2 (Mike)
v3: fix typo (Mike)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27977>
This commit is contained in:
Gert Wollny 2024-02-21 10:54:15 +01:00 committed by Marge Bot
parent 8e239dda41
commit 1882527f78
2 changed files with 7 additions and 2 deletions

View file

@ -1060,8 +1060,11 @@ enlarge_db(struct zink_context *ctx)
struct zink_batch_state *bs = ctx->batch.state;
/* ensure current db surives */
zink_batch_reference_resource(&ctx->batch, bs->dd.db);
/* rebinding a db mid-batch is extremely costly: scaling by 10x should ensure it never happens more than twice */
ctx->dd.db.max_db_size *= 10;
/* rebinding a db mid-batch is extremely costly: if we start with a factor
* 16 and then half the factor with each new allocation. It shouldn't need to
* do this more than twice. */
ctx->dd.db.max_db_size *= ctx->dd.db.size_enlarge_scale;
ctx->dd.db.size_enlarge_scale = MAX2(ctx->dd.db.size_enlarge_scale >> 1, 4);
reinit_db(screen, bs);
}
@ -1644,6 +1647,7 @@ zink_descriptors_init(struct zink_context *ctx)
}
/* start small */
ctx->dd.db.max_db_size = 250;
ctx->dd.db.size_enlarge_scale = 16;
}
return true;

View file

@ -449,6 +449,7 @@ struct zink_descriptor_data {
struct pipe_transfer *bindless_db_xfer;
uint32_t bindless_db_offsets[4];
unsigned max_db_size;
unsigned size_enlarge_scale;
} db;
};