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

Vulkan device lost #82247

Closed
ksubox opened this issue Sep 24, 2023 · 19 comments
Closed

Vulkan device lost #82247

ksubox opened this issue Sep 24, 2023 · 19 comments

Comments

@ksubox
Copy link

ksubox commented Sep 24, 2023

Godot version

v4.2.dev5.official.e3e2528ba

System information

Godot v4.2.dev5 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated Radeon RX 560X (Advanced Micro Devices, Inc.; 31.0.21902.5) - AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx (8 Threads)

Issue description

Try to create empty project, add 3D scene and try to save = crash!

Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: AMD - Radeon RX 560X

ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2028)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: (drivers/vulkan/vulkan_context.cpp:2429)
ERROR: Condition "err" is true.
   at: flush (drivers/vulkan/vulkan_context.cpp:2286)

Steps to reproduce

Create new project, than create first 3D scene and try to save...

Minimal reproduction project

Can't even save first scene... - no project

@AThousandShips
Copy link
Member

AThousandShips commented Sep 24, 2023

@stilestr
Copy link

Unable to reproduce this on an RX 7900XTX. Have been using this build to work on a 3D game for a few days and hasn't crashed at all

@ksubox
Copy link
Author

ksubox commented Sep 24, 2023

I use latest available drivers: 23.9.2

@Calinou
Copy link
Member

Calinou commented Sep 24, 2023

Please test #80566 locally and see if it resolves the issue on your end.

@ksubox
Copy link
Author

ksubox commented Sep 25, 2023

I tested with VS 2022 on Windows and unfortunately issue is not resolved.

@ksubox
Copy link
Author

ksubox commented Sep 26, 2023

I made some experiments and got this:

Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: AMD - Radeon RX 560X

ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2051)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: (drivers\vulkan\vulkan_context.cpp:2452)
ERROR: Condition "err" is true.
   at: VulkanContext::flush (drivers\vulkan\vulkan_context.cpp:2309)

And I found out it happens often when some popup/overlay window appear over main screen (like save progress for example).
While I just move objects/rotate scene/click here and there on main window looks like OK. But when I start to add nodes/materials or save scene - this error happens on my comp.

And I checked with debug output - for every popup show Godot call fpCreateSwapchainKHR 5 times!!!
So, for example, when I slowly move mouse over object tree for every object popup is appearing and every time I see 5 calls of fpCreateSwapchainKHR.
And finally die...

Here is full example session where I just move mouse over object tree (I put WARNING about fpCreateSwapchainKHR on 2049 line of vulkan_context.cpp to see):

Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: AMD - Radeon RX 560X
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)

WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
WARNING: fpCreateSwapchainKHR
     at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2049)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: VulkanContext::_update_swap_chain (drivers\vulkan\vulkan_context.cpp:2051)
ERROR: Condition "err != OK" is true. Returning: ERR_CANT_CREATE
   at: VulkanContext::_window_create (drivers\vulkan\vulkan_context.cpp:1770)
ERROR: Failed to create Vulkan Window.
   at: (platform\windows\display_server_windows.cpp:4267)
ERROR: Failed to create sub window.
   at: (platform\windows\display_server_windows.cpp:972)
ERROR: Condition "window_id == DisplayServer::INVALID_WINDOW_ID" is true.
   at: Window::_make_window (scene\main\window.cpp:585)
ERROR:            vkCreateBuffer: Invalid device [VUID-vkCreateBuffer-device-parameter]

crash.zip

@Calinou
Copy link
Member

Calinou commented Sep 26, 2023

And I checked with debug output - for every popup show Godot call fpCreateSwapchainKHR 5 times!!!
So, for example, when I slowly move mouse over object tree for every object popup is appearing and every time I see 5 calls of fpCreateSwapchainKHR.
And finally die...

Every window needs its own swapchains (because of V-Sync and frame queuing, you need more than 1). This is how Vulkan is designed. Popups are their own window so that they can extend outside the editor's main window.

If you enable Single Window Mode in the Editor Settings, you won't see new swapchains being created while using the editor as everything will be a single window.

@Zireael07
Copy link
Contributor

Yes, but why does it call it 5 times?

@ksubox
Copy link
Author

ksubox commented Sep 26, 2023

And setting Single Window Mode - remove multiple fpCreateSwapchainKHR. And for my comp it's 100 times more stable.
But it doesn't solve original problem - why extensive fpCreateSwapchainKHR produce ERR_CANT_CREATE?
May be Godot has parallel rendering thread or something like that?

@hpvb
Copy link
Member

hpvb commented Sep 29, 2023

I found that Linux when you're using a non-default Vulcan device the "device lost" message appears because of some wrong assumptions in amdgpu for cards with no displays plugged in.

I was able to work around this issue by adding amdgpu.lockup_timeout=60000,60000,60000,60000 to my kernel command line.

It seems that what happens is that the default timeouts for non-connected GPUs is 10000 for all rings, while on the primary one it is 60000 for compute.

Not sure if it'll help you in this case!

@DevTripathiSatoshi
Copy link

I found that Linux when you're using a non-default Vulcan device the "device lost" message appears because of some wrong assumptions in amdgpu for cards with no displays plugged in.

I was able to work around this issue by adding amdgpu.lockup_timeout=60000,60000,60000,60000 to my kernel command line.

It seems that what happens is that the default timeouts for non-connected GPUs is 10000 for all rings, while on the primary one it is 60000 for compute.

Not sure if it'll help you in this case!

Hey, I also have a same issue, but the only error I have was about "Vulkan Device lost" . I'm using Intel i5 laptop on windows 11. Any way to fix it?

Moreover, the software crashes unknowingly

@Calinou
Copy link
Member

Calinou commented Oct 16, 2023

Hey, I also have a same issue, but the only error I have was about "Vulkan Device lost" . I'm using Intel i5 laptop on windows 11. Any way to fix it?

Moreover, the software crashes unknowingly

See this comment: #82247 (comment)

@ksubox
Copy link
Author

ksubox commented Nov 6, 2023

Beta 4 - still crashing!

@ksubox
Copy link
Author

ksubox commented Nov 9, 2023

Beta5 still bad - whenever I resize editor window or any popup (like save progress) appears editor crashes. Almost impossible to work. How to catch this? I can build editor from sources, but I don't know how to catch Vulcan errors.

ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: (drivers/vulkan/vulkan_context.cpp:2536)

@ksubox
Copy link
Author

ksubox commented Nov 10, 2023

Some new information if somebody is interested:
The real error is VK_ERROR_OUT_OF_HOST_MEMORY (-1)!

ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:2135)

@Opalie
Copy link

Opalie commented Nov 16, 2023

Putting the Editor in Single Window Mode fixes the issue for me but I did get this error once while working, and then forced me to close the engine. No log because of that (or none that I can find), sorry about that.

image

Godot Engine v4.1.3.stable.mono.official.f06b6836a - Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: AMD - Radeon RX 560X

If this is in any shape or form interesting for you, here are the logs I got when I was using PR #80566 with no Single Window Mode, i didn't try since with it but I can if needed :

Clipboard - November 15, 2023 6 18 PM

And this was 4.1.3 before Single Window Mode:

Clipboard - November 15, 2023 6 17 PM

Note that a lot of the time the vulkan errors would happen randomly, sometimes right after it opened the project window, sometimes after it loads the main scene in the engine, sometimes when I try to build my project...
(I am still a beginner, if any information lacks details please do ask.)

EDIT: On Godot 4.1.3 (+ Single Window Mode) I can reproduce this exact same error every single time if I Restore Down the godot window, and try to change its size.

image

@emirljuca
Copy link

emirljuca commented Nov 30, 2023

Putting the Editor in Single Window Mode fixes the issue for me but I did get this error once while working, and then forced me to close the engine. No log because of that (or none that I can find), sorry about that.

image

Godot Engine v4.1.3.stable.mono.official.f06b6836a - Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: AMD - Radeon RX 560X

If this is in any shape or form interesting for you, here are the logs I got when I was using PR #80566 with no Single Window Mode, i didn't try since with it but I can if needed :

Clipboard - November 15, 2023 6 18 PM

And this was 4.1.3 before Single Window Mode:

Clipboard - November 15, 2023 6 17 PM

Note that a lot of the time the vulkan errors would happen randomly, sometimes right after it opened the project window, sometimes after it loads the main scene in the engine, sometimes when I try to build my project... (I am still a beginner, if any information lacks details please do ask.)

EDIT: On Godot 4.1.3 (+ Single Window Mode) I can reproduce this exact same error every single time if I Restore Down the godot window, and try to change its size.

image

Getting the same issues here. Was able to reproduce with just creating a GPU particle node with 500 particles when launching the scene. Seems to work in editor funnily enough. I have a Lenovo Yoga C940-14IIL with Windows 11.

@Jeremi360
Copy link

It happens for me also on LinuxArch and godot 4.2.2:
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST

@Calinou
Copy link
Member

Calinou commented Jun 28, 2024

Thanks for the report! Consolidating in #71929.

@Calinou Calinou closed this as completed Jun 28, 2024
@akien-mga akien-mga removed this from the 4.x milestone Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests