Skip to content

[semantic-arc-opts] Teach load [copy] -> load_borrow about forwarding… #26956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

gottesmm
Copy link
Contributor

… instructions.

I implemented this some time ago for copy_value, but I (IIRC due to time) did
not enable it for the load [copy] optimization. Specifically now we should be
able to optimize this:

%ref = ref_element_addr %guaranteedArg
%0a = load [copy] %ref
%0b = unchecked_ref_cast %0a
destroy_value %0b

->

%ref = ref_element_addr %guaranteedArg
%0a = load_borrow %guaranteedArg
%0b = unchecked_ref_cast %0a
end_borrow %0a

@gottesmm gottesmm requested review from jckarter and atrick August 30, 2019 17:43
@gottesmm gottesmm force-pushed the pr-26ba3ee6d03272d059164d68ed32c67574fca737 branch from 994612b to 88c92c2 Compare August 30, 2019 17:44
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm force-pushed the pr-26ba3ee6d03272d059164d68ed32c67574fca737 branch from 88c92c2 to df8edaf Compare August 30, 2019 17:54
@gottesmm
Copy link
Contributor Author

NOTE: There are two commits here, the first a refactor the 2nd the meat of the transform.

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

2 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm
Copy link
Contributor Author

@swift-ci benchmark

3 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci benchmark

@gottesmm
Copy link
Contributor Author

@swift-ci benchmark

@gottesmm
Copy link
Contributor Author

@swift-ci benchmark

@gottesmm
Copy link
Contributor Author

NOTE: I split out the first commit into a separate PR since it is pretty trivial.

@gottesmm
Copy link
Contributor Author

Here: #26958

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
FlattenListFlatMap 4431 5732 +29.4% 0.77x (?)
 
Improvement OLD NEW DELTA RATIO
NIOChannelPipeline 169 85 -49.7% 1.99x
DropFirstArrayLazy 14 13 -7.1% 1.08x (?)

Code size: -O

Improvement OLD NEW DELTA RATIO
NIOChannelPipeline.o 4096 4048 -1.2% 1.01x

Performance: -Osize

Regression OLD NEW DELTA RATIO
DataAppendDataLargeToLarge 26600 38000 +42.9% 0.70x (?)
 
Improvement OLD NEW DELTA RATIO
NIOChannelPipeline 174 91 -47.7% 1.91x
SuffixCountableRange 5 4 -20.0% 1.25x (?)

Code size: -Osize

Performance: -Onone

Code size: -swiftlibs

Improvement OLD NEW DELTA RATIO
libswiftCloudKit.dylib 73728 69632 -5.6% 1.06x
How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the
regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false
alarms. Unexpected regressions which are marked with '(?)' are probably noise.
If you see regressions which you cannot explain you can try to run the
benchmarks again. If regressions still show up, please consult with the
performance team (@eeckstein).

Hardware Overview
  Model Name: Mac mini
  Model Identifier: Macmini8,1
  Processor Name: Intel Core i7
  Processor Speed: 3.2 GHz
  Number of Processors: 1
  Total Number of Cores: 6
  L2 Cache (per Core): 256 KB
  L3 Cache: 12 MB
  Memory: 64 GB

@gottesmm
Copy link
Contributor Author

@weissi check out that NIOChannelPipeline improvement.

@weissi
Copy link
Contributor

weissi commented Aug 30, 2019

Wow, that is amazing!!! Thank you

… instructions.

I implemented this some time ago for copy_value, but I (IIRC due to time) did
not enable it for the load [copy] optimization. Specifically now we should be
able to optimize this:

```
%ref = ref_element_addr %guaranteedArg
%0a = load [copy] %ref
%0b = unchecked_ref_cast %0a
destroy_value %0b
```

->

```
%ref = ref_element_addr %guaranteedArg
%0a = load_borrow %guaranteedArg
%0b = unchecked_ref_cast %0a
end_borrow %0a
```
@gottesmm gottesmm force-pushed the pr-26ba3ee6d03272d059164d68ed32c67574fca737 branch from df8edaf to df6ff7f Compare August 31, 2019 05:13
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

3 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit a5d7b72 into swiftlang:master Aug 31, 2019
@gottesmm gottesmm deleted the pr-26ba3ee6d03272d059164d68ed32c67574fca737 branch July 23, 2021 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants