Commit Graph

3292 Commits

Author SHA1 Message Date
Doug Gregor
99f8d7a5e8 [SIL] Add @concurrent function types to SIL
Add @concurrent to SIL function types, mirroring what's available on
AST function types. @concurrent function types will have by-value
capture semantics.
2021-01-29 11:16:17 -08:00
Doug Gregor
ba8819eb58 [Concurrent] Introduce concurrent function types.
Introduce `@concurrent` attribute on function types, including:
* Parsing as a type attribute
* (De-/re-/)mangling for concurrent function types
* Implicit conversion from @concurrent to non-@concurrent
- (De-)serialization for concurrent function types
- AST printing and dumping support
2021-01-27 14:22:32 -08:00
Varun Gandhi
72105d59b0 Merge pull request #35284 from apple/remove-needless-directory
Stop creating swift-project/swift/swift
2021-01-20 17:12:06 -08:00
Varun Gandhi
d9cd7e73cd Merge pull request #35457 from varungandhi-apple/vg-cleanup-rep-matching
[docs] Tidy and document permissible conversions based on calling conventions
2021-01-20 13:28:54 -08:00
Richard Wei
e3db926e0c [AutoDiff] Remove '_Differentiable.zeroTangentVectorInitializer'. (#35329)
Remove `_Differentiable.zeroTangentVectorInitializer` to address the feedback on the [proposal thread](https://forums.swift.org/t/differentiable-programming-for-gradient-based-machine-learning/42147). The corresponding change has already been made in the [proposal](https://github.com/rxwei/swift-evolution/blob/autodiff/proposals/0000-differentiable-programming.md).

Removed components:
- `zeroTangentVectorInitializer` and `zeroTangentVector` in `Differentiable`, `Array`, `Optional`, `Float`, `Double`, `Float80`, and SIMD types.
- `zeroTangentVectorInitializer` synthesis logic in `Differentiable` derived conformances.
2021-01-20 10:45:03 -08:00
Varun Gandhi
29430d643d [doc] Dynamic cast of function types needs matching conventions. 2021-01-19 10:48:13 -08:00
3405691582
36728d73d5 [docs] Update docs for OpenBSD.
When making debug builds, `Decl.cpp` compiles with a large number of ELF
section headers; including randomdata sections as normally included by
the platform for security purposes, this may in reality exceed the ELF
limit of `SHN_LORESERVE`.

In this case, the ELF header field containing the number of section
headers, `e_shnum`, is set to 0 and the real number of section headers
is stored elsewhere. However, when an object file has no section
headers, this field is also set to 0.

OpenBSD uses the GNU binutils by default. These binutils do not handle
the case when `e_shnum` is 0, and assume that the object file has no
section headers.  But the only tool that counts is the static archive
tool `ar`. When creating the archive index, `ar` encounters `Decl.cpp.o`
as part of `libswiftAST.a`, notes that `e_shnum` is 0, and skips the
object file entirely, presumably because it thinks the object file has
no section headers and therefore no symbols. This leads the linker to
assume that symbols in `Decl.cpp.o` are not part of `libswiftAST.a`,
when in fact they are.

The LLVM version of `ar` does not appear to have this bug.

Since this is only a problem that is more likely to occur on debug
builds and workarounds like enabling LTO can alleviate the problem, do
not recommend that the `llvm` package be added as part of the standard
package dependency set, but merely note that using `llvm-ar` can work
around the problem. Indeed, future OpenBSD versions may include updated
binutils which may have this bug fixed.

While we are here, the new concurrency features require libdispatch, and
since some of the necessary patches to libdispatch have not yet been
reviewed or accepted upstream yet to make it work on OpenBSD, recommend
that prospective builders for this platform still disable features that
depend on libdispatch for now.

Additionally, update the platform version number which has been tested.
2021-01-18 20:19:16 -05:00
Alex Hoppen
bfe0a00551 Merge pull request #35429 from ahoppen/remove-bytetree
Remove ByteTree serialization format
2021-01-15 09:28:19 +01:00
Alex Hoppen
8ec8516893 Remove ByteTree serialization format
It was originally designed for faster trasmission of syntax trees from
C++ to SwiftSyntax, but superceded by the CLibParseActions. There's no
deserializer for it anymore, so let's just remove it.
2021-01-14 20:37:49 +01:00
Robert Widmann
843b25bbc7 Merge pull request #34423 from valeriyvan/patch-2
Fix snippet in OptimizationTips.rst
2021-01-13 18:00:14 -08:00
Slava Pestov
c997016bc6 Update some docs to talk about 'main' instead of 'master'
Fixes https://bugs.swift.org/browse/SR-14015 / rdar://problem/72819056
2021-01-11 22:57:51 -05:00
Robert Widmann
e27c862c20 Merge pull request #35279 from apple/clarify-use-sccache-env-var
Clarify SWIFT_USE_SCCACHE meaning
2021-01-09 08:05:54 -08:00
Dave Abrahams
94f2c0d020 Further clarification 2021-01-07 14:13:17 -08:00
Dave Abrahams
1ca367d4a0 sccache will start itself 2021-01-07 14:09:27 -08:00
Richard Wei
5e5f48471b Merge pull request #35259 from rxwei/autodiff-mangling
[AutoDiff] Mangle derivative functions and linear maps
2021-01-07 08:46:42 -08:00
Richard Wei
ffe6064101 Mangle derivative functions and linear maps.
- `Mangle::ASTMangler::mangleAutoDiffDerivativeFunction()` and `Mangle::ASTMangler::mangleAutoDiffLinearMap()` accept original function declarations and return a mangled name for a derivative function or linear map. This is called during SILGen and TBDGen.
- `Mangle::DifferentiationMangler` handles differentiation function mangling in the differentiation transform. This part is necessary because we need to perform demangling on the original function and remangle it as part of a differentiation function mangling tree in order to get the correct substitutions in the mangled derivative generic signature.

A mangled differentiation function name includes:
- The original function.
- The differentiation function kind.
- The parameter indices for differentiation.
- The result indices for differentiation.
- The derivative generic signature.
2021-01-07 02:21:10 -08:00
Dave Abrahams
565385b6b0 Stop creating swift-project/swift/swift
The instructions as written will create an unnecessary swift/swift directory, it looks like.
2021-01-06 14:49:46 -08:00
swift-ci
8da6fbf2bf Merge pull request #35272 from tbkka/tbkka/dynamicCast-existentialMetatypeClarification 2021-01-06 12:54:59 -08:00
Dave Abrahams
fcd054f448 Clarify SWIFT_USE_SCCACHE meaning 2021-01-06 11:38:11 -08:00
Max Desiatov
52d9398c30 Merge pull request #34998 from apple/maxd/fix-apple-silicon
CMake: fix build for Apple Silicon hosts

When building with `build-script` using these arguments

```
utils/build-script --skip-build-benchmarks
  --skip-ios --skip-watchos --skip-tvos
  --swift-darwin-supported-archs "arm64"
  --sccache --release-debuginfo --test
```

the build fails with

```
ninja: error: 'stdlib/swift-test-stdlib-macosx-x86_64',
needed by 'stdlib/CMakeFiles/swift-test-stdlib', missing and no known rule to make it
```

I think that the "Getting Started" guide should avoid hardcoding `x86_64` arguments, and suggest using `$(uname -m)` instead. `SWIFT_PRIMARY_VARIANT_ARCH_default` could also get its value from `CMAKE_HOST_SYSTEM_PROCESSOR` in the root `CMakeLists.txt`.

Resolves SR-13943.
2021-01-06 18:05:28 +00:00
Mishal Shah
6a61d119e8 Update the CI doc with new trigger info
OS X -> macOS
2021-01-06 09:32:16 -08:00
Tim Kientzle
0630981e2c Clarify existential metatype discussion, add a caveat about function casting 2021-01-05 18:28:39 -08:00
Michael Gottesman
0171e753d8 Merge pull request #35257 from apple/gottesmm-patch-1-sil.rst
[sil.rst] Fix some formatting
2021-01-05 12:08:10 -08:00
Michael Gottesman
ed2e1f63a2 [sil.rst] Fix another formatting error
Another case where spacing was off so the rendering on GitHub looks bad.
2021-01-04 18:22:07 -08:00
Michael Gottesman
f5e34b3d30 [sil.rst] Fix some formatting
Just a mistake I noticed.
2021-01-04 18:13:08 -08:00
Michael Gottesman
a7422b7aac [sil.rst] Add a discussion of "Dead End Blocks" and its implications upon OSSA.
The main implication being that we allow for values to be leaked along dead end
blocks.

NOTE: For those who are unaware, a dead end block in SIL is a block that is
post-dominated in the same function by program terminating blocks (which we
model using unreachables).
2020-12-29 13:32:17 -08:00
Mishal Shah
212acff1e1 Update the Xcode version to Xcode 12.3 GM 2020-12-22 01:54:57 -08:00
Michael Gottesman
a0679a40a6 [sil.rst] Use consistent white space margin around boxes in ascii figure. 2020-12-19 00:09:49 -08:00
Michael Gottesman
f91f4bb5a3 Merge pull request #35164 from gottesmm/pr-a5db5d0be1148c32aa477a5cd1d529d5682592e3
[sil.rst] Update Ownership SSA section given further feedback
2020-12-18 23:08:11 -08:00
Xiaodi Wu
fe140dda69 Merge pull request #35137 from twof/patch-1
Add -b flag to checkout
2020-12-18 22:01:58 -05:00
Michael Gottesman
414b82eb89 [sil.rst] Update Ownership SSA section given further feedback/small rst fixes. 2020-12-18 17:48:11 -08:00
Raphael Isemann
60f8efe393 [sil.rst] Fix invalid reStructuredText syntax
* 'Any' isn't defined anywhere, so the references to that are invalid.
* Starting a literal block but not having any leading whitespace in the next line
   causes "Literal block expected; none found."

This breaks the build when sphinx is installed.
2020-12-18 17:48:11 -08:00
Michael Gottesman
e54dd22073 Merge pull request #34884 from gottesmm/pr-442f09fe972ba38c706b52acd381ab5982bd6e07
[sil.rst] Update OSSA section for the introduction of an explicit "Ownership Kind Lattice".
2020-12-17 20:16:30 -08:00
Michael Gottesman
c80856c737 [sil.rst] Update OSSA section for the introduction of an explicit "Ownership Kind Lattice". 2020-12-17 11:58:42 -08:00
Alex Reilly
3b80719ea2 Add -b flag to checkout
I think this is necessary to create a new branch
2020-12-16 22:27:59 -08:00
Ben Rimmington
020b02af82 Update links to the Code of Conduct (#35128)
* Update README.md
* Update FirstPullRequest.md
2020-12-17 01:17:09 +00:00
nate-chandler
253099a1ce Merge pull request #35103 from nate-chandler/concurrency/irgen/rdar72336407
[IRGen] Corrected mangling of AsyncFunctionPointers.
2020-12-16 06:14:35 -08:00
Nate Chandler
73cfca89b6 [IRGen] Corrected mangling of AsyncFunctionPointers.
Previously, the suffix "AD" was used to mangle AsyncFunctionPointers.
That was incorrect because it was already used in the mangling scheme.
Here, that error is fixed by using 'u' under the thunk or specialization
operator 'T' to mangle AsyncFunctionPointers.  Additionally, printing
and demangling support is added.

rdar://problem/72336407
2020-12-15 18:24:25 -08:00
John McCall
bad16fd105 Do dynamic layout of generic/resilient default actors properly.
Since these types have an implicit stored property, this requires
adding an abstraction over fields to IRGen, at least throughout
the class code.  In some ways I think this significantly improves
the code, especially in how we approach missing members.

Fixes rdar://72202671.
2020-12-15 20:10:46 -05:00
Saleem Abdulrasool
89c617ab1f Merge pull request #34919 from buttaface/android-vendor
[android] Switch armv7 vendor to 'unknown' in target triple to match other arches
2020-12-08 16:34:42 -08:00
Max Desiatov
33bc25be80 Fix remaining hardcoded references to x86_64 2020-12-08 17:12:23 +00:00
Max Desiatov
0b86753236 CMake: fix builds for Apple Silicon hosts 2020-12-08 14:30:47 +00:00
Erik Eckstein
4db201c976 Mangling: introduce an alternative mangling for generic specializations.
"TB" is used instead of "Tg" in case the specialized function has a resilient argument type and this argument is re-abstracted (from indirect to direct passing).
It can be re-abstracted in case the specialization is compiled in the type's resilience domain (i.e. in it's module).
We need a separate mangling for this to distinguish from specializations - with the same type - but in different resilience domains.

Note that this change does not affect the ABI: it's only used for generated module-internal specializations.
2020-12-07 17:23:46 +01:00
Doug Gregor
06a712bff6 Merge pull request #34957 from rjmccall/partial-async-task-is-a-job
Freeze PartialAsyncTask as a Job*
2020-12-04 15:43:44 -08:00
John McCall
ee0bb0a2d5 Freeze PartialAsyncTask as a Job*.
Also fix the extra inhabitants of Builtin.RawUnsafeContinuation
and try to make adding types like this a little less boiler-plate
in the future.
2020-12-04 01:06:29 -05:00
Michelle Casbon
5598283257 Change tensorflow link to point to main 2020-12-03 20:03:04 +00:00
Butta
1a28a91db9 [android] Switch armv7 vendor to 'unknown' in target triple to match other arches
Recent changes have made 'none' and 'unknown' not interchangeable anymore, so
standardize on 'unknown' for armv7 too.
2020-12-02 11:05:36 +05:30
Slava Pestov
1a89813bf5 AST: Introduce Builtin.RawUnsafeContinuation type
This is otherwise identical to Builtin.RawPointer, but has the spare
bits of a heap object pointer.
2020-12-01 20:03:22 -05:00
marcrasi
4e048bfc35 Merge pull request #34893 from marcrasi/make-it-automatically-inherit
inherit required protocols during TangentVector synthesis
2020-11-30 23:51:40 -08:00
Marc Rasi
249285044e update differentiable programming manifesto 2020-11-30 14:14:11 -08:00