Commit Graph

14787 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
dd9a9a6436 [Concurrency] Task APIs use thread-local ActiveTask now 2021-02-24 19:19:44 +09:00
Konrad `ktoso` Malawski
de5fdcd2f8 [TaskGroup] fix missing retain in scheduling next() immediately on offer 2021-02-24 18:45:33 +09:00
Richard Wei
17cf2727cd [AutoDiff] Remove 'withoutDerivative(at:in:)' and 'withDerivative(_:)'.
These APIs are not included in the initial proposal.
2021-02-24 01:36:29 -05:00
Richard Wei
0b53a02544 [AutoDiff] Rename 'in:' to 'of:' in differential operators.
Rename the argument label `in:` in `gradient(at:in:)`, `pullback(at:in:)`, etc to `of:`, as suggested in the [pitch thread](https://forums.swift.org/t/differentiable-programming-for-gradient-based-machine-learning/42147).
2021-02-24 01:33:42 -05:00
Konrad `ktoso` Malawski
655d8f13e7 cleanup after rebase; this is likely incorrect in some way 2021-02-24 12:10:49 +09:00
Richard Wei
8bc6143a4c [AutoDiff] Rename 'move(along:)' to 'move(by:)'.
Rename `move(along:)` to `move(by:)` based on the proposal feedback. The main argument for the change is that tangent vectors specify both a direction and a magnitude, whereas `along:` does not indicate that `self` is being moved by the specified magnitude.
2021-02-23 21:45:01 -05:00
Konrad `ktoso` Malawski
6f4fca8721 Merge branch 'main' into wip-no-escape-group 2021-02-24 08:59:53 +09:00
Michael Gottesman
91317c723c [ownership] Make whether or not we serialize in OSSA form based off of the flag -enable-ossa-modules.
I added a change to CMake so that the stdlib still gets the option passed in so
should be NFC.
2021-02-22 19:07:45 -08:00
John McCall
dcc1292787 Merge pull request #36079 from rjmccall/thread-local-task-state
Progress towards storing task/executor state in thread-local storage
2021-02-22 12:06:52 -05:00
John McCall
2012195cd5 Alter the runtime interface for awaiting futures and task groups.
First, just call an async -> T function instead of forcing the caller
to piece together which case we're in and perform its own copy.  This
ensures that the task is actually kept alive properly.

Second, now that we no longer implicitly depend on the waiting tasks
being run synchronously, go ahead and schedule them to run on the
global executor.

This solves some problems which were blocking the work on TLS-ifying
the task/executor state.
2021-02-21 23:48:13 -05:00
John McCall
1c82c71486 Make an Error.h that declares the public ABI for errors.
NFC except that I added swift_errorRetain and swift_errorRelease
functions on non-ObjC targets so that we have consistent
functions to call in the runtime.  I have not changed everywhere
in the runtime to use these, nor have I changed the compiler to
call them.
2021-02-21 23:45:07 -05:00
Konrad `ktoso` Malawski
fbaebfd79b [Concurrency] Escalating task groups, type fix, group record IS-NOT a child record 2021-02-22 13:26:38 +09:00
Konrad `ktoso` Malawski
07d6715d9f cleanup: remove all println debugging from task infra 2021-02-22 13:26:38 +09:00
Konrad `ktoso` Malawski
999758cc85 [Concurrency][TaskGroup] allow cancelAll be invoked from child tasks 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
485a894268 [Concurrency] give up on child task (async let) record storage for now 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
35f75ba2f2 [Concurrency] Add notes about removing children on next() 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
3132009929 [Concurrency] Track group children in task record + invasive links 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
1c4655df6a [Concurrency] track child tasks from group in Task records 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
efc7d8e627 [Concurrency] rearrange layout of AsyncTask now that task locals and groups coexist 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
12e2ba07b1 [Concurrency] Conform Task.Group to AsyncSequence 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
b1e5c4a2c4 test cleanups, additional test to check we dont cancel other groups 2021-02-22 13:26:28 +09:00
Konrad `ktoso` Malawski
1860b20cb7 [Concurrency] cancel all child tasks of a group on cancelAll 2021-02-22 13:26:27 +09:00
Konrad `ktoso` Malawski
854cade5d6 cleanups, cancellation 2021-02-22 13:26:27 +09:00
Konrad `ktoso` Malawski
a368aa1872 [Concurrency] store child record, cancellation works; async_task_cancellation 2021-02-22 13:26:27 +09:00
Konrad `ktoso` Malawski
edbcb1ea9e [Concurrency] task cancellation propagate through children 2021-02-22 13:26:27 +09:00
Konrad `ktoso` Malawski
1970dbfdae fix over releasing the current task by group dealloc 2021-02-22 13:26:27 +09:00
Konrad `ktoso` Malawski
a100424b4a getting there with assuming that poll is a single task 2021-02-22 13:26:27 +09:00
Konrad `ktoso` Malawski
a226259d84 [Concurrency] TaskGroup moves out of AsyncTask, non escaping body 2021-02-22 13:26:27 +09:00
John McCall
8e9823c369 Store the current task and executor in task-local storage. 2021-02-21 21:39:14 -05:00
Doug Gregor
d9e4184742 Make Error and CodingKey conform to ConcurrentValue.
Make both Error and CodingKey conform to ConcurrentValue, so that
thrown errors always conform to ConcurrentValue. Downgrade (to
warnings) and ConcurrentValue-related diagnostics that are triggered
by this change in existing Error and CodingKey-conforming types to
reduce the impact on source compatibility.
2021-02-20 22:01:28 -08:00
Arnold Schwaighofer
4373bdd6d0 Conditionally start using llvm::CallingConv::SwiftTail for async functions
This is conditional on UseAsyncLowering and in the future should also be
conditional on `clangTargetInfo.isSwiftAsyncCCSupported()` once that
support is merged.

Update tests to work either with swiftcc or swifttailcc.
2021-02-18 09:25:15 -08:00
swift-ci
6b8039928d Merge pull request #36034 from ktoso/wip-fix-withLocal-non-escape 2021-02-18 07:01:10 -08:00
Konrad `ktoso` Malawski
fc1da16eae [Concurrency][TaskLocal] Add test for throwing out of a withLocal 2021-02-18 21:27:58 +09:00
Konrad `ktoso` Malawski
7dbccec449 [Concurrency][TaskLocal] Collapse APIs and remove unnecessary escaping 2021-02-18 21:16:09 +09:00
Konrad `ktoso` Malawski
40b6b18945 [Concurrency] implement withCancellationHandler via records 2021-02-18 17:27:15 +09:00
Karoy Lorentey
9acf214b98 Merge pull request #36002 from lorentey/inline-partitioning-impl
[stdlib] Make MutableCollection.partition(by:) implementation inlinable
2021-02-17 18:56:55 -08:00
Alex Martini
9eabba58cb Make abstracts one sentence long.
The second sentence was added while rewriting to remove 'iff' in commit
6bc4c85005.
2021-02-17 15:31:24 -08:00
Alex Martini
db9fc0beed Fix a few contractions, per reference style guide. 2021-02-17 15:16:34 -08:00
Alex Martini
0b9ae84d66 Remove misleading comment about .zero.
There's nothing useful to say about the type of .zero -- it's
constrained by the protocol to Self, so you don't have any choice what
it is when conforming to AdditiveArithmetic.

Fixes <rdar://problem/72592923> (SR-13983).
2021-02-17 15:09:49 -08:00
Alex Martini
cc708f8cf6 Make an abstract one sentence long.
Fixes <rdar://problem/70543419>.
2021-02-17 15:03:18 -08:00
Alex Martini
9180e6a373 Use the correct argument label in prose.
See also these commits, which fixed the same issue in the code listing:

    589dd73d39
    bbe1811950
2021-02-17 14:52:00 -08:00
Alex Martini
349034651c Add missing code voice. 2021-02-17 14:52:00 -08:00
Alex Martini
e19a2f5811 Avoid 'a' vs 'an' alternation before type name. 2021-02-17 14:51:59 -08:00
Alex Martini
b92a5bd290 Fix spelling and stray space. 2021-02-17 14:51:59 -08:00
Alex Martini
d7ac2123d8 Keep doc comment before declaration.
Because the attribute is part of the declaration, putting a doc comment
between the attribute and "public" ends up with the comment in the
middle of the declaration.  This results in SourceKit skipping over the
comment, and the docs not being shown.

Fixes <rdar://problem/58716408>.
2021-02-17 14:51:58 -08:00
Alex Martini
5fb5a7265b Put code snippet in code voice.
Fixes <rdar://problem/65609221>.
2021-02-17 14:51:58 -08:00
Alex Martini
aad4fed25d Document floating point descriptions.
Fixes <rdar://problem/51409021>.
2021-02-17 14:51:57 -08:00
Varun Gandhi
9c6c9a51e1 Merge pull request #36021 from varungandhi-apple/vg-fix-completeTask-convention
[Runtime] Fix calling convention of async function.
2021-02-17 13:22:10 -08:00
Varun Gandhi
7eeabd9300 [Runtime] Fix calling convention of async function.
Otherwise, we run into a type error on turning on swiftasync.
2021-02-17 10:10:35 -08:00
Karoy Lorentey
4f016c9caf [stdlib] Make MutableCollection.partition(by:) implementation inlinable
The default `partition(by:)` implementation cannot currently be specialized, which makes it ~64-100x slower than it could be for common cases. (E.g., `Array<Int>.partition(by: { $0 >= foo})` is slower than `.sort()` by a factor of 2-32.)

Make the implementation inlinable.
2021-02-16 13:56:17 -08:00