Skip to content

[vulkan] Avoid dropping work in serializing command queue - #2378

Merged
antiagainst merged 6 commits into
iree-org:mainfrom
antiagainst:fix-queue-bugs
Jul 7, 2020
Merged

antiagainst merged 6 commits into
iree-org:mainfrom
antiagainst:fix-queue-bugs

Conversation

@antiagainst

Copy link
Copy Markdown
Member

We inspect all deferred submission one by one in ProcessDeferredSubmissions()
and put them in remaining_submissions if they are not ready. These work should
be returned to deferred_submissions_ when we cannot prepare VkSubmitInfo for
any of them. Previously we will just silently dropping them.

Also we cannot std::move the fence from FencedSubmission until it's clear that
we can prepare VkSubmitInfo with it. Otherwise the remaining_submissions will
see a nullptr fence.

These are issues exposed by #2196.
Thanks Scott! :)

We inspect all deferred submission one by one in ProcessDeferredSubmissions()
and put them in remaining_submissions if they are not ready. These work should
be returned to deferred_submissions_ when we cannot prepare VkSubmitInfo for
any of them. Previously we will just silently dropping them.

Also we cannot std::move the fence from FencedSubmission until it's clear that
we can prepare VkSubmitInfo with it. Otherwise the remaining_submissions will
see a nullptr fence.
@ScottTodd

Copy link
Copy Markdown
Member
  • Something in the "Inline lambda to please sanitizers to suppress mutex deadlock false alarms" commit appears to be making a test in Add hal/cts:command_queue_test. #2196 never terminate again. The test passes with just the first commit in this PR. We can silence the sanitizers around MakeCleanup or investigate further.
  • We spotted a stack-use-after-scope error when running under ASAN that appears unrelated to the mutex warning. I think ScottTodd@c894989 fixes that (PendingBatch has absl::Span members, which need to be copied into more persistent structures if they are going to be used outside of the stack scope of Submit()).

Let's untangle this next week after holidays / the weekend.

@antiagainst

Copy link
Copy Markdown
Member Author

Updated to revert the change for inlining lambda and pulled in Scott's magic for silencing ASAN check.

// We need to return all remaining submissions back to the queue to avoid
// dropping work.
auto submission_cleanup = MakeCleanup([this, &remaining_submissions]() {
// Disable thread-safety-analysis as it doesn't understand this lambda.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For the record, I'm not totally confident in my interpretation of the analysis here, and this pattern isn't listed as a "known-limitation".

@antiagainst
antiagainst merged commit f1f88ac into iree-org:main Jul 7, 2020
@antiagainst
antiagainst deleted the fix-queue-bugs branch July 7, 2020 18:46
@GMNGeoffrey GMNGeoffrey mentioned this pull request Jul 8, 2020
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.

3 participants