Performance improvements - #117
Conversation
|
The "same resource list" optimization makes a big difference if the workload is "lots of materials and a smaller collection of program-related resources". This is a micro-bench of a very small section of the submission process but a good first target:
|
|
The new resource set API is additive and allows repeated arrays of images and acceleration structures to have a single bind/access operation as a group instead of one by one for each resource+command. This optimization can be combined with prepared command streams and descriptor sets. This per-resource tax became quite a burden in real-world use:
There are probably also reasonable "I have a lot of buffers here" issues that come up, but I don't have any of those workloads right now so nothing has been designed for them. There are probably also more reasonable access types to add (transfers, writes) for images and acceleration structures which could be helpful - those should be explored when the need arises because they might upset some of the sampled-only optimizations. Additions may wait until bugs are found/fixed. I applied these changes in a test program and found significant performance gains by reducing the CPU overhead, example: // Construct; each Arc<Image> is one descriptor slot.
let image_set = ImageSet::new(images.iter())?;
// Bind to the graph and declare sampled-read access.
let image_set_node = graph.bind_resource(&image_set);
graph
.begin_cmd()
.resource_access(image_set_node, ImageAccessType::SampledRead)
.record_cmd(|cmd| {
// Bind/use your descriptor set and issue commands here.
})
.end_cmd();For subresources, pass Note: Note: Note:
|
Various internal pattern changes and optimizations found while testing. Not yet fully scoped, will expand.