Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce small_vector support #1182

Merged
merged 4 commits into from
Oct 16, 2023
Merged

Introduce small_vector support #1182

merged 4 commits into from
Oct 16, 2023

Conversation

illuhad
Copy link
Collaborator

@illuhad illuhad commented Oct 11, 2023

Replace std::vector with small_vector implementation for uses in the runtime where the number of elements is expected to be small. This can substantially reduce memory allocation requests.

The library used is https://github.com/KonanM/small_vector which works by injecting small_vector semantics into std::vector using a clever custom allocator. While it is not the fastest small vector implementation around, it is a drop-in replacement for std::vector by design (which is not the case for other implementations) and it is very small so that we can easily ship it alongside our code.
In the future we could investigate faster implementations like LLVM's small vector.

In my testing I so far found only negligible impact on performance (which for me with PR #1128 is bound by backend kernel launch functionality like hipLaunchKernel anyway), but in any case semantic distinguishing between small and large vectors can still have some value for future optimization.

@illuhad illuhad merged commit fcf3955 into develop Oct 16, 2023
34 of 36 checks passed
@illuhad illuhad deleted the feature/small-vector branch October 16, 2023 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant