Skip to content

sysgpu: fix vulkan find best allocator selecting smaller memory types#1445

Open
shailpatels wants to merge 1 commit intohexops:mainfrom
shailpatels:vulkan_find_best_allocator_fix
Open

sysgpu: fix vulkan find best allocator selecting smaller memory types#1445
shailpatels wants to merge 1 commit intohexops:mainfrom
shailpatels:vulkan_find_best_allocator_fix

Conversation

@shailpatels
Copy link

  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.

This PR fixes an issue with the bulkan sysgpu find best allocator logic. When searching for a candidate memory type for .linear_write_mappable, only the memory bitflags are considered, which if a memory type with a smaller heap size was later in the list it would always be selected over.

Now the logic is updated if there is a best type already selected, the next candidate will only be considered if its heap size was strictly larger.

Similar logic has been applied for the .linear_read_mappable where the host visible bit would always cause the candidate to be selected. That has been removed since the top level if statement already checks for that.

in my case specifically, the last memory index was the GPU BAR region which is host visible but only has 256 MB heap space and was always getting selected causing the OutOfDeviceMemory error when ignoring regions with 10 and 25 GB of space.

here is an example of it working!
working

(and reproducing the bug)
bug

fixes #1352

Only taking a look at the bitflags for linear_map_readable
caused memory indexes with a smaller heap space to be selected.

Signed-off-by: Shail Patel <shailpatel67@gmail.com>
@shailpatels shailpatels changed the title sysgpu: fix vulkan find best allocator selecting smaller sysgpu: fix vulkan find best allocator selecting smaller memory types Feb 20, 2026
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.

sysgpu: Examples that allocate against vulkan backend crash with out of memory error

1 participant

Comments