Skip to content

[Concurrency] repair cooperative executor and its tests #39365

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

Merged
merged 6 commits into from
Sep 27, 2021

Conversation

kateinoigakukun
Copy link
Member

This patch repairs the main executor to avoid assertion failure due to witnessTable == nullptr introduced by my previous patch 😓 #39092

And fixes and disables some tests that depend on multi-thread based executor implementation detail.

This also fixes CI failure on WebAssembly CI: https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-20.04-webassembly/10/console

This patch repairs the build failure for cooperative executor.
And also fixed main executor to avoid assertion failure due to
`witnessTable == nullptr`
Some headers switch their inline implementations based on
SWIFT_STDLIB_SINGLE_THREAD_RUNTIME definition.
This fixes linking failure while building runtime unittests
@MaxDesiatov
Copy link
Contributor

preset=buildbot_incremental_linux_crosscompile_wasm
@swift-ci please test with preset Linux Platform

@MaxDesiatov
Copy link
Contributor

@swift-ci please smoke test

@MaxDesiatov MaxDesiatov requested a review from ktoso September 19, 2021 17:08
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

I have a couple of small nits (and there's a test failure), but this generally looks very good. Thank you!

ExecutorRef swift::swift_task_getMainExecutor() {
#if SWIFT_CONCURRENCY_COOPERATIVE_GLOBAL_EXECUTOR
return ExecutorRef::forOrdinary(&_swift_mainExecutorIdentity, nullptr);
return ExecutorRef::generic();
Copy link
Member

Choose a reason for hiding this comment

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

This is interesting. In the cooperative case, does@MainActor not really have its own executor, because all executors are the same? Or is it that we should have a main-actor actor and dispatching to it goes in through the same run loop? I think I agree that this is the right approach.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I respected the former from my understanding, but I'm not confident here.

@kateinoigakukun kateinoigakukun force-pushed the katei/fix-coop-executor-part-2 branch from 779ad22 to 0b70235 Compare September 21, 2021 23:15
@ktoso
Copy link
Contributor

ktoso commented Sep 22, 2021

@swift-ci please smoke test

@MaxDesiatov

This comment has been minimized.

@kateinoigakukun
Copy link
Member Author

The failing test seems unrelated to this change 👀

@MaxDesiatov

This comment has been minimized.

4 similar comments
@MaxDesiatov

This comment has been minimized.

@MaxDesiatov

This comment has been minimized.

@MaxDesiatov

This comment has been minimized.

@MaxDesiatov
Copy link
Contributor

@swift-ci please test Windows platform

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for poking the CI while it was flaky.

@ktoso ktoso merged commit e7342eb into swiftlang:main Sep 27, 2021
@kateinoigakukun kateinoigakukun deleted the katei/fix-coop-executor-part-2 branch September 27, 2021 04:03
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.

4 participants