rust icon indicating copy to clipboard operation
rust copied to clipboard

Encode dep graph edges directly from the previous graph when promoting

Open Zoxc opened this issue 1 year ago • 10 comments

This encodes dep graph edges directly from the previous graph when promoting nodes from a previous session, avoiding allocations / copies.

Based on https://github.com/rust-lang/rust/pull/122064 and https://github.com/rust-lang/rust/pull/116375.

BenchmarkBeforeAfter
TimeTime%
🟣 clap:check:unchanged0.4177s0.4072s💚 -2.52%
🟣 hyper:check:unchanged0.1430s0.1420s -0.69%
🟣 regex:check:unchanged0.3106s0.3038s💚 -2.19%
🟣 syn:check:unchanged0.5823s0.5688s💚 -2.33%
🟣 syntex_syntax:check:unchanged1.3992s1.3692s💚 -2.14%
Total2.8528s2.7910s💚 -2.17%
Summary1.0000s0.9803s💚 -1.97%

Zoxc avatar Mar 06 '24 07:03 Zoxc

r? @fmease

rustbot has assigned @fmease. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Mar 06 '24 07:03 rustbot

r? @cjgillot

Zoxc avatar Mar 06 '24 07:03 Zoxc

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_ac0a572d-07dc-409b-a0fa-dbcf8a6d777a
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=dep-edges-from-previous
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_ac0a572d-07dc-409b-a0fa-dbcf8a6d777a
GITHUB_REF=refs/pull/122070/merge
GITHUB_REF_NAME=122070/merge
GITHUB_REF_PROTECTED=false
---
#12 writing image sha256:9eaf02d72639a338c635e02ba0bff15afe3788851150cef6f8e82d88d2f78513 done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.1s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Wed Mar  6 07:27:20 UTC 2024
  network time: Wed, 06 Mar 2024 07:27:20 GMT
  network time: Wed, 06 Mar 2024 07:27:20 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
   Compiling rustc_parse v0.0.0 (/checkout/compiler/rustc_parse)
error[E0425]: cannot find value `key` in this scope
    --> compiler/rustc_query_system/src/dep_graph/graph.rs:1246:50
     |
1246 |                 self.record_edge(dep_node_index, key, fingerprint);

error[E0425]: cannot find value `fingerprint` in this scope
    --> compiler/rustc_query_system/src/dep_graph/graph.rs:1246:55
     |
     |
1246 |                 self.record_edge(dep_node_index, key, fingerprint);

For more information about this error, try `rustc --explain E0425`.
error: could not compile `rustc_query_system` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

rust-log-analyzer avatar Mar 06 '24 07:03 rust-log-analyzer

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_2d71b153-9686-4597-a30a-b4d52a43e682
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=dep-edges-from-previous
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_2d71b153-9686-4597-a30a-b4d52a43e682
GITHUB_REF=refs/pull/122070/merge
GITHUB_REF_NAME=122070/merge
GITHUB_REF_PROTECTED=false
---
#12 writing image sha256:4089bf34d231b9bfa0660b9436faf7e280c7f8a344dcafa4401ff7ff713da234 done
#12 naming to docker.io/library/rust-ci done
#12 DONE 10.0s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Wed Mar  6 08:08:50 UTC 2024
  network time: Wed, 06 Mar 2024 08:08:50 GMT
  network time: Wed, 06 Mar 2024 08:08:50 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'build.optimized-compiler-builtins', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
   Compiling rustc_parse v0.0.0 (/checkout/compiler/rustc_parse)
error[E0425]: cannot find value `fingerprint` in this scope
    --> compiler/rustc_query_system/src/dep_graph/graph.rs:1246:88
     |
1246 |                 self.record_edge(dep_node_index, prev_graph.index_to_node(prev_index), fingerprint);

For more information about this error, try `rustc --explain E0425`.
error: could not compile `rustc_query_system` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

rust-log-analyzer avatar Mar 06 '24 08:03 rust-log-analyzer

@bors try @rust-timer queue

cjgillot avatar Mar 08 '24 23:03 cjgillot

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Mar 08 '24 23:03 rust-timer

:hourglass: Trying commit d9fe043748414daaa197cd98e1fedf1b5b51bd2e with merge ae110c4e0298a288fd51f34ac53ca2e19f205e2f...

bors avatar Mar 08 '24 23:03 bors

:sunny: Try build successful - checks-actions Build commit: ae110c4e0298a288fd51f34ac53ca2e19f205e2f (ae110c4e0298a288fd51f34ac53ca2e19f205e2f)

bors avatar Mar 09 '24 01:03 bors

Queued ae110c4e0298a288fd51f34ac53ca2e19f205e2f with parent 46b180ec2452d388c5d9c14009442e2e0beb01d7, future comparison URL. There are currently 2 preceding artifacts in the queue. It will probably take at least ~3.9 hours until the benchmark run finishes.

rust-timer avatar Mar 09 '24 01:03 rust-timer

Finished benchmarking commit (ae110c4e0298a288fd51f34ac53ca2e19f205e2f): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

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 a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.6% [0.2%, 1.2%] 25
Regressions ❌
(secondary)
0.8% [0.7%, 0.9%] 4
Improvements ✅
(primary)
-0.7% [-1.8%, -0.2%] 32
Improvements ✅
(secondary)
-1.1% [-2.8%, -0.2%] 22
All ❌✅ (primary) -0.2% [-1.8%, 1.2%] 57

Max RSS (memory usage)

Results

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)
3.3% [0.9%, 6.1%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.2% [-4.0%, -1.9%] 6
All ❌✅ (primary) - - 0

Cycles

Results

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.7% [2.3%, 3.4%] 3
Improvements ✅
(primary)
-2.4% [-7.0%, -1.4%] 53
Improvements ✅
(secondary)
-3.0% [-6.1%, -1.2%] 20
All ❌✅ (primary) -2.4% [-7.0%, -1.4%] 53

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 649.968s -> 649.736s (-0.04%) Artifact size: 172.54 MiB -> 172.56 MiB (0.01%)

rust-timer avatar Mar 09 '24 07:03 rust-timer

I've rebased https://github.com/rust-lang/rust/pull/116375 away, so this can get a proper perf run now.

Zoxc avatar Mar 11 '24 02:03 Zoxc

@bors try @rust-timer queue

dianqk avatar Mar 13 '24 05:03 dianqk

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Mar 13 '24 05:03 rust-timer

:hourglass: Trying commit 4704852d7d08f1684f3eb28a93a2e4a2123eff23 with merge 24cb3643adf213bfca2bb4a8c531864241888544...

bors avatar Mar 13 '24 05:03 bors

:sunny: Try build successful - checks-actions Build commit: 24cb3643adf213bfca2bb4a8c531864241888544 (24cb3643adf213bfca2bb4a8c531864241888544)

bors avatar Mar 13 '24 07:03 bors

Queued 24cb3643adf213bfca2bb4a8c531864241888544 with parent d3555f3d8e555ce488bbf8eee5eccdb66a464e14, future comparison URL. There is currently 1 preceding artifact in the queue. It will probably take at least ~1.9 hours until the benchmark run finishes.

rust-timer avatar Mar 13 '24 07:03 rust-timer

Finished benchmarking commit (24cb3643adf213bfca2bb4a8c531864241888544): comparison URL.

Overall result: ✅ improvements - no action needed

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.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.2%, 0.6%] 6
Improvements ✅
(primary)
-1.6% [-3.0%, -0.3%] 101
Improvements ✅
(secondary)
-1.4% [-3.3%, -0.3%] 37
All ❌✅ (primary) -1.6% [-3.0%, -0.3%] 101

Max RSS (memory usage)

Results

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)
3.0% [3.0%, 3.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.0% [3.0%, 3.0%] 1

Cycles

Results

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)
4.0% [2.9%, 5.2%] 3
Improvements ✅
(primary)
-2.7% [-7.2%, -1.2%] 88
Improvements ✅
(secondary)
-3.5% [-7.1%, -1.4%] 24
All ❌✅ (primary) -2.7% [-7.2%, -1.2%] 88

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 674.552s -> 675.442s (0.13%) Artifact size: 310.77 MiB -> 310.74 MiB (-0.01%)

rust-timer avatar Mar 13 '24 10:03 rust-timer

@rustbot ready

Zoxc avatar Mar 13 '24 10:03 Zoxc

@bors r+

cjgillot avatar Mar 23 '24 17:03 cjgillot

:pushpin: Commit 4704852d7d08f1684f3eb28a93a2e4a2123eff23 has been approved by cjgillot

It is now in the queue for this repository.

bors avatar Mar 23 '24 17:03 bors

@bors r-

Actually, could you add a few comments there and there? r=me afterwards

cjgillot avatar Mar 23 '24 17:03 cjgillot

@oli-obk Do you mind approving for me?

Zoxc avatar Apr 05 '24 09:04 Zoxc

@bors r=cjgillot

oli-obk avatar Apr 05 '24 09:04 oli-obk

:pushpin: Commit aa9c9a36c06ac33275be60b840d1b954f8b1eac3 has been approved by cjgillot

It is now in the queue for this repository.

bors avatar Apr 05 '24 09:04 bors

:hourglass: Testing commit aa9c9a36c06ac33275be60b840d1b954f8b1eac3 with merge 4563f70c3b599411836e285591479f4a3d364708...

bors avatar Apr 05 '24 11:04 bors

:sunny: Test successful - checks-actions Approved by: cjgillot Pushing 4563f70c3b599411836e285591479f4a3d364708 to master...

bors avatar Apr 05 '24 13:04 bors

Finished benchmarking commit (4563f70c3b599411836e285591479f4a3d364708): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 1
Improvements ✅
(primary)
-1.6% [-3.1%, -0.2%] 113
Improvements ✅
(secondary)
-1.5% [-3.6%, -0.3%] 37
All ❌✅ (primary) -1.6% [-3.1%, -0.2%] 113

Max RSS (memory usage)

Results

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)
4.1% [4.1%, 4.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results

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)
-2.9% [-7.8%, -0.8%] 99
Improvements ✅
(secondary)
-3.3% [-7.3%, -1.5%] 27
All ❌✅ (primary) -2.9% [-7.8%, -0.8%] 99

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 668.072s -> 669.208s (0.17%) Artifact size: 317.99 MiB -> 318.05 MiB (0.02%)

rust-timer avatar Apr 05 '24 14:04 rust-timer

The improvements obviously overweigh the single regression.

@rustbot label: +perf-regression-triaged

Kobzol avatar Apr 05 '24 14:04 Kobzol