Commit Graph

86 Commits

Author SHA1 Message Date
Slava Pestov
2ec19ecb46 Benchmarks: Skip long benchmarks in -Onone build 2025-08-27 10:37:10 -04:00
Ian Anderson
15345ef2d5 [CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
The SDK overlays have been provided in the Apple SDKs for many years, and the interface and implementation has diverged in more recent years such that trying to build the Swift version no longer works. Remove all of the dead code.

rdar://151889154
2025-05-23 23:38:08 -07:00
Ben Langmuir
46a83bea0c Roll back to watchOS 6.0 to keep armv7k support
While the swift compiler in Xcode links against tbd files in the sdk
that contain an armv7k slice, the open source swift toolchain links
against the stdlib dylb that is in the toolchain itself. This means that
we cannot drop support for armv7k support in the stdlib dylib without
losing support for building armv7k when back deploying to older watch
targets. For now, roll back the recent deployment target bump from 9.0
to 6.0 so that we keep armv7k and i386 simulator.

rdar://135560598
2024-09-13 08:49:09 -07:00
Ian Anderson
5bf2c937ab [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

rdar://115192929
2024-09-11 22:26:37 -07:00
Artem Chikin
1baff87879 Revert "[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms" 2024-09-09 09:57:14 -07:00
Ian Anderson
8959dd97fe [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

%target-swift-emit-pcm doesn't use the sdk, but %target-swift-frontend does, which will cause them to have a mismatch with "builtin headers belong to system modules, and _Builtin_ modules are ignored for cstdlib headers" aka LANGOPT(BuiltinHeadersInSystemModules) aka -fbuiltin-headers-in-system-modules.

rdar://115192929
2024-09-06 13:28:14 -07:00
Ben Langmuir
ad82d86041 Bump the deployment target for the compiler to macOS 13.0
Bump the deployment target from macOS 10.13-aligned versions to macOS
13.0-aligned versions. This allows us to stop linking CoreFoundation
in the swift runtime, which was previously required for availability
checking. It also lets us align the deployment target on x86_64 with
arm64, which was 11.0. Finally, it is a prerequisite to being able to
build swift using the macOS 15 beta SDKs.
2024-08-29 14:30:09 -07:00
Egor Zhdan
f1ca417da6 [cxx-interop] Run benchmarks in C++20 mode
This will allow benchmarking Swift access to `std::span` which is a C++20 feature and therefore requires compiling with `-Xcc -std=c++20`.
2024-07-23 12:30:17 +01:00
Tim Kientzle
7052de9399 Fix build-script -B
Without additional options, build-script -B was badly broken:
* It added a broken --independent-samples option to the driver command line
* Slow tests that ran only 1 sample by default would break the statistics

Fix the first issue by adding `--independent-samples` to the command
line only when a sample was actually provided by other options.

Fix the second issue by including `--min-samples=2` in the command.
2023-09-22 17:44:42 -07:00
Erik Eckstein
8953d686ad benchmarks: use dedicated module-cache directory for building the benchmarks
So that it cannot interfere with some leftovers from other compiler runs.
This is important for SDK modules which are generated from swiftinterface files (like Foundation).
The cached SDK module should be built with the compiler to benchmark (and not being reused from other compiler runs).
2023-09-18 18:24:52 +02:00
Stéphan Kochen
7b460ce495 build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:

- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
  expands to 1, where it would previously coerce to a string.

- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
  left-hand side expands twice.

In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:

- Quoted right-hand side of `STREQUAL` where I was confident it was
  intended to be a string literal.

- Removed manual variable expansion on left-hand side of `STREQUAL`,
  `MATCHES` and `IN_LIST` where I was confident it was unintended.

Fixes #65028.
2023-07-17 21:50:50 +02:00
Lucy Satheesan
942ea60af4 [benchmark] bump minimum OS versions 2023-06-16 12:18:55 -07:00
Alex Lorenz
d72b592eeb [cxx-interop] Add initial benchmark to compare vector<uint32_t> sum in C++ vs Swift 2022-10-10 09:13:31 -07:00
Dario Rexin
992cae456b [Frontend] Use experimental feature for layout prespecializations (#61451) 2022-10-06 15:21:01 -07:00
Dario Rexin
25e547e30d [Build] Fix flag in benchmark build 2022-09-22 20:45:11 -07:00
Dario Rexin
210c68d8aa [SILOptimizer] Add prespecialization for arbitray reference types (#58846)
* [SILOptimizer] Add prespecialization for arbitray reference types

* Fix benchmark Package.swift

* Move SimpleArray to utils

* Fix multiple indirect result case

* Remove leftover code from previous attempt

* Fix test after rebase

* Move code to compute type replacements to SpecializedFunction

* Fix ownership when OSSA is enabled

* Fixes after rebase

* Changes after rebasing

* Add feature flag for layout pre-specialization

* Fix pre_specialize-macos.swift

* Add compiler flag to benchmark build

* Fix benchmark SwiftPM flags
2022-09-22 16:29:01 -07:00
Mishal Shah
196ee143c5 Xcode 14 beta 4 no longer supports iOS armv7, armv7s, and i386 architectures
> Building iOS projects with deployment targets for the armv7, armv7s, and i386 architectures is no longer supported. (92831716)
2022-08-02 20:42:08 -07:00
zoecarver
839839f924 [cxx-interop] Rename enable-cxx-interop -> enable-experimental-cxx-interop.
Also removes the driver flag, this will now also always be guarded on `-Xfrontend`.
2022-04-07 19:15:25 -07:00
Erik Eckstein
43506a01f1 cmake: fix dependencies in benchmarks
with libswift the compiler invocation also depends on the core libraries, because the compiler executable needs them.

rdar://85911944
2021-12-02 19:57:35 +01:00
Karoy Lorentey
ec0fbc0d4b [benchmark] Use swift-darwin-postprocess.py to work around dyld 4 issue on macOS 12 2021-09-16 16:58:13 -07:00
Robert Widmann
0149ccd0ca Add arm64_32 support for Swift
Commit the platform definition and build script work necessary to
cross-compile for arm64_32.

arm64_32 is a variant of AARCH64 that supports an ILP32 architecture.
2021-04-20 14:59:04 -07:00
zoecarver
01b12cfe6e [cxx-interop] Add support for benchmarks with C++ interop.
* Adds support for benchmarks that use C++ modules.
* Adds "CreateObjects" benchmark that creates C++ objects.
2020-10-06 19:33:22 -07:00
tbkka
ab861d5890 Pass architecture into Benchmark_Driver to fix build-script -B (#33100)
* Pass architecture into Benchmark_Driver to fix `build-script -B`

* "Benchmark_Driver compare" does not need the architecture
2020-07-25 11:15:49 -07:00
Michael Gottesman
0ce7f29c72 [opt-remark] Add support for emitting opt-remark bitstream artifacts when building benchmarks with cmake.
I didn't do this for swiftpm as well since when I tried passing this via
unsafeFlags to swiftpm, swiftpm just created the opt-remarks in my source
directory instead of next to the .o in the build directory. A problem for
another time.
2020-07-18 20:19:27 -07:00
Mishal Shah
c89451138b [Apple Silicon] Add arm64 macOS support to benchmark suite 2020-07-02 16:24:17 -07:00
Doug Gregor
ade21a33fd Fix build of benchmark suite and Linux test 2020-06-23 13:00:26 -07:00
Mishal Shah
272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
David Zarzycki
5dcc32f98f Remove all uses of -force-single-frontend-invocation
The `-force-single-frontend-invocation` flag predates WMO and is now an
alias for `-whole-module-optimization`. We should use the latter and let
the former fade into history.
2020-05-08 06:37:41 -04:00
Vedant Kumar
54a6be9d65 benchmark: Add SWIFT_BENCHMARK_UNOPTIMIZED_DRIVER option (#30794)
Add an option to allow compiling the benchmark test utilities and driver
at -Onone. This is needed because lldb does not support stepping through
optimized swift code.
2020-04-03 14:37:55 -07:00
Vedant Kumar
829f2588b3 benchmark: Build drivers with N_AST symtab entries (for debugging) (#30777)
On Darwin, we pass the *.swiftmodule paths transitively referenced by
the driver executable to ld64. ld64 inserts N_AST references to these
modules into the program, for later use by lldb.

This change should let us exercise much more lldb functionality via
`stepper` testing.
2020-04-02 16:12:05 -07:00
Kuba Mracek
45ba5cec05 [arm64e] Add arm64e support into Swift's build system 2020-02-27 16:08:15 -08:00
Vedant Kumar
609c84b600 benchmark: Make building with debug info the default (#29669) 2020-02-06 11:03:20 -08:00
Andrew Trick
b127216946 Benchmark cmake: Added SWIFT_BENCHMARK_USE_OS_LIBRARIES
Cleanup and document the configuration of the library path and rpath.

With SWIFT_BENCHMARK_USE_OS_LIBRARIES, it's now possible to directly
build benchmarks for a target device and run those benchmarks on the
device without building or installing Swift.

It's also possible now to specify an absolute SWIFT_LIBRARY_PATH to be
used as an rpath so installation can be skipped.
2019-04-10 09:31:02 -07:00
Michael Gottesman
f854547c55 [ownership] Enable ownership verification by default.
I also removed the -verify-sil-ownership flag in favor of a disable flag
-disable-sil-ownership-verifier. I used this on only two tests that still need
work to get them to pass with ownership, but whose problems are well understood,
small corner cases. I am going to fix them in follow on commits. I detail them
below:

1. SILOptimizer/definite_init_inout_super_init.swift. This is a test case where
DI is supposed to error. The only problem is that we crash before we error since
the code emitting by SILGen to trigger this error does not pass ownership
invariants. I have spoken with JoeG about this and he suggested that I fix this
earlier in the compiler. Since we do not run the ownership verifier without
asserts enabled, this should not affect compiler users. Given that it has
triggered DI errors previously I think it is safe to disable ownership here.

2. PrintAsObjC/extensions.swift. In this case, the signature generated by type
lowering for one of the thunks here uses an unsafe +0 return value instead of
doing an autorelease return. The ownership checker rightly flags this leak. This
is going to require either an AST level change or a change to TypeLowering. I
think it is safe to turn this off since it is such a corner case that it was
found by a test that has nothing to do with it.

rdar://43398898
2019-03-25 00:11:52 -07:00
Michael Gottesman
0dfaa19f9f [ownership] Rename enable-sil-ownership => verify-sil-ownership.
I have been meaning to do this change for a minute, but kept on putting it off.
This describes what is actually happening and is a better name for the option.
2019-03-18 01:31:44 -07:00
Michael Gottesman
7788567444 [benchmark] Compile the benchmark suite with ownership verification enabled. 2019-03-17 23:33:48 -07:00
Saleem Abdulrasool
d86ead48d4 build: specify vendor for Darwin benchmarks
The build was not specifying the vendor when building the Darwin
benchmarks.  Parts of the SDK rely on the vendor macro (`__APPLE__`) to
be defined which requires that the vendor is specified properly.  Ensure
that we do so.
2019-03-12 17:45:54 -07:00
eeckstein
cd920b69f4 Merge pull request #19910 from palimondo/fluctuation-of-the-pupil
[benchmark] More Robust Benchmark_Driver
2018-10-29 15:02:07 -07:00
Andrew Trick
599e5860c5 Remove references to SWIFT3 from benchmark Cmake files. 2018-10-11 21:53:19 -07:00
Pavol Vaskovic
0438c45e2d [benchmark] B_D iterations => independent-samples
Renamed Benchmark_Driver’s `iterations` argument to `independent-samples` to clarify its true meaning and  disambiguate it from the concept of `num-iters` used in Benchmark_O. The short form of the argument — `-i` — remains unchanged.
2018-10-11 18:56:27 +02:00
Graydon Hoare
94725dff2b [benchmark] Add preliminary helper for measuring instructions executed. 2018-08-25 01:29:37 -07:00
Erik Eckstein
13aae18d55 benchmarks: fix the cmake code to detect if SWIFT_EXEC supports the -align-module-to-page-size option.
This check should only be done for pre-built compilers.
2018-08-22 09:58:20 -07:00
Erik Eckstein
1a161c28ae benchmarks: compile with the new -align-module-to-page-size option, if supported by the compiler
To stabilize the benchmark results.
2018-07-27 17:15:14 -07:00
Michael Gottesman
36e0e6949c [benchmark] Add cmake support for compiling the benchmarks standalone on Linux.
To use this, one needs to first build an installable root for swift (i.e. like
the smoke testbot does). Then use the tool ./benchmark/scripts/build_linux.py
with the appropriate locations of the build-directory, installable snapshot,
and it will build the benchmarks. (There are more arguments, just use --help).

rdar://40541972
2018-05-29 14:25:16 -07:00
Michael Gottesman
9740bef838 [benchmark] Move build configuration/sdk configuration out of the main CMakeLists.txt file into AddSwiftBenchmarkSuite.cmake.
I am going to add some support here for Linux. I want to make sure that these
changes are hidden from the main CMakeLists.txt file since we want that file to
be as declarative as possible.

rdar://40541972
2018-05-28 18:39:43 -07:00
Michael Gottesman
09e1e20546 [benchmark][cmake] Move runcmd from AddSwiftBench* => SwiftBenchmarkUtils.cmake.
A quick NFC cleanup that I saw.

rdar://40541972
2018-05-24 18:15:33 -07:00
Andrew Trick
3715464c05 Add a cmake flag to the benchmarks: SWIFT_BENCHMARK_EXTRA_FLAGS.
We used to have this cmake flag but it seems to have disappeared. Building the
benchmarks with different swiftc flags is central to performance analysis, so
I'm not sure how people were getting this done.
2018-03-05 12:24:38 -08:00
Ben Cohen
3b4eacc3a8 Update benchmarks to Swift 4 (#14623) 2018-02-14 17:26:58 -08:00
Adam Nemet
80c9b044f6 Support opt-viewer when benchmarking in stand-alone mode
Tested locally with both stand-alone and in-tree benchmarking.
2017-12-13 21:19:22 -08:00
Adam Nemet
30cbf7e9e5 Support opt-viewer with multi-source benchmarks as well 2017-12-11 22:06:53 -08:00