Commit Graph

223 Commits

Author SHA1 Message Date
Pavel Yaskevich
39a66b5edb [Distributed] Treat swift_distributed_execute_target like a regular async function
This means that:

- It's allowed to be generic;
- It doesn't need special context + resume handling micro-optimization.
2022-02-15 16:02:36 -08:00
Konrad `ktoso` Malawski
b02f9c7a97 [Distributed] ad-hoc req for decodeNextArgument & onReturns
fixup
2022-02-16 08:18:30 +09:00
Konrad `ktoso` Malawski
0fec1b31da [Distributed] Implement ad-hoc checks for
DistributedTargetInvocationEncoder
2022-02-11 19:26:18 +09:00
Konrad `ktoso` Malawski
bffd956033 [Distributed] improve ad-hoc requirement typechecking 2022-02-11 19:25:48 +09:00
Konrad `ktoso` Malawski
fc83047985 [Distributed] Update availability of distributed types to 5.7 2022-02-03 21:55:41 +09:00
Konrad `ktoso` Malawski
48db739db0 [Distributed] Record generic substitution types for invocation 2022-02-02 18:12:32 +09:00
Pavel Yaskevich
3a3f78b25b [Distributed] Remove decodeNextArgument from protocol requirements
It's an ad-hoc requirement that has to be checked by the compiler,
since it requires knowledge about a concrete serialization requirement
type associated with a particular distributed actor system.
2022-01-30 19:08:16 -08:00
Pavel Yaskevich
b82c67d2c1 [Distributed] NFC: Remove obsolete HeterogeneousBuffer type
Distributed actor's runtime no longer needs it since it has been
switched to argument decoder.
2022-01-29 14:33:41 -08:00
Pavel Yaskevich
d0fdf20552 [Distributed] Runtime: Switch to use argument decoder instead of heterogeneous buffer 2022-01-29 14:33:41 -08:00
Pavel Yaskevich
8bff147227 [Distributed] Remove extraneous DistributedTargetInvocationArgumentDecoder 2022-01-29 14:33:41 -08:00
Konrad `ktoso` Malawski
6a0164d16f [Distributed] Reuse fake actor systems more in tests 2022-01-28 21:21:08 +09:00
Konrad `ktoso` Malawski
4bf2a92bda [Distributed] Remove @_dynamic replacements; impl remoteCall ad-hoc reqs
Squashed commit of the following:

commit e5a05ffe44
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 17:45:31 2022 +0900

    cleanup

commit 1f751cea5a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:50:33 2022 +0900

    cleanups

commit c632f3215d
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:01:09 2022 +0900

    add test for generic from actor decl

commit 09b8bd50a7
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:00:58 2022 +0900

    cleanups

commit 31f4d0cffd
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 11:40:51 2022 +0900

    fix test

commit ad4db2fb6c
Merge: 97227edcca 07e2dfda56
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 26 23:31:41 2022 +0900

    Merge branch 'main' into wip-zzz

commit 97227edcca
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 26 21:01:25 2022 +0900

    remove @_dynamic methods!

    fix tests

commit 1c79344dbb
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 19 12:51:09 2022 +0900

    cleanup

    wip

    stuck

    fixed the stack cleanups

    cleanups pretty good now

    weird load

    rki

    works

    remove hack

    add take + throw + return

    fix test

    more tests fixed

    more tests fixed

    more tests fixed

commit 3ed494c175
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 18 21:09:28 2022 +0900

    stack issues in SIL verification

commit 5cf43a7f86
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 18 09:19:51 2022 +0900

    about to call the remoteCall

    goot to return, but missing subs

commit df8e47122a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 13 14:09:49 2022 +0900

    [Distributed] Refactor Invocation to Decoder/Encoder

    getting there

    done-recording

    working on the string init

    stuck trying to get String initializer SILFunction

    created the remote call target

commit fc7bd62f32
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 23:01:14 2022 +0900

    [Distributed] Pass arguments from Invocation to HBuffer

commit cafc2cc058
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 22:08:47 2022 +0900

    works

commit a7d01837ff
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 15:48:58 2022 -0800

    [Distributed] Adjust interface of `swift_distributed_execute_target`

    Since this is a special function, `calleeContext` doesn't point to
    a direct parent but instead both parent context (uninitialized)
    and resume function are passed as last arguments which means that
    `callContext` has to act as an intermediate context in call to accessor.

commit c1f830be27
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 17:00:08 2022 -0800

    [Distributed] Drop optionality from result buffer in `_executeDistributedTarget`

    `RawPointer?` is lowered into a two arguments since it's a struct,
    to make it easy let's just allocate an empty pointer for `Void` result.

commit c83c2c37b6
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 17:02:45 2022 -0800

    [Distributed] NFC: Update _remoteCall test-case to check multiple different result types

commit 29e7cf50e4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 21:32:37 2022 +0900

    wip

commit 9128ecc6f8
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 20:46:20 2022 +0900

    wip

commit a6b2a62a67
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 20:38:22 2022 +0900

    wip

commit 8b188f0d43
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 16:55:10 2022 +0900

    wip

commit 3796bec2b9
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 16:55:02 2022 +0900

    wip

commit 0ffc68b5ef
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 11 21:44:58 2022 +0900

    [Distributed] Implementing ad-hoc protocol requirements

commit 78862575e4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 18:03:54 2022 +0900

    cleanup

commit 5f4ab89e25
Merge: 24a628e7c0 fdda6f2ee4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 15:51:39 2022 +0900

    Merge branch 'main' into wip-impl-execute-swift

commit 24a628e7c0
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 15:33:21 2022 +0900

    wip

commit 69e7fed09d
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Dec 22 06:36:45 2021 +0900

    [Distributed] comment out distributed_actor_remoteCall for now

commit 376733a9f6
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Dec 21 16:00:06 2021 +0900

    reimplement distributed get type info impls

commit 74ab47886a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Dec 15 21:37:08 2021 +0900

    [Distributed] Implement func metadata and executeDistributedTarget

    dont expose new entrypoints

    able to get all the way to calling _execute
2022-01-27 17:51:43 +09:00
Pavel Yaskevich
3fa5e20c17 [Distributed] Add stdlib include to give access to llvm/ADT 2022-01-25 11:04:18 -08:00
Pavel Yaskevich
624b27257a [Distributed] Move some of the swift_distributed_* accessors to a dedicated file
Add a new `DistributedActor.cpp` and move some of the logic related to
swift_distributed_execute_target there to avoid exporting it from Concurrency.
2022-01-24 18:22:37 -08:00
Pavel Yaskevich
1fc0f3c266 [Distributed] Runtime: Move substitutions/witness tables deallocation to the outer context
Fixes a bug where substitutions and witness tables buffers are going
to be deallocated at the end of the `if` block before calling
`_executeDistributedTarget`.
2022-01-24 10:18:00 -08:00
Pavel Yaskevich
59ff689f28 [Distributed] IRGen: Teach distributed thunk accessor to load witness tables (when needed) 2022-01-24 10:18:00 -08:00
Pavel Yaskevich
d55f8f72b0 [Distributed] ExecuteTarget: Add missing deallocation of substitutions buffer 2022-01-24 10:18:00 -08:00
Pavel Yaskevich
e801e4e2b7 [Distributed] Runtime: Add a way to fetch witness tables for given generic env/arguments 2022-01-24 10:18:00 -08:00
Pavel Yaskevich
406af83329 [Distributed] Runtime/IRGen: Allow passing substitutions to distributed accessor
Accept an optional list of substitutions which are required to form
a call to a generic distributed thunk.
2022-01-24 10:18:00 -08:00
Pavel Yaskevich
925b59826d [Distributed] IRGen: Drop result type for accessor parameters 2022-01-24 10:18:00 -08:00
Pavel Yaskevich
e7ceddc564 [Distributed] IRGen: Provide argument/result types to the accessor 2022-01-24 10:17:59 -08:00
Pavel Yaskevich
206969a705 [Distributed] Augment parameter/result type decoded to support generic substitutions 2022-01-24 10:17:59 -08:00
Pavel Yaskevich
0e35951213 [Distributed] Stage use of generic environment to decode target parameter/result types 2022-01-24 10:17:59 -08:00
Pavel Yaskevich
d54e3294c3 [Distributed] Runtime: Implement a way to access generic env of distributed target 2022-01-24 10:17:59 -08:00
Pavel Yaskevich
cbf4eb2701 [Distributed] A couple of improvements to HeterogeneousBuffer and test-cases (#40848)
* [Distributed] NFC: Support encoding/decoding of substitutions by `FakeInvocation`

* [Distributed] Fix a bug in heterogeneous buffer iterator

`next()` did not advance offset by the size of the returned element

* [Distributed] NFC: Adjust `echo` test to handle two arguments
2022-01-14 17:46:49 +09:00
Konrad `ktoso` Malawski
ef14ff15e8 [Distributed] Refactor Invocation to Decoder/Encoder 2022-01-13 18:27:18 +09:00
Konrad `ktoso` Malawski
930480b864 [Distributed] Pass args from Invocation to HBuffer 2022-01-12 23:48:01 +09:00
Pavel Yaskevich
680698e099 [Distributed] Fix _executeDistributedFunction resume and result buffer (#40814)
* [Distributed] Adjust interface of `swift_distributed_execute_target`

Since this is a special function, `calleeContext` doesn't point to
a direct parent but instead both parent context (uninitialized)
and resume function are passed as last arguments which means that
`callContext` has to act as an intermediate context in call to accessor.

* [Distributed] Drop optionality from result buffer in `_executeDistributedTarget`

`RawPointer?` is lowered into a two arguments since it's a struct,
to make it easy let's just allocate an empty pointer for `Void` result.

* [Distributed] NFC: Update _remoteCall test-case to check multiple different result types
2022-01-12 23:18:40 +09:00
Konrad `ktoso` Malawski
9438cf6b2e [Distributed] Func metadata operations and implement executeDistributedTarget entry (#40605)
* [Distributed] Implement func metadata and executeDistributedTarget

dont expose new entrypoints

able to get all the way to calling _execute

* [Distributed] reimplement distributed get type info impls

* [Distributed] comment out distributed_actor_remoteCall for now

* [Distributed] disable test on linux for now
2022-01-09 23:55:06 +09:00
Konrad `ktoso` Malawski
cee89ec541 [Distributed] DistributedActorSystem renaming and redesign (#40387)
* [Distributed] towards DistributedActorSystem; synthesize the id earlier, since Identifiable.id

* Fix execute signature to what Pavel is working with

* funcs are ok in sil

* fixed lifetime of id in inits

* fix distributed_actor_deinit

* distributed_actor_local

* update more tests

fixing tests

fix TBD test

fix Serialization/distributed

fix irgen test

Fix null pointer crashes

* prevent issues with null func ptrs and fix Distributed prorotocol test

* fix deinit sil test
2021-12-13 11:29:25 +09:00
Doug Gregor
b37f77f350 Merge pull request #40033 from DougGregor/distributed-actors-without-existentials
Eliminate required type erasure from distributed actors
2021-11-04 22:31:51 -07:00
Konrad `ktoso` Malawski
61a1bc2a6c [Distributed] remove public default AnyActorTransport alias
The previously set public AnyActorTransport was a temporary thing,
and instead we want to set this in every module that declares such
actors.
2021-11-04 15:54:56 +09:00
Doug Gregor
4aacc1c99e Make the actor identity type an associated type of ActorTransport
Eliminate the use of the type-erased `AnyActorIdentity` within the
distributed actor protocol by exposing the identity type of an actor
transport as an associated type, `Identity`, which is then used to
refer to all actors that have that transport.

Retain `AnyActorIdentity`, because it remains useful for type-erasing
actor transports, especially as the `Identity` type for
`AnyActorTransport`. For now, make it the default type of `Identity`:
this helps smooth over the transition from use of `AnyActorIdentity`,
but we might want to remove this to make use of the type-erased forms
always opt-in.
2021-11-03 08:58:21 -07:00
Doug Gregor
c2ba06c3d2 Make the actor transport an associated type of the DistributedActor protocol.
Eliminate the required use of existentials in distributed actors by
introducing the `Transport` associated type into the
`DistributedActor` protocol. Each distributed actor has a known
(concrete) actor transport type, reducing storage requirements and
transport dynamism when it isn't needed.

Distributed actors can manually specify their `Transport` associated
type or pick up a default by looking for a type named
`DefaultActorTransport`. A library that vends an actor transport can
make create a public typealias `DefaultActorTransport` referring to
its transport, so importing that library and defining a distributed
actor will use that library's transport.

Introduce a type-erased `AnyActorTransport` type to provide an
explicitly dynamic actor transport. This is still an important option,
e.g., for cases where one wants to be able to dynamically change the
transport for testing or different kinds of deployment. For now, we
default to this transport in the library (via `DefaultActorTransport`),
but we may very well want to eliminate this because it will be
ambiguous with client libraries that vend their own
`DefaultActorTransport`.
2021-11-01 22:37:33 -07:00
Karoy Lorentey
2732765096 [CMake] Introduce availability macros for all known stdlib releases
Introduce "SwiftStdlib x.y"-style availability macros for all known releases of the stdlib, adding them to the swift flags of all Swift libraries and tests.
2021-10-28 18:31:54 -07:00
Karoy Lorentey
5e78c3bfdc [Distributed] Restore availability macro definitions & update to 5.6
The _Distributed module is being introduced in Swift 5.6, so its definitions need to come with matching availability. (We don't have version numbers for the associated OS releases, so we need to use placeholder 9999 availability for these.)
2021-10-28 16:41:37 -07:00
Karoy Lorentey
47956908b7 [Concurrency] SwiftStdlib 5.5 ⟹ SwiftStdlib 5.1 (usages)
The concurrency runtime now deploys back to macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, which corresponds to the 5.1 release of the stdlib.

Adjust macro usages accordingly.
2021-10-28 14:36:36 -07:00
Konrad `ktoso` Malawski
39fa0d7464 [Distributed] be more explicit about DA being Sendable 2021-10-23 19:41:58 +09:00
Kavon Farvardin
006e2b446b Replace destoryDistributedActor builtin with destroyDefaultActor
Currently, they both end up doing the exact same thing, so there's
no need for both.
2021-10-21 19:41:31 -07:00
Konrad `ktoso` Malawski
480bb082a9 [Distributed] Naive impl of whenLocal for distributed actors (#39654)
* [Distributed] Hacky impl of whenLocal for distributed actors

* cleanup & fix one test

* disable test on windows
2021-10-10 12:44:57 +09:00
Konrad `ktoso` Malawski
38c8544a73 Merge pull request #39087 from ktoso/wip-serialization-dist
[Distributed] distributed decls working across files
2021-08-31 06:42:29 +09:00
Doug Gregor
599974367e Enable concurrency back-deployment in the compiler by default.
Remove the option that explicitly enables concurrency back-deployment,
and instead always enable its support in the compiler. Remove the use
of the extraneous CMake option as well.
2021-08-28 22:43:41 -07:00
Konrad `ktoso` Malawski
9f1fedb13b WIP serialization, many files etc 2021-08-28 17:40:20 +09:00
swift-ci
4681d41286 Merge pull request #39046 from ktoso/wip-derive-style 2021-08-26 16:46:46 -07:00
Konrad `ktoso` Malawski
c868bdd9f1 [Distributed] resolve synthesis via DerivedConformanceDistributedActor <3 2021-08-27 06:21:34 +09:00
Doug Gregor
ebd7b49755 Build compiler, other libraries, and tests for back-deployed concurrency.
When build-script is given `--back-deploy-concurrency`, also use that
to build other parts of Swift with the back-deployed versions:

* The compiler allows async and actors to be defined with the
back-deployed availability, e.g., the same as `-Xfrontend
-enable-experimental-back-deploy-concurrency`. (The latter will go
away soon)
* The standard library unit testing framework and distributed actors
library are build with the older OS versions.
* The tests use the older OS versions, with some adjustments to make
them agnostic to the back-deployment setting.
2021-08-26 08:49:44 -07:00
Konrad `ktoso` Malawski
ee43ea827a [Distributed] fix AnyActorIdentity equality impl 2021-08-24 19:27:47 +09:00
Konrad `ktoso` Malawski
c916c0a394 [Distributed] decode init for DistributedActor (#38998)
* Revert "Revert "Merge pull request #38938 from drexin/wip-dist-resolve" (#38994)"

This reverts commit f6ae9f3387.

* [Distributed] decode init for DistributedActor
2021-08-24 17:00:58 +09:00
Dario Rexin
d43ea45b6a Revert "Revert "Merge pull request #38938 from drexin/wip-dist-resolve" (#38994)" (#39011)
This reverts commit f6ae9f3387.
2021-08-24 13:33:37 +09:00
Konrad `ktoso` Malawski
f6ae9f3387 Revert "Merge pull request #38938 from drexin/wip-dist-resolve" (#38994)
This reverts commit a4f3f2fb48, reversing
changes made to 8cf6c2e71b.
2021-08-23 20:30:41 +09:00