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

Make the suballocators !Sync #2317

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

marc0246
Copy link
Contributor

@marc0246 marc0246 commented Sep 3, 2023

Following up on #2316, the suballocators no longer need to be Sync like they used to because MemoryAlloc would hold a reference to them. Instead, this gives the user more freedom in how they synchronize the suballocator(s), if at all. In particular in the use case where one has thread-local suballocators there is no reason for this internal sync, but also it can lead to multiple layers of sync. GenericMemoryAllocator would use an RwLock to lock the pool, and then each block would use another Mutex internally for no reason in particular. (An argument for fine-grained locking can be made, however that isn't an argument for internal locking). The original intent when working on #1997 was to support both locking and lock-free suballocators, which sounded good in my head at the time but isn't practical at all when you think about it. I invite you to read the comments regarding this that are now gone (because the whole algorithm was simplified a bunch thanks to this) and facepalm in unison with me.

Changelog:

### Breaking changes
Changes to memory allocation:
- `FreeListAllocator`, `BuddyAllocator` and `BumpAllocator` are no longer `Sync`.

@AustinJ235 AustinJ235 merged commit c93d71e into vulkano-rs:master Sep 7, 2023
AustinJ235 added a commit that referenced this pull request Sep 7, 2023
@marc0246 marc0246 deleted the suballocator-sync branch September 7, 2023 12:54
marc0246 added a commit to marc0246/vulkano that referenced this pull request Sep 9, 2023
Rua pushed a commit that referenced this pull request Sep 9, 2023
marc0246 added a commit to marc0246/vulkano that referenced this pull request Oct 7, 2023
@marc0246 marc0246 mentioned this pull request Oct 7, 2023
Rua pushed a commit that referenced this pull request Oct 8, 2023
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
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.

2 participants