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

Fix payload value query for external semaphores #2127

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ahesham-arm
Copy link
Contributor

When creating a CL semaphore object from a Vulkan semaphore one, we explicitly pass -1 as the file descriptor value in the case of VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD. According to the CL specification:

The special value -1 for fd is treated like a valid sync file
descriptor referring to an object that has already signaled. The
import operation will succeed and the semaphore will have a
temporarily imported payload as if a valid file descriptor had
been provided.

The test currently checks that the semaphore payload is unsignalled, unconditionally, which is incorrect.

Changed the test to check for the correct expected payload value.

When creating a CL semaphore object from a Vulkan semaphore one, we
explicitly pass `-1` as the file descriptor value in the case of
`VULKAN_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD`. According to the CL
specification:

    The special value -1 for fd is treated like a valid sync file
    descriptor referring to an object that has already signaled. The
    import operation will succeed and the semaphore will have a
    temporarily imported payload as if a valid file descriptor had
    been provided.

The test currently checks that the semaphore payload is unsignalled,
unconditionally, which is incorrect.

Changed the test to check for the correct expected payload value.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
@bashbaug
Copy link
Contributor

Would it be better to get a valid SYNC_FD file descriptor for this test case instead of using the special -1 file descriptor value?

All of the other handle types seem to be getting a valid handle:

handle = semaphore.getHandle(externalSemaphoreHandleType);

@ahesham-arm
Copy link
Contributor Author

Would it be better to get a valid SYNC_FD file descriptor for this test case instead of using the special -1 file descriptor value?

All of the other handle types seem to be getting a valid handle:

handle = semaphore.getHandle(externalSemaphoreHandleType);

I agree that we need an additional test here, because we should be covering two cases:

  • Creating a semaphore with a sync fd set to -1, and checking that the payload is signalled (which is what this PR fixes)
  • Creating a semaphore with a valid sync fd value other than -1, and checking that the payload is unsignalled (which I can address) in a follow up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants