Traverse-Research / Traverse-Research/gpu-allocator

It's impossible to bind to a host memory which is not coherent.

Open
#85 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
497
Forks
82
Avg merge
18d 17h
Merged PRs (30d)
1

Description

Hi.

Maybe I'm wrong but when I look into the Allocator implementation I see the following in the Allocator::allocate method:

  • If MemoryLocation::CpuToGpu was specified the function tries to find a memory type index for the preferred bits vk::MemoryPropertyFlags::HOST_VISIBLE | vk::MemoryPropertyFlags::HOST_COHERENT | vk::MemoryPropertyFlags::HOST_CACHED.
  • If the previous attempt failed the function tries to find a memory type index for the required bits vk::MemoryPropertyFlags::HOST_VISIBLE | vk::MemoryPropertyFlags::HOST_COHERENT.
  • If the second attempt fails the function returns Err(AllocationError::NoCompatibleMemoryTypeFound).

So there's no chance to allocate a host visible, non-coherent memory.

Also, in Allocator::new, there's no need to check for host_visible_not_coherent. From the Spec 11.2.1. Device Memory Properties:

There must be at least one memory type with both the VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT and VK_MEMORY_PROPERTY_HOST_COHERENT_BIT bits set in its propertyFlags.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the Allocator::allocate and Allocator::new implementations, tracing the MemoryLocation::CpuToGpu memory-property selection and the host_visible_not_coherent check. Confirm the Vulkan memory-property requirements, then verify that host-visible, non-coherent memory can be selected without breaking the existing compatible-memory error path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.