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

Use dedicated allocation when allocation size is large enough #1631

Merged
merged 3 commits into from
Jul 12, 2021

Conversation

ishitatsuyuki
Copy link
Contributor

@ishitatsuyuki ishitatsuyuki commented Jul 5, 2021

  1. Describe in common words what is the purpose of this change, related Github Issues, and highlight important implementation aspects.
    When allocating a buffer that is extremely large (e.g. 4.5GB), Vulkano's pool allocator would round up that to the next power of two (which is 8GB) and it failed to allocate on my GPU (which has ~7.9GB of memory available for allocation).
    This PR disables memory pool allocations for memory allocation above 256MB, as they would likely lead to allocating unnecessary space as well as delaying returning freed memory to the OS. Dedicated allocations are requested when supported, which might improve efficiency but should have no drawbacks otherwise.
    While on that, also fix a few condition checks since KHR_dedicated_allocation has been promoted to Vulkan 1.1.

  2. Please put changelog entries in the description of this Pull Request
    if knowledge of this change could be valuable to users. No need to put the
    entries to the changelog directly, they will be transferred to the changelog
    files(CHANGELOG_VULKANO.md and CHANGELOG_VK_SYS.md)
    by maintainers right after the Pull Request merge.

    • Entries for Vulkano changelog:
      • Large allocations now use dedicated allocations which improves memory efficiency.
  3. Run cargo fmt on the changes.

  4. N/A Make sure that the changes are covered by unit-tests.
    Note: The changes were tested with an application I am developing.

  5. N/A Update documentation to reflect any user-facing changes - in this repository.

@ishitatsuyuki ishitatsuyuki changed the title Update dedicated_allocation to include Vulkan 1.1 Use dedicated allocation when allocation size is large enough Jul 6, 2021
@ishitatsuyuki
Copy link
Contributor Author

Whoops, the autogenerated title was wrong. Fixed.

@Eliah-Lakhin Eliah-Lakhin added the PR: Review next Sunday This PR is planned for FIRST review on the nearest Sunday. label Jul 6, 2021
@Eliah-Lakhin
Copy link
Contributor

@ishitatsuyuki Thank you for your contribution!

I will take a closer look and will perform a few local test during the week(more likely by the end of the week), but at a first glance the implementation looks fine.

@Eliah-Lakhin Eliah-Lakhin removed the PR: Review next Sunday This PR is planned for FIRST review on the nearest Sunday. label Jul 12, 2021
@Eliah-Lakhin Eliah-Lakhin merged commit 823a312 into vulkano-rs:master Jul 12, 2021
@Eliah-Lakhin
Copy link
Contributor

@ishitatsuyuki PR reviewed and merged. 👍 Thank you for your work, and I apologize for the delay in review.

Eliah-Lakhin added a commit that referenced this pull request Jul 12, 2021
blacksailer pushed a commit to blacksailer/vulkano that referenced this pull request Nov 25, 2021
…o-rs#1631)

* Update dedicated_allocation to include Vulkan 1.1

* Fix DeviceMemoryBuilder::dedicated_info's behavior when dedicated allocation is unsupported

* Use dedicated allocation when allocation size is large enough
blacksailer pushed a commit to blacksailer/vulkano that referenced this pull request Nov 25, 2021
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