[Fixed] [4.7.1] Vulkan Buffer: Out of Device Memory

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

[4.7.1] Vulkan Buffer: Out of Device Memory

Postby Ghost Prototype » Thu Oct 21, 2021 5:20 am

I used Nash's PDA starter kit for replicating this crash.
viewtopic.php?f=105&t=65849

Opening the PDA and leaving it open for about 30 seconds will cause GZD to crash with this error "Could not allocate memory for vulkan buffer: out of device memory crash". Is this related to GPU by any mean?
You do not have the required permissions to view the files attached to this post.
User avatar
Ghost Prototype
Be the problems you want to see in the world
 
Joined: 19 May 2013
Location: Philadelphia

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby Enjay » Thu Oct 21, 2021 5:34 am

This sounds very much like a problem that I had with 4.7.0 but I have not seen it since the dev builds were changed to fix it and I can't make it happen with 4.7.1 either.

Using my own test files and Nash's kit, I can have the PDAs open for several minutes and not experience a crash. I've ran it with the garbage collector stats on screen it there doesn't seem to be a problem there.

So I'm not sure why this is crashing for you. I was going to suggest that you'd inadvertently run it with 4.7.0 but I see from your crash report that isn't the case.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby Nash » Thu Oct 21, 2021 5:46 am

Seems to be an AMD-only thing. I am also unable to repro it with PDA Kit 1.2 and GZDoom 4.7.1.
User avatar
Nash
AKA Nash Muhandes! Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby dpJudas » Thu Oct 21, 2021 5:57 am

Perhaps AMD cards have less memory available for vertex buffers?

Edit: looking at the memory stats at gpuinfo.org for that particular GPU makes it a bit more mysterious. It reports 3 different vulkan heaps: two that are 8 gigs in size and one that is 256 megabytes.

F2DVertexBuffer specifies that the memory is not static, which makes VKBuffer::SetData require a memory heap that is both host visible and device local. That means heap #2 that is only 256 MB in size. Now the question is, does the GC kick in before that?
dpJudas
 
 
 
Joined: 28 May 2016

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby Graf Zahl » Thu Oct 21, 2021 6:20 am

AMD does indeed provide only 256 MB of host visible memory. They surely know how to cripple their cards.
The main question should be whether it is necessary to use host visible memory for these static 2D vertex buffers or if the code can be rewritten to use another type of memory.
A large portion of this heap is already used for the persistently mapped buffers so using it for convenience for all buffers may not be such a good idea.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby dpJudas » Thu Oct 21, 2021 7:10 am

Unless I am missing something, those vertex buffers used by this feature does not have to pass in false when calling SetData. If the hardware layer tells the vulkan backend the buffer is static then it will create a transfer buffer in system memory (heap #1 for this card) and then transfer it to a vertex buffer in video memory (heap #0).
dpJudas
 
 
 
Joined: 28 May 2016

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby Graf Zahl » Thu Oct 21, 2021 7:44 am

Correct. These buffers are supposed to be static. Considering that they can be longer lived they really should not occupy such a limited resource as host visible memory.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby dpJudas » Tue Oct 26, 2021 7:48 pm

I created a PR fix for this: https://github.com/coelckers/gzdoom/pull/1497. Note that since I don't own an AMD card I can't actually confirm it fixed it. It should though, as this will make it use a different heap for the 2D drawer.
dpJudas
 
 
 
Joined: 28 May 2016

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby Ghost Prototype » Wed Oct 27, 2021 7:06 am

Tested with the latest dev build. Can confirm it's fixed. I left the menu opened for 5+ min and no crash. Things will occasionally lag when the GC starts doing its cleaning (I don't actually know what is going on but i'm assuming it's that) but definitely no crash. Thank you so much for fixing this.
Last edited by Ghost Prototype on Wed Oct 27, 2021 12:47 pm, edited 1 time in total.
User avatar
Ghost Prototype
Be the problems you want to see in the world
 
Joined: 19 May 2013
Location: Philadelphia

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby Nash » Wed Oct 27, 2021 10:00 am

Ghost Prototype wrote:Things will occasionally lag when the GC starts doing its cleaning


Huh, strange... I thought that was already fixed...
User avatar
Nash
AKA Nash Muhandes! Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: [4.7.1] Vulkan Buffer: Out of Device Memory

Postby Graf Zahl » Wed Oct 27, 2021 10:44 am

You cannot really fix that. When the GC starts its cleanup it needs to free a lot of objects and that costs time. Depending on the type of objects it can indeed cause some lag if taking them down is a non-trivial affair.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 1 guest