KhronosGroup / Vulkan-ValidationLayers

Vulkan Validation Layers (VVL)
https://vulkan.lunarg.com/doc/sdk/latest/linux/khronos_validation_layer.html
Other
751 stars 402 forks source link

Inconsistent behavior when signaling exported timeline semaphore (VUID-VkSemaphoreSignalInfo-value-03259) #8212

Closed jerry411 closed 1 month ago

jerry411 commented 3 months ago

Environment:

Describe the Issue

I have a really weird issue with VK_KHR_external_semaphore. All I want to do is a simple test. As a setup, I:

Then I want to:

However, when signaling a semaphore, I get a validation layer error: "VUID-VkSemaphoreSignalInfo-value-03259" - "value must be less than the value of any pending semaphore signal operations". But there are not any pending signal operations! All operations I do in this simple test are mentioned above.

But wait, it gets weirder! When I do NOT call the first "vkGetSemaphoreCounterValue" (the one before signaling), no validation layer error appears! And if I DO call vkGetSemaphoreCounterValue but don't get a handle to the first semaphore, it is fine as well. Only a combination of getting handle and getting counter value triggers this validation layer error. As a cherry on top, if I query for counter value BEFORE creating a handle, it is all fine. At this point, I think this is a bug in the validation layers.

To summarize:

Expected behavior

I think I should not get this validation layer error at all. And even if it is correct (I would love to know the reason because I really do not understand it at this point), it should be consistent. Changing the order of "get a handle" and "get counter value" operations should not affect a validation layer error being thrown when signaling a semaphore.

Valid Usage ID

VUID-VkSemaphoreSignalInfo-value-03259(ERROR / SPEC): msgNum: 1227785937 - Validation Error: [ VUID-VkSemaphoreSignalInfo-value-03259 ] Object 0: handle = 0xead9370000000008, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x492e86d1 | vkSignalSemaphore(): pSignalInfo->value (124) must be less than value of any pending signal operation (123) for semaphore VkSemaphore 0xead9370000000008[]. The Vulkan spec states: value must be less than the value of any pending semaphore signal operations (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-VkSemaphoreSignalInfo-value-03259)

artem-lunarg commented 3 months ago

@jerry411 thanks for the report, we need to check this, definitely can be a bug. One comment what you can expect when an external resource is used (semaphore, fence). Validation of the external objects is more limited comparing to non-external objects. It's not possible to precisely track state of the external object because it can be changed by the external actor at any time and Vulkan API does not provide a way to communicate those changes (for example, external app signals the semaphore - VVL won't register a signal).

The limited state tracking should not cause false-positive validation errors though. It's a bug if this happens. The expected behavior that validation is skipped if there is not enough information to do it.

jerry411 commented 3 months ago

@artem-lunarg Great. Thanks. And yes - I am aware that validation layers are quite limited at catching problems with external objects, simply due to their nature.

artem-lunarg commented 1 month ago

@jerry411 this shoud be fixed in the latest code