perf(agc): keep up to 1024 cached pipelines
CachedPipeline keeps at most 256 pipelines. A level with a larger working set thrashes the LRU: every miss creates a new VkPipeline (modules, layout, render pass and a driver compile from the pipeline cache). The bound is now 1024. A cached pipeline is a pure function of its key, so the bound changes only memory and time.
This commit is contained in:
parent
a8b032b236
commit
954864ea80
|
|
@ -558,7 +558,7 @@ std::shared_ptr<Pipeline> CachedPipeline(const Context& context, const State& st
|
|||
auto pipeline = std::make_shared<Pipeline>(context, state, vertexInput, resources, shaders, attachmentLayout);
|
||||
store.entries.push_back({context.device, context.bufferPool, hash, key, pipeline});
|
||||
store.index[hash] = std::prev(store.entries.end());
|
||||
constexpr std::size_t bound = 256;
|
||||
constexpr std::size_t bound = 1024;
|
||||
while (store.entries.size() > bound) {
|
||||
// Only an entry no recorded draw still holds may go (Kept keeps its shared_ptr until the fence).
|
||||
const auto victim = std::find_if(store.entries.begin(), store.entries.end(), [](const PipelineStore::Entry& entry) { return entry.pipeline.use_count() == 1; });
|
||||
|
|
|
|||
Loading…
Reference in New Issue