-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Back swift_task_enqueueGlobal with public Dispatch API #34997
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
Conversation
@swift-ci Please test |
Build failed |
Build failed |
@@ -308,6 +306,9 @@ extension Task { | |||
// Create the asynchronous task future. | |||
let (task, _) = Builtin.createAsyncTaskFuture(flags.bits, nil, operation) | |||
|
|||
// Enqueue the resulting job. | |||
_enqueueJobGlobal(Builtin.convertTaskToJob(task)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to do this for _runChildTask
as well.
CMakeLists.txt
Outdated
@@ -941,7 +941,7 @@ if (LLVM_ENABLE_DOXYGEN) | |||
message(STATUS "Doxygen: enabled") | |||
endif() | |||
|
|||
if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT) | |||
if(SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT OR SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing you'll need to teach _Concurrency
to link against the (C) lib dispatch on Linux and Windows.
df7bd87
to
5b2db3d
Compare
@swift-ci Please test |
Windows failure:
|
Okay, I think the Windows failure is because you need to use |
Build failed |
5b2db3d
to
4d3d562
Compare
@swift-ci Please test |
Build failed |
4d3d562
to
f79c87a
Compare
@swift-ci Please test |
Build failed |
@swift-ci Please test |
Build failed |
f79c87a
to
f96a6bf
Compare
@swift-ci Please test |
Build failed |
Build failed |
f96a6bf
to
3cbb4b8
Compare
@swift-ci Please test |
Build failed |
@swift-ci Please test |
0070c27
to
b14af23
Compare
Build failed |
Build failed |
9f87785
to
be5a66d
Compare
@swift-ci Please test |
be5a66d
to
0d368ec
Compare
@swift-ci Please test |
Okay, there's a remaining test failure on Windows, but a bunch of work is blocking on this, so I marked the test as unsupported and filed rdar://72171028 to fix it post-commit. |
Build failed |
0d368ec
to
79f0ad3
Compare
@swift-ci Please test |
79f0ad3
to
2f7636a
Compare
@swift-ci Please test |
Build failed |
@swift-ci Please test |
2f7636a
to
c5fcaef
Compare
Build failed |
Build failed |
@swift-ci Please test Windows |
I'm going to use this in Builtins.cpp.
c5fcaef
to
f788445
Compare
@swift-ci Please test |
We expect to iterate on this quite a bit, both publicly and internally, but this is a fine starting-point. I've renamed runAsync to runAsyncAndBlock to underline very clearly what it does and why it's not long for this world. I've also had to give it a radically different implementation in an effort to make it continue to work given an actor implementation that is no longer just running all work synchronously. The major remaining bit of actor-scheduling work is to make swift_task_enqueue actually do something sensible based on the executor it's been given; currently it's expecting a flag that IRGen simply doesn't know to set.
It would be more abstractly correct if this got DI support so that we destroy the member if the constructor terminates abnormally, but we can get to that later.
Currently, the only thing in the system that donates a thread to run it is swift_runAndBlockThread, but we'll probably need others. Nothing in the concurrency runtime should block via a semaphore in this configuration. As an outrageous hack, work around the layering problems with using libdispatch from the concurrency library on non-Darwin systems by making those systems use the cooperative global executor. This is only acceptable as a temporary solution for landing this change and setting things onto the right long-term design.
f788445
to
7cc63f9
Compare
@swift-ci Please test |
We expect to iterate on this quite a bit, both publicly and internally, but this is a fine starting-point.
I've renamed
runAsync
to runAsyncAndBlock to underline very clearly what it does and why it's not long for this world. I've also had to give it a radically different implementation in an effort to make it continue to work given an actor implementation that is no longer just running all work synchronously.The major remaining bit of actor-scheduling work is to make
swift_task_enqueue
actually do something sensible based on the executor it's been given; currently it's expecting a flag that IRGen simply doesn't know to set. But we may want to express this as a more general actor-to-executor projection step.