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

Support the VK_KHR_timeline_semaphore extension. #1124

Merged
merged 1 commit into from
Oct 28, 2020

Conversation

cdavis5e
Copy link
Collaborator

This implementation uses MTLSharedEvent where possible, and emulates
it on the host otherwise. Unlike binary semaphores, MTLSharedEvents
map well to timeline semaphores; there should be no problems using them
when they're available.

I'm extremely confident in the MTLSharedEvent-based implementation. It
passes nearly all the synchronization tests. I'm less confident in the
emulated implementation.

This implementation uses `MTLSharedEvent` where possible, and emulates
it on the host otherwise. Unlike binary semaphores, `MTLSharedEvent`s
map well to timeline semaphores; there should be no problems using them
when they're available.

I'm extremely confident in the `MTLSharedEvent`-based implementation. It
passes nearly all the synchronization tests. I'm less confident in the
emulated implementation.
Copy link
Contributor

@billhollings billhollings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Just one question.

return new MVKSemaphoreMTLEvent(this, pCreateInfo);
} else {
return new MVKSemaphoreEmulated(this, pCreateInfo);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, by default, _useMTLFenceForSemaphores is enabled and _useMTLEventForSemaphores is disabled, which means regular VkSemaphores will prefer using MTLFence over MTLEvent.

Given that if a timeline semaphore is requested, we must use MTLSharedEvent, should we re-evaluate and possibly flip this? Is there any drive or appetite to prefer using MTLEvent over MTLFence for regular VkSemaphores?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the reason for preferring MTLFence for binary semaphores is that we observed problems when MTLEvents were used with presentation, where waits would time out and subsequently cause the system to revoke access to the device. The presentation code has changed significantly since then, but I'm still investigating whether or not it's safe to start using MTLEvent again.

(I keep forgetting that most people don't have memories as long as mine. How ironic.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now where was that issue again...?

Oh yeah, there were two, #602 and #625.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep forgetting that most people don't have memories as long as mine. How ironic. (🤦🏻‍♂️...for the irony joke).

Yeah...raw memory is definitely not my strong suit. I'd not survive long in medical school. 😉

Sorry...I didn't expect you to troll back into the previous change triggers...but was more looking for your thoughts on whether either our code has evolved...or Apple's MTLEvent code has...based on the sync testing you were doing.

The presentation code has changed significantly since then, but I'm still investigating whether or not it's safe to start using MTLEvent again.

Okay. Thanks for the review. If you do continue to investigate and it reveals that MTLEvents make sense, we can flip back.

@billhollings billhollings merged commit 4a1a517 into KhronosGroup:master Oct 28, 2020
@cdavis5e cdavis5e deleted the khr-timeline-semaphore branch October 28, 2020 17:49
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

Successfully merging this pull request may close these issues.

2 participants