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

PrimusVK: Layouts don't match at all #35

Open
cosmincrihan opened this issue May 3, 2019 · 6 comments
Open

PrimusVK: Layouts don't match at all #35

cosmincrihan opened this issue May 3, 2019 · 6 comments

Comments

@cosmincrihan
Copy link

cosmincrihan commented May 3, 2019

Thank you for the solution provided for Optimus laptops!
I tried your implementation, followed all the steps, but unfortunately I receive the following error when I test it (full log here):

cosmin@debian-gl553v:~/primus_vk$ ENABLE_PRIMUS_LAYER=1 optirun vulkan-smoketest
PrimusVK: CreateInstance
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x55a698e53580: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) Kabylake GT2
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x55a698e53580: 
PrimusVK: 0x55a698e53580: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: spawning secondary device creation: 0x55a699295da8
PrimusVK: After reset:0
PrimusVK: Thread running
PrimusVK: getting rendering suff: 0x55a698e53580
PrimusVK: fetching dispatch for 0x55a699313100
PrimusVK: GetDeviceProcAddr is: 0x7fb4acd1d2f0
PrimusVK: Create Swapchain KHR is: 0x7fb4acd36060
PrimusVK: CreateDevice done
PrimusVK: Gpus: 2
PrimusVK: phys[1]: 0x7fb498000980
PrimusVK: render queues: 1
PrimusVK:  flags: 7
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: Support: 0x55a698e53580, 1
PrimusVK: fetching dispatch for 0x7fb498002aa0
PrimusVK: GetDeviceProcAddr is: 0x7fb4acd1d2f0
PrimusVK: Create Swapchain KHR is: 0x7fb4acd36060
PrimusVK: CreateDevice done
PrimusVK: Create Graphics FINISHED!: 0
PrimusVK: Display: 0x7fb498002aa0
PrimusVK: storing as reference to: 0x55a699313100
PrimusVK: joining secondary device creation
PrimusVK: When startup hangs here, you have probably hit the initialization deadlock
PrimusVK: joining succeeded. Luckily initialization deadlock did not occur.
PrimusVK: Application requested 2 images.
PrimusVK: Creating Swapchain for size: 1280x1001
PrimusVK: MinImageCount: 3
PrimusVK: fetching device for: 0x55a699313100
PrimusVK: found: 0x7fb498002aa0
PrimusVK: FamilyIndexCount: 0
PrimusVK: Dev: 0x7fb498002aa0
PrimusVK: Swapchainfunc: 0x7fb4acd36060
PrimusVK: >> Swapchain create done 0;0x55a6994a2dc0
PrimusVK: Image aquiring: 3
PrimusVK: Selected render mem: 9;7 display: 0
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating a Swapchain thread.
PrimusVK: Get Swapchain Images buffer: 0x55a69949a320
PrimusVK: Count: 3
PrimusVK: Layouts don't match at all
terminate called after throwing an instance of 'std::runtime_error'
  what():  Layouts don't match at all
cosmin@debian-gl553v:~/primus_vk$

nvidia-smi

Fri May  3 23:29:08 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.116                Driver Version: 390.116                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 105...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   42C    P0    N/A /  N/A |      0MiB /  4042MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Debian 9.9 Stretch
GeForce GTX 1050 Ti
Bumblebee installed and working without DXVK, currently.

@cosmincrihan
Copy link
Author

primus_vk_diag_log.txt

@felixdoerre
Copy link
Owner

Can you try this branch https://github.com/felixdoerre/primus_vk/tree/image_layout_debug and post the output?

@cosmincrihan
Copy link
Author

This is the new output using the code from that branch:

cosmin@debian-gl553v:~/Desktop/primus_vk-image_layout_debug$ ENABLE_PRIMUS_LAYER=1 optirun vulkan-smoketest
PrimusVK: CreateInstance
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x55c319306580: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) Kabylake GT2
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x55c319306580: 
PrimusVK: 0x55c319306580: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: spawning secondary device creation: 0x55c319748da8
PrimusVK: After reset:0
PrimusVK: Thread running
PrimusVK: getting rendering suff: 0x55c319306580
PrimusVK: fetching dispatch for 0x55c3197c6100
PrimusVK: GetDeviceProcAddr is: 0x7f54f26f02f0
PrimusVK: Create Swapchain KHR is: 0x7f54f2709060
PrimusVK: CreateDevice done
PrimusVK: Gpus: 2
PrimusVK: phys[1]: 0x7f54dc000980
PrimusVK: render queues: 1
PrimusVK:  flags: 7
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: Support: 0x55c319306580, 1
PrimusVK: fetching dispatch for 0x7f54dc002aa0
PrimusVK: GetDeviceProcAddr is: 0x7f54f26f02f0
PrimusVK: Create Swapchain KHR is: 0x7f54f2709060
PrimusVK: CreateDevice done
PrimusVK: Create Graphics FINISHED!: 0
PrimusVK: Display: 0x7f54dc002aa0
PrimusVK: storing as reference to: 0x55c3197c6100
PrimusVK: joining secondary device creation
PrimusVK: When startup hangs here, you have probably hit the initialization deadlock
PrimusVK: joining succeeded. Luckily initialization deadlock did not occur.
PrimusVK: Application requested 2 images.
PrimusVK: Creating Swapchain for size: 1280x1001
PrimusVK: MinImageCount: 3
PrimusVK: fetching device for: 0x55c3197c6100
PrimusVK: found: 0x7f54dc002aa0
PrimusVK: FamilyIndexCount: 0
PrimusVK: Dev: 0x7f54dc002aa0
PrimusVK: Swapchainfunc: 0x7f54f2709060
PrimusVK: >> Swapchain create done 0;0x55c319955da0
PrimusVK: Image aquiring: 3
PrimusVK: Selected render mem: 9;7 display: 0
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating image: 1280x1001
PrimusVK: Creating a Swapchain thread.
PrimusVK: Get Swapchain Images buffer: 0x55c31994d340
PrimusVK: Count: 3
PrimusVK: Layouts don't match at all: 5125120 / 5120 != 5161024 / 5120
terminate called after throwing an instance of 'std::runtime_error'
  what():  Layouts don't match at all
cosmin@debian-gl553v:~/Desktop/primus_vk-image_layout_debug$ 

@felixdoerre
Copy link
Owner

So it's your Intel driver that does strange things: The Image memory region it provides is 5161024 bytes large, which would yield 1008.0125 rows. That does not add up. I am not sure, but I think that's a violation of the VulkanAPI by the Intel driver. However as the target images claims it is larger, you can try to comment out the exception thrown in line 984 and "see what happens".

@felixdoerre
Copy link
Owner

I've pushed another commit to https://github.com/felixdoerre/primus_vk/tree/image_layout_debug that will print out the amount of memory allocated for all the images, that way we could see whether the larger size is already used there.

@cosmincrihan
Copy link
Author

This is weird for sure...
This is the new output with your commit and with that exception commented out:

cosmin@debian-gl553v:~/Desktop/primus_vk-image_layout_debug$ ENABLE_PRIMUS_LAYER=1 optirun vulkan-smoketest
PrimusVK: CreateInstance
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x562bd8f60580: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) Kabylake GT2
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x562bd8f60580: 
PrimusVK: 0x562bd8f60580: 
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce GTX 1050 Ti
PrimusVK:   Type: 2
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: spawning secondary device creation: 0x562bd93a2da8
PrimusVK: After reset:0
PrimusVK: Thread running
PrimusVK: getting rendering suff: 0x562bd8f60580
PrimusVK: fetching dispatch for 0x562bd9420100
PrimusVK: GetDeviceProcAddr is: 0x7ff5cf2df2f0
PrimusVK: Create Swapchain KHR is: 0x7ff5cf2f8060
PrimusVK: CreateDevice done
PrimusVK: Gpus: 2
PrimusVK: phys[1]: 0x7ff5bc000980
PrimusVK: render queues: 1
PrimusVK:  flags: 7
PrimusVK: in function: creating device
PrimusVK: Extension: 3
PrimusVK: Extension: 48
PrimusVK: Extension: 48
PrimusVK: Support: 0x562bd8f60580, 1
PrimusVK: fetching dispatch for 0x7ff5bc002aa0
PrimusVK: GetDeviceProcAddr is: 0x7ff5cf2df2f0
PrimusVK: Create Swapchain KHR is: 0x7ff5cf2f8060
PrimusVK: CreateDevice done
PrimusVK: Create Graphics FINISHED!: 0
PrimusVK: Display: 0x7ff5bc002aa0
PrimusVK: storing as reference to: 0x562bd9420100
PrimusVK: joining secondary device creation
PrimusVK: When startup hangs here, you have probably hit the initialization deadlock
PrimusVK: joining succeeded. Luckily initialization deadlock did not occur.
PrimusVK: Application requested 2 images.
PrimusVK: Creating Swapchain for size: 1280x1001
PrimusVK: MinImageCount: 3
PrimusVK: fetching device for: 0x562bd9420100
PrimusVK: found: 0x7ff5bc002aa0
PrimusVK: FamilyIndexCount: 0
PrimusVK: Dev: 0x7ff5bc002aa0
PrimusVK: Swapchainfunc: 0x7ff5cf2f8060
PrimusVK: >> Swapchain create done 0;0x562bd95afd70
PrimusVK: Image aquiring: 3
PrimusVK: Selected render mem: 9;7 display: 0
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5242880 bytes of memory
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5125120 bytes of memory
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5161024 bytes of memory
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5242880 bytes of memory
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5125120 bytes of memory
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5161024 bytes of memory
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5242880 bytes of memory
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5125120 bytes of memory
PrimusVK: Creating image: 1280x1001
PrimusVK: Which requires 5161024 bytes of memory
PrimusVK: Creating a Swapchain thread.
PrimusVK: Get Swapchain Images buffer: 0x562bd95edca0
PrimusVK: Count: 3
PrimusVK: Layouts don't match at all: 5125120 / 5120 != 5161024 / 5120
PrimusVK: Layouts don't match at all: 5125120 / 5120 != 5161024 / 5120
PrimusVK: Layouts don't match at all: 5125120 / 5120 != 5161024 / 5120
...
<A LOT OF THESE>
...
562 presents in 5.00263 seconds (FPS: 112.341)
PrimusVK: Layouts don't match at all: 5125120 / 5120 != 5161024 / 5120
PrimusVK: Layouts don't match at all: 5125120 / 5120 != 5161024 / 5120
PrimusVK: Layouts don't match at all: 5125120 / 5120 != 5161024 / 5120
...
<3D animation shown, everything works apparently>
...
<Now I tried to move the window with the generated animation:>
terminate called after throwing an instance of 'std::runtime_error'
  what():  VkResult -1000001004 returned
cosmin@debian-gl553v:~/Desktop/primus_vk-image_layout_debug$ 

Just as I tried to explain in the comments within the log, it appears to work, but if I try to move the window in which the 3D animation is shown, it just crashes. Same for resizing. Minimize / Restore does not harm anything though.

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

No branches or pull requests

2 participants