-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Concurrency] WIP: Rework task_switch with task executors, don't enqueue unless necessary #85191
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
base: main
Are you sure you want to change the base?
Conversation
This is mostly right but sometimes hitting a lockup somewhere that I was not able to figure out yet. This needs much cleanup and is mostly for sharing Work in Progress for discussion right now.
| // ABI Note: We need to use @abi here because the ABI of this function otherwise conflicts with the legacy | ||
| // @_unsafeInheritExecutor declaration, as none of them have (or mangle) the implicit | ||
| @abi( | ||
| nonisolated(nonsending) func withCheckedContinuationNonisolatedNonsending<T>( |
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.
These are done in #84944
| #define SWIFT_TASK_DEBUG_LOG_ENABLED 1 | ||
| #define SWIFT_TASK_DEBUG_LOG(fmt, ...) \ | ||
| fprintf(stderr, "[%#lx] [%s:%d](%s) " fmt "\n", \ | ||
| fprintf(stdout, "[%#lx] [%s:%d](%s) " fmt "\n", \ |
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.
FIXME: just for debugging, undo this
|
@swift-ci please smoke test |
0407798 to
79bc38a
Compare
| TaskExecutorRef currentTaskExecutor = (trackingInfo ? trackingInfo->getTaskExecutor() | ||
| : TaskExecutorRef::undefined()); | ||
| if (!trackingInfo) SWIFT_TASK_DEBUG_LOG("Missing executor tracking, assume currentTaskExecutor = %s.", "undefined"); | ||
| TaskExecutorRef newTaskExecutor = task->getPreferredTaskExecutor(); |
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 might have missed this and it is solved differently but are we still keeping track of the default executors as part of the tracking info? In particular, our default executor are conforming to TaskExecutor and they will call runSynchronously with the TaskExecutor overload. I want to be sure that if there is only a custom default executor, no isolation and no task executor preference that we are also hitting the fast path.
|
@swift-ci please smoke test |
This is mostly right but sometimes hitting a lockup somewhere that I was not able to figure out yet.
This needs much cleanup and is mostly for sharing Work in Progress for discussion right now.
Work in progress table of behaviors