Commit Graph

266 Commits

Author SHA1 Message Date
Itai Ferber
6171d68bfa Merge pull request #25065 from ikesyo/fix-dataprotocol-lastrange
Fix `DataProtocol.lastRange(of:)` (and cherry-pick Data.swift changes from swift-5.0-branch)
2019-05-28 09:54:16 -07:00
Sho Ikeda
44f0e93747 Merge pull request #25067 from ikesyo/avoid-fallthrough-where-appropriate
[gardening] Avoid fallthrough where appropriate (for readability/understandability)
2019-05-29 00:27:05 +09:00
Sho Ikeda
c1bb945124 [gardening] Avoid fallthrough where appropriate (for readability/understandability) 2019-05-26 09:50:02 +09:00
Sho Ikeda
a35c9f0c60 [gardening] Use Collection.isEmpty over Collection.count 2019-05-26 09:35:20 +09:00
swift-ci
b088acb66e Merge pull request #24767 from ikesyo/remove-unnecessary-breaks 2019-05-25 16:15:06 -07:00
Sho Ikeda
55b300f852 Fix DataProtocol.lastRange(of:) (and cherry-pick Data.swift changes from swift-5.0-branch)
`DataProtocol.lastRange(of:)` is correct in swift-5.0-branch, but not in master and swift-5.1-branch.
2019-05-26 07:26:33 +09:00
Pavol Vaskovic
06685bcb51 Merge pull request #24898 from Gumichocopengin8/fix-warnings
[stdlib] Fix withUnsafeBytes warnings in NWEndpoint
2019-05-19 22:16:43 +02:00
Keita Nonaka
7d8c54329c fix withUnsafeBytes warnings 2019-05-19 00:39:01 -04:00
Slava Pestov
e0bba70923 Foundation: Provide a Hashable.hashValue witness for _BridgedStoredNSError conformers
Previously we would synthesize this in Sema, but this no longer
works when conformance checking is triggered by SILGen.
2019-05-18 11:35:05 -04:00
Stephen Canon
fa778ec368 Deprecate nearbyint and rint on CGFloat (#24784)
These functions have never actually been supported in Swift, because Swift does not model the dynamic floating point environment. They may have worked occasionally in the past, but that was only accidental. Deprecate them with an explanatory message.
2019-05-15 11:04:03 -04:00
swift-ci
d1cc7136dd Merge pull request #23793 from phausler/data_mapped_perf_bug 2019-05-15 07:58:32 -07:00
Brent Royal-Gordon
dce879f508 Revert "[Foundation] Fix availability of NSValue.value(of:)" 2019-05-15 05:17:42 -07:00
Philippe Hausler
8a751bd4de Add tests and validate Data and DispatchData as sequences 2019-05-14 17:12:44 -07:00
Bob Wilson
6160545800 Merge pull request #24498 from lorentey/nsvalue-availability
[Foundation] Fix availability of NSValue.value(of:)
2019-05-14 15:22:22 -07:00
Stephen Canon
6971335803 Switch from using deprecated float3-style names to SIMD3<Float> in overlays. (#24743) 2019-05-14 13:20:13 -04:00
Sho Ikeda
6eead16283 [gardening] Remove unnecessary breaks 2019-05-15 00:54:33 +09:00
swift-ci
b2542a3134 Merge pull request #24127 from Gumichocopengin8/fix-build-warnings 2019-05-13 04:26:53 -07:00
Steve (Numerics) Canon
d5819c9329 Also apply @inlinable to AccelerateBuffer default implementations. 2019-05-09 18:01:07 -04:00
Stephen Canon
e6406d878d Drop @inline(__always) from Accelerate overlay; it doesn't do what you want. (#24641)
@inline(__always) does not imply inlinable, which means that it effectively does nothing in the context of the Accelerate overlay. I have replaced all of these with @inlinable where that can be done as a one-line change. Functions that switch over open enums and more complex API (DCT, DFT, FFT) will require more sophisticated corrections, which we can undertake in later commits. For now, they have been rolled back to simply being normal public API.
2019-05-09 17:10:34 -04:00
Karoy Lorentey
fbe5563d60 [Foundation] Fix availability of NSValue.value(of:) 2019-05-03 19:55:03 -07:00
Karoy Lorentey
d6f44ccdd8 Merge pull request #24421 from lorentey/blow-up-overlays
[CMake] Split overlay list to multiple lines (NFC)
2019-05-02 11:50:09 -07:00
Karoy Lorentey
1dbb4830c5 [CMake] Split overlay list to multiple lines 2019-05-01 18:53:52 -07:00
Keita Nonaka
0613cd3e6b Merge remote-tracking branch 'origin' into fix-build-warnings 2019-05-01 19:10:31 -04:00
simon gladman
a55641a1b2 [vImage] Don't Infer Pixel Size in Buffer Copy
A buffer's `rowBytes` doesn't have a direct relationship with its `height`, so `rowBytes / Int(width)` isn't a good way to calculate pixel size. To resolve this, I've added `pixelSize` as a parameter to `vImage_Buffer.copy`.
2019-04-30 17:50:10 +01:00
Jordan Rose
d20a7ca64e [CMake] Switch to building the overlays in Swift 5 mode (#24350)
Now that that's stabilized, we don't have to keep them in Swift 4 mode
any longer. (Arguably we don't need the CMake variable at all, but it
may be useful again in the future.)

rdar://problem/49040980
2019-04-29 17:55:20 -07:00
Stephen Canon
d2f695935f Add availability information to the new Math function protocols (#24187)
* Add availability information to the new Math function protocols

The protocols ElementaryFunctions, RealFunctions, and Real are new in Swift 5.1 and accordingly need to have availability attached to them for platforms that are ABI-stable. The actual implementation hooks (static functions) are unconditionally defined on scalar types and marked @_alwaysEmitIntoClient, so they are available even when targeting older library versions, but the protocols themselves, and anything defined in terms of them (the global functions and the SIMD extensions) is only available when targeting library versions that have the new protocols.

* Additionally provide concrete implementations of signGamma for each stdlib-builtin floating-point type.

* Remove Real[Functions] protocols pending re-review

Temporarily pull these back so we can make minor tweaks to the design and get a re-review on SE.
2019-04-29 17:39:33 -04:00
Karoy Lorentey
d9c166fdb9 Merge pull request #23832 from lorentey/foundation-hashing
[Foundation] Modernize hashing in Foundation's Swift-only types
2019-04-26 14:59:13 -07:00
Steve (Numerics) Canon
1fbf0d2b92 Slice should only conform to AB when the Base conforms to AB. 2019-04-25 20:25:29 -04:00
simon gladman
5936a04510 [Accelerate] [vImage] Swift Overlays (#23592)
* Accelerate vImage Swift Overlays

A suite of functions, enumerations, and option sets to make working with vImage in Swift simpler.

* vImage_Buffer - new initializers to instantiate and initialize buffers with a single function call.
* vImage_Buffer - new functions to copy buffers and create CGImage instances from contents.
* vImage_CGImageFormat - new initializers.
* vImage_CGImageFormat - new equivalence operator.
* vImageConverter - methods to wrap free functions.
* vImageConverter - new make and convert functions.
* vImageCVImageFormat - new make functions.
* vImageCVImageFormat - methods to wrap free functions.
* vImage_Error - errorDescription function.
* vImage flags as an option set.

* Add new methods for generating CV -> CG and CG -> CV converters.

* update comments: `height` and `width` to `size`.

* `vImage_CGImageFormat.componentCount` should be `Int`.

* `vImage_CGImageFormat.componentCount` should be `Int`

* Move `self.init()` to after the size check for kvImageNoAllocate init.

* Buffer initializers to width and height rather than size.

* change vImage_CGImageFormat lightweight initializer to accept Int for `bitsPerComponent` and `bitsPerPixel`.

* Flesh out docs for vImage_Buffer.size

* Remove faux initializer in favor of new static function: `preferredAlignmentAndRowBytes`.

* Change functions to use proper error handling rather than inout error codes.

* Removed `flags` from basic init.

The only real flag to pass here is print diagnostics to console, and I now throw proper errors.

* Tests to check error throwing for buffer copy.

* remove unnecessary import, add missing docs.

* Add comments to error enums.

* Fix bug creating string from format code.

* Make `vImageCVImageFormat.formatCode` a `UInt32`.

* Remove equivalence operator from `CGImageFormat`.
2019-04-25 08:40:45 -04:00
Itai Ferber
a6fbc40e76 Merge pull request #24215 from ianpartridge/string-data-conversion-perf
[String] [Foundation] perf: UTF8 String -> Data
2019-04-24 09:25:17 -07:00
Steve (Numerics) Canon
d387ea6d93 Put a bird^Wavailability on it. 2019-04-23 20:38:40 -04:00
Steve (Numerics) Canon
91bc3595b3 Add missing availability information to enums defined in the vDSP overlay. 2019-04-23 20:23:05 -04:00
Stephen Canon
a0676e02ab [Accelerate] [vDSP] DFT, FFT, DCT, and Biquad (#24207)
* Swift overlay to vDSP cascaded biquad IIR filter.

* update comment in test

* Swift overlay to vDSP Discrete Cosine Transform

* Swift Overlays to vDSP Fast Fourier Transform and Discrete Fourier Transform

* Tests for DFT and FFT

* Some refactoring and begin documentation.

* Swift overlays to FFT and DFT operations.

* Expand docs.
* Implement `vDSP_destroy_fftsetup` and `vDSP_destroy_fftsetupD`

* Refactor Tests

* Refactor Tests

* Provide transform function that returns the result. Refactoring: parameter names more consistent with other vDSP operations, push `fileprivate` symbols to bottom of file.

* Add apply() function that returns the result.

* Added a version of DFT transform that returns the result.

* update some DFT comments

* Remove FFT overlays from this branch to separate DFT and FFT pull requests.

* [Accelerate] [vDSP] Swift Overlays to FFT Operations

This PR contains Swift overlays to simplify performing 1D and 2D fast Fourier transforms on single- and double-precision data.

This PR includes a subset of the operations (e.g. vDSP_fft_zrop for FFT). My plan is to add the additional operations (e.g. multiple signals, in-place operations, etc.) in a subsequent PR once this is approved.

cc: @moiseev @airspeedswift @stephentyrone

* Composite Branch

Contains FFT, DFT, DCT, and Biquad branches.
2019-04-23 12:31:18 -04:00
Ian Partridge
3425f4fb4a [String] [Foundation] perf: UTF8 String -> Data
Currently, `str.data(using:allowLossyConversion)` always bridges via
`NSString`.

As `String` is now natively UTF8 we can fastpath this conversion in the
case where the user requests UTF8 encoding.

A benchmark for this was previously added in #22648.
2019-04-23 10:43:14 +01:00
Stephen Canon
c90299da15 Fix a case where vDSP is missing a cast (#24197)
* Add missing cast to new vDSP_FIR overlay.

* Use macOS instead of OSX in availability annotations.

* Reorder Accelerate/CMakeLists.txt alphabetically.
2019-04-21 17:30:14 -04:00
Simon Gladman
3c813faa01 Composite Branch of vDSP Swift Overlay Work
Contains the following:

	[Accelerate] [vDSP] Swift Overlays to Sliding Window Summation Operations
	[Accelerate] [vDSP] Swift Overlays to Linear Interpolation Operations
	[Accelerate] [vDSP] Swift Overlays to Complex Vector Operations
	[Accelerate] [vDSP] Swift overlays to 1D and 2D convolution operations.
	[Accelerate] [vDSP] Swift overlays to dot product and distance functions.
	[Accelerate] [vDSP] Swift overlays to `vDSP_desamp` and `vDSP_deq22`.
	[Accelerate] [vDSP] Vector Reduction Functions
	[Accelerate] [vDSP] Elementwise Vector-Vector and Vector-Scalar Arithmetic
	[Accelerate] [vDSP] Miscellaneous Conversion Functions
	[Accelerate] [vDSP] Polynomial Evaluation Functions
	[Accelerate] [vDSP] Clipping, Limit, and Threshold Functions
	[Accelerate] [vDSP] Fill, Clear, and Generation Functions
	[Accelerate] [vDSP] Integration Functions
	[Accelerate] [vDSP] Vector Type Conversion Functions
	[Accelerate] [vDSP] Swift overlays to Vector-Vector Extrema and Single-Vector Operations
2019-04-20 10:59:03 +01:00
Simon Gladman
7be3ed7d96 Merge remote-tracking branch 'origin/accelerate-vDSP-singleVectorOperations' into Accelerate_Swift-vDSP-Overlays 2019-04-20 10:03:32 +01:00
Simon Gladman
48abf32851 Merge branch 'accelerate-vDSP-conversion' into Accelerate_Swift-vDSP-Overlays 2019-04-20 10:02:01 +01:00
Simon Gladman
ac4b5b9e92 Merge remote-tracking branch 'origin/accelerate-vDSP-integration' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:50:55 +01:00
Simon Gladman
8b76ff5124 Merge branch 'accelerate-vDSP-fillClearGenerate' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:49:59 +01:00
Simon Gladman
8571214ae3 Merge remote-tracking branch 'origin/accelerate-vDSP-clippingLimitThreshold' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:48:44 +01:00
Simon Gladman
2ee19145df Merge remote-tracking branch 'origin/accelerate-vDSP-polynomialEvaluation' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:47:31 +01:00
Simon Gladman
87ab1d614b Merge remote-tracking branch 'origin/accelerate-vDSP-miscConversions' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:46:02 +01:00
Simon Gladman
eabf7d46ac Merge remote-tracking branch 'origin/accelerate-vDSP-elementwiseVectorArithmetic' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:44:55 +01:00
Simon Gladman
a2ad79fc9e Merge remote-tracking branch 'origin/accelerate-vDSP-vectorReduction' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:43:29 +01:00
Simon Gladman
95eaa0d3ad Merge remote-tracking branch 'origin/accelerate-vDSP-differenceEquationAndDownsampling' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:41:42 +01:00
Simon Gladman
1f76b6d0fd Merge remote-tracking branch 'origin/accelerate-vDSP-geometry' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:39:59 +01:00
Simon Gladman
737528763d Merge remote-tracking branch 'origin/accelerate-vDSP-convolution' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:38:27 +01:00
Simon Gladman
98cc389556 Merge remote-tracking branch 'origin/accelerate-vDSP-complexOperations' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:36:40 +01:00
Simon Gladman
d5fca4f073 Merge remote-tracking branch 'origin/accelerate-vDSP-linearInterpolation' into Accelerate_Swift-vDSP-Overlays 2019-04-20 09:35:07 +01:00