Vulkan-ValidationLayers icon indicating copy to clipboard operation
Vulkan-ValidationLayers copied to clipboard

layers: Allow using uncached buffer for Debug Printf

Open dorian-apanel-intel opened this issue 2 years ago • 36 comments

Adds option to force using AMD_DEVICE_COHERENT_MEMORY for debug printf buffer to print messages even if VK_ERROR_DEVICE_LOST is encountered.

Forcing extension and device feature if not enabled by application.

Added workaround for atomic operations in uncached memory being in cache anyway.

Added workaround to failing MapMemory after DEVICE_LOST (occurs on AMD): When using uncached buffer, do not unmap buffer until messages are analyzed.

This PR attempts to implement #6101 Tested on AMD and Intel (extension not public yet) using this modified vkcube: https://github.com/dorian-apanel-intel/Vulkan-Tools/commit/e0226930a7958bb4964428691dd1376c3447bca3

dorian-apanel-intel avatar Jul 12 '23 12:07 dorian-apanel-intel

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 12 '23 12:07 CLAassistant

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 12 '23 12:07 ci-tester-lunarg

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 12 '23 12:07 ci-tester-lunarg

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 12 '23 12:07 ci-tester-lunarg

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 12 '23 13:07 ci-tester-lunarg

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 12 '23 13:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build queued with queue ID 5177.

ci-tester-lunarg avatar Jul 12 '23 16:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build # 12676 running.

ci-tester-lunarg avatar Jul 12 '23 16:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build # 12676 passed.

ci-tester-lunarg avatar Jul 12 '23 16:07 ci-tester-lunarg

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 13 '23 06:07 ci-tester-lunarg

@juan-lunarg @Tony-LunarG

I don't see any testing being added. Is the plan to add them later? Has this been tested? Is there a test that can go with this?

I've only tested it manually so far. Would it be enough to copy one test from tests\negative\debug_printf.cpp and modify it to use uncached buffer and hang?

dorian-apanel-intel avatar Jul 13 '23 06:07 dorian-apanel-intel

CI Vulkan-ValidationLayers build queued with queue ID 5894.

ci-tester-lunarg avatar Jul 13 '23 15:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build # 12692 running.

ci-tester-lunarg avatar Jul 13 '23 15:07 ci-tester-lunarg

@juan-lunarg @Tony-LunarG

I don't see any testing being added. Is the plan to add them later? Has this been tested? Is there a test that can go with this?

I've only tested it manually so far. Would it be enough to copy one test from tests\negative\debug_printf.cpp and modify it to use uncached buffer and hang?

I think so, as long as the test gets a DEVICE_LOST and then successfully parses a debug printf

TonyBarbour avatar Jul 13 '23 15:07 TonyBarbour

CI Vulkan-ValidationLayers build # 12692 passed.

ci-tester-lunarg avatar Jul 13 '23 16:07 ci-tester-lunarg

Would it be enough to copy one test from tests\negative\debug_printf.cpp and modify it to use uncached buffer and hang?

This sounds like it would cause problems for Jenkins CI (Although if we switched to ctest maybe not... since the test would be in it's own process).

Because currently CI invokes the test executable and tries running all tests.

juan-lunarg avatar Jul 13 '23 17:07 juan-lunarg

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 17 '23 10:07 ci-tester-lunarg

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 17 '23 12:07 ci-tester-lunarg

@Tony-LunarG @juan-lunarg @jeremyg-lunarg

  • I've added unit test, had to pass a value using push constants, because hardcoded infinite loop was not hanging on AMD.
  • I modified layer_options.cpp file to move option from test to layer. It is not perfect, but after looking at #5895, I think it will need rewrite soon anyway.
  • After updating AMD drivers, Atomics WA is no longer needed there, but leaving it for Intel for now.
  • NVidia does not support required extension yet.
  • Force push was required due to printf test file rename.

I plan to add also unit test for Page Fault, but preferably in another pull request.

dorian-apanel-intel avatar Jul 17 '23 12:07 dorian-apanel-intel

Author dorian-apanel-intel not on autobuild list. Waiting for curator authorization before starting CI build.

ci-tester-lunarg avatar Jul 17 '23 13:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build queued with queue ID 7794.

ci-tester-lunarg avatar Jul 17 '23 15:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build # 12728 running.

ci-tester-lunarg avatar Jul 17 '23 16:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build # 12728 running.

ci-tester-lunarg avatar Jul 17 '23 16:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build # 12728 failed.

ci-tester-lunarg avatar Jul 17 '23 17:07 ci-tester-lunarg

Galaxy S22 testing failed

[ RUN      ] NegativeDebugPrintf.UncachedBuffer
jni/../../tests/framework/error_monitor.cpp:200: Failure
Failed
Validation Error: [ UNASSIGNED-DEBUG-PRINTF ] Object 0: handle = 0x6c1d064220, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x92394c89 | Setup Error. Detail: (Unable to allocate device memory.  Device could become unstable.)
jni/../../tests/framework/error_monitor.cpp:241: Failure
Failed
Did not receive expected error 'Here are three float values 1.000000, 3.141500, 0.000000'
[  FAILED  ] NegativeDebugPrintf.UncachedBuffer (5836 ms)

juan-lunarg avatar Jul 17 '23 17:07 juan-lunarg

Galaxy S22 testing failed

[ RUN      ] NegativeDebugPrintf.UncachedBuffer
jni/../../tests/framework/error_monitor.cpp:200: Failure
Failed
Validation Error: [ UNASSIGNED-DEBUG-PRINTF ] Object 0: handle = 0x6c1d064220, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x92394c89 | Setup Error. Detail: (Unable to allocate device memory.  Device could become unstable.)
jni/../../tests/framework/error_monitor.cpp:241: Failure
Failed
Did not receive expected error 'Here are three float values 1.000000, 3.141500, 0.000000'
[  FAILED  ] NegativeDebugPrintf.UncachedBuffer (5836 ms)

I don't think there's much the test can do about that. I'll just add the new test to the S22 blacklist.

TonyBarbour avatar Jul 17 '23 18:07 TonyBarbour

CI Vulkan-ValidationLayers build queued with queue ID 9060.

ci-tester-lunarg avatar Jul 19 '23 11:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build # 12764 running.

ci-tester-lunarg avatar Jul 19 '23 11:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build # 12764 passed.

ci-tester-lunarg avatar Jul 19 '23 12:07 ci-tester-lunarg

CI Vulkan-ValidationLayers build queued with queue ID 10076.

ci-tester-lunarg avatar Jul 21 '23 10:07 ci-tester-lunarg