Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jonahwilliams
Copy link
Contributor

We call allocateAndBindDescriptorSets once for every cmd rendered, so this time can bubble up quite a bit. From the traces I've gathered map emplacement (emplace_unique_key_args) and std::vector growth (__push_back_slow_path) contribute the most to this trace.

I think we have physical limits on the number of descriptors we can bind, though I'm not sure if we enforce that anywhere?

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@jonahwilliams
Copy link
Contributor Author

Can/should we add a hard limit to the binding count somewhere?


std::unordered_map<uint32_t, vk::DescriptorBufferInfo> buffers;
std::unordered_map<uint32_t, vk::DescriptorImageInfo> images;
vk::DescriptorImageInfo images[32];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be too expensive to use a vector and reserve space based on the size of vertex_bindings/fragment_bindings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I think that is probably a better idea. We should be able to assert on the size to make sure the ptrs are valid

write_set.descriptorType = vk::DescriptorType::eCombinedImageSampler;
write_set.pImageInfo = &(images[slot.binding] = image_info);
FML_DCHECK(image_count < 32u);
write_set.pImageInfo = &(images[image_count] = image_info);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old implementation would only store one entry if multiple images used the same slot.binding index. Is that behavior desirable?

@chinmaygarde

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bindings shouldn't be duplicated, but even if they were the image/buffer map we are processing should have already dedicated (I think)

@chinmaygarde chinmaygarde changed the title [impeller] avoid hashing and std::vector growth when binding descriptor sets [Impeller] avoid hashing and std::vector growth when binding descriptor sets. Aug 24, 2023
@chinmaygarde chinmaygarde self-requested a review August 24, 2023 20:19
@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 25, 2023
@auto-submit auto-submit bot merged commit a627d46 into flutter:main Aug 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 25, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 25, 2023
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
…or sets. (flutter#45070)

We call allocateAndBindDescriptorSets once for every cmd rendered, so this time can bubble up quite a bit. From the traces I've gathered map emplacement (emplace_unique_key_args) and std::vector growth (__push_back_slow_path) contribute the most to this trace.

I think we have physical limits on the number of descriptors we can bind, though I'm not sure if we enforce that anywhere?
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants