Skip to content
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

Modifies the index instruction from gep [0 x %Type] to gep %Type #134117

Merged
merged 1 commit into from
Dec 15, 2024

Conversation

DianQK
Copy link
Member

@DianQK DianQK commented Dec 10, 2024

Fixes #133979.

This PR modifies the index instruction from gep [0 x %Type] to gep %Type, which is the same with pointer offset calculation.

This will help LLVM calculate various formats of GEP instructions. According to [RFC] Replacing getelementptr with ptradd, we ultimately aim to canonicalize everything to gep i8. Based on the results from #134117 (comment), I think we still need to investigate some missing optimizations, so this PR is just a small step forward.

r? compiler

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 10, 2024
@DianQK
Copy link
Member Author

DianQK commented Dec 10, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 10, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 10, 2024
@bors
Copy link
Contributor

bors commented Dec 10, 2024

⌛ Trying commit 23cc55f with merge 945e153...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Dec 10, 2024

☀️ Try build successful - checks-actions
Build commit: 945e153 (945e153a8c0026a060bfa8f7f6e6a0274c42fd72)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (945e153): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.3% [0.1%, 1.1%] 63
Regressions ❌
(secondary)
0.4% [0.2%, 1.1%] 28
Improvements ✅
(primary)
-0.4% [-0.6%, -0.2%] 3
Improvements ✅
(secondary)
-0.4% [-0.8%, -0.2%] 28
All ❌✅ (primary) 0.3% [-0.6%, 1.1%] 66

Max RSS (memory usage)

Results (primary -3.1%, secondary 2.9%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.4% [4.7%, 7.1%] 4
Improvements ✅
(primary)
-3.1% [-3.1%, -3.1%] 1
Improvements ✅
(secondary)
-2.3% [-2.4%, -2.2%] 2
All ❌✅ (primary) -3.1% [-3.1%, -3.1%] 1

Cycles

Results (primary 0.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.7% [0.7%, 0.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.7%, 0.7%] 1

Binary size

Results (primary -0.1%, secondary 0.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.0%, 1.1%] 20
Regressions ❌
(secondary)
0.3% [0.1%, 0.5%] 72
Improvements ✅
(primary)
-0.5% [-1.4%, -0.1%] 13
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-1.4%, 1.1%] 33

Bootstrap: 767.346s -> 767.902s (0.07%)
Artifact size: 330.96 MiB -> 331.08 MiB (0.03%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 10, 2024
@DianQK
Copy link
Member Author

DianQK commented Dec 11, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 11, 2024
@bors
Copy link
Contributor

bors commented Dec 11, 2024

⌛ Trying commit f89b192 with merge 98e1ef7...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2024
@bors
Copy link
Contributor

bors commented Dec 11, 2024

☀️ Try build successful - checks-actions
Build commit: 98e1ef7 (98e1ef761c76173c125591d946ee291acf60a2da)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (98e1ef7): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
0.7% [0.2%, 1.2%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-1.4%, -1.2%] 4
All ❌✅ (primary) 0.1% [0.1%, 0.1%] 1

Max RSS (memory usage)

Results (primary 1.0%, secondary -0.2%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.9% [2.4%, 3.4%] 2
Regressions ❌
(secondary)
3.2% [3.2%, 3.2%] 1
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
-1.8% [-1.9%, -1.7%] 2
All ❌✅ (primary) 1.0% [-2.9%, 3.4%] 3

Cycles

Results (secondary -5.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.4% [-6.3%, -4.9%] 4
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.0%, secondary 0.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 7
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 7

Bootstrap: 767.862s -> 769.757s (0.25%)
Artifact size: 331.04 MiB -> 331.08 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 11, 2024
@DianQK DianQK changed the title [WIP] Canonicalize GEPs Modifies the index instruction from gep [0 x %Type] to gep %Type Dec 15, 2024
@DianQK DianQK marked this pull request as ready for review December 15, 2024 11:11
@oli-obk
Copy link
Contributor

oli-obk commented Dec 15, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Dec 15, 2024

📌 Commit 3fc506b has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 15, 2024
@RalfJung
Copy link
Member

Cc @nikic

@bors
Copy link
Contributor

bors commented Dec 15, 2024

⌛ Testing commit 3fc506b with merge a611773...

@bors
Copy link
Contributor

bors commented Dec 15, 2024

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing a611773 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 15, 2024
@bors bors merged commit a611773 into rust-lang:master Dec 15, 2024
7 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 15, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a611773): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.2%] 2
Regressions ❌
(secondary)
0.6% [0.2%, 1.1%] 17
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-1.4%, -1.2%] 4
All ❌✅ (primary) 0.1% [0.1%, 0.2%] 2

Max RSS (memory usage)

Results (primary -3.4%, secondary 1.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.3% [2.0%, 2.6%] 3
Improvements ✅
(primary)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
-1.4% [-1.4%, -1.4%] 1
All ❌✅ (primary) -3.4% [-3.4%, -3.4%] 1

Cycles

Results (secondary -5.6%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.6% [-6.0%, -5.3%] 4
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.0%, secondary 0.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 7
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 35
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 7

Bootstrap: 770.433s -> 769.875s (-0.07%)
Artifact size: 333.16 MiB -> 333.19 MiB (0.01%)

@DianQK DianQK deleted the gep-i8 branch December 16, 2024 01:44
@Kobzol
Copy link
Contributor

Kobzol commented Dec 23, 2024

The post-merge perf. is very similar to the previous perf. runs, which were deemed acceptable during review.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent bounds checking optimization in enumerated slice iterators
8 participants