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

In smir use FxIndexMap to store indexed ids #116560

Merged
merged 4 commits into from
Oct 10, 2023
Merged

Conversation

ouz-a
Copy link
Contributor

@ouz-a ouz-a commented Oct 9, 2023

Previously we used vec for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use smir for real world cases.

Addresses rust-lang/project-stable-mir#35

r? @oli-obk

@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 Oct 9, 2023
@rustbot
Copy link
Collaborator

rustbot commented Oct 9, 2023

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

This PR changes Stable MIR

cc @oli-obk, @celinval, @spastorino

@compiler-errors
Copy link
Member

This PR needs a more descriptive name 😅 -- it should at least mention SMIR, but also why is it more efficient?

@ouz-a
Copy link
Contributor Author

ouz-a commented Oct 9, 2023

This PR needs a more descriptive name 😅 -- it should at least mention SMIR, but also why is it more efficient?

lol I thought I changed the name

@ouz-a ouz-a changed the title Efficient ids In smir use FxIndexMap to store indexed ids Oct 9, 2023
compiler/rustc_smir/src/rustc_internal/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_smir/src/rustc_internal/mod.rs Outdated Show resolved Hide resolved
@rustbot
Copy link
Collaborator

rustbot commented Oct 10, 2023

This PR changes Stable MIR

cc @oli-obk, @celinval, @spastorino

@ouz-a ouz-a force-pushed the efficient_ids branch 3 times, most recently from c08e446 to 470f3af Compare October 10, 2023 09:09
compiler/stable_mir/src/lib.rs Outdated Show resolved Hide resolved
compiler/stable_mir/src/ty.rs Outdated Show resolved Hide resolved
compiler/rustc_smir/src/rustc_internal/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_smir/src/rustc_internal/mod.rs Outdated Show resolved Hide resolved
@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ACTION=__run_7
GITHUB_ACTIONS=true
GITHUB_ACTION_REF=
GITHUB_ACTION_REPOSITORY=
GITHUB_ACTOR=ouz-a
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=master
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_44a2b040-40ae-433e-bc9c-6b3e39d52af1
GITHUB_EVENT_NAME=pull_request
---
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=8e736d20b43a1c16483479c86f05de76126c239d
GITHUB_STATE=/home/runner/work/_temp/_runner_file_commands/save_state_44a2b040-40ae-433e-bc9c-6b3e39d52af1
GITHUB_STEP_SUMMARY=/home/runner/work/_temp/_runner_file_commands/step_summary_44a2b040-40ae-433e-bc9c-6b3e39d52af1
GITHUB_TRIGGERING_ACTOR=ouz-a
GITHUB_WORKFLOW_REF=rust-lang/rust/.github/workflows/ci.yml@refs/pull/116560/merge
GITHUB_WORKFLOW_SHA=8e736d20b43a1c16483479c86f05de76126c239d
GITHUB_WORKSPACE=/home/runner/work/rust/rust
GOROOT_1_19_X64=/opt/hostedtoolcache/go/1.19.13/x64
---
..............i......................ii.............i..i.i.i..........i....i..i......... 176/523
........iiiii.ii.i..i....i..iiiii.......i.i.i....i.i......iiiii........ii........i.ii... 264/523
..i..i..i........................i...ii..ii.i....iiiiiiii...i.ii................ii...... 352/523
................i.........i........................ii.i.ii.iiiiii.i.................i... 440/523
.i....i...ii.........ii......i...F...............ii...iiii.iiiiiiii................
failures:

---- [codegen] tests/codegen/target-feature-inline-closure.rs stdout ----


error: verification with 'FileCheck' failed
status: exit status: 1
command: "/usr/lib/llvm-15/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/target-feature-inline-closure/target-feature-inline-closure.ll" "/checkout/tests/codegen/target-feature-inline-closure.rs" "--allow-unused-prefixes" "--check-prefixes" "CHECK,NONMSVC" "--dump-input-context" "100"
Build completed unsuccessfully in 0:12:49
--- stderr -------------------------------
/checkout/tests/codegen/target-feature-inline-closure.rs:27:16: error: CHECK-NOT: excluded string found in input
/checkout/tests/codegen/target-feature-inline-closure.rs:27:16: error: CHECK-NOT: excluded string found in input
 // CHECK-NOT: fadd
               ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/target-feature-inline-closure/target-feature-inline-closure.ll:35:66: note: found here
 call fastcc void @_ZN4core9core_arch3x863avx13_mm256_add_ps17ha5faddbf0c47d313E(ptr noalias nocapture noundef nonnull align 32 dereferenceable(32) %_0, ptr noalias nocapture noundef nonnull align 32 dereferenceable(32) %1, ptr noalias nocapture noundef nonnull align 32 dereferenceable(32) %0)

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/target-feature-inline-closure/target-feature-inline-closure.ll
Check file: /checkout/tests/codegen/target-feature-inline-closure.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
        1: ; ModuleID = 'target_feature_inline_closure.5b935a73a363356c-cgu.0' 
        2: source_filename = "target_feature_inline_closure.5b935a73a363356c-cgu.0" 
        3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 
        4: target triple = "x86_64-unknown-linux-gnu" 
        5:  
        6: ; core::core_arch::x86::avx::_mm256_add_ps 
        7: ; Function Attrs: argmemonly inlinehint mustprogress nofree norecurse nosync nounwind nonlazybind willreturn uwtable 
        8: define internal fastcc void @_ZN4core9core_arch3x863avx13_mm256_add_ps17ha5faddbf0c47d313E(ptr noalias nocapture noundef writeonly align 32 dereferenceable(32) %_0, ptr noalias nocapture noundef readonly align 32 dereferenceable(32) %a, ptr noalias nocapture noundef readonly align 32 dereferenceable(32) %b) unnamed_addr #0 { 
        9: start: 
       10:  %0 = load <8 x float>, ptr %a, align 32 
       11:  %1 = load <8 x float>, ptr %b, align 32 
       12:  %2 = fadd <8 x float> %0, %1 
       13:  store <8 x float> %2, ptr %_0, align 32 
       14:  ret void 
       15: } 
       16:  
       17: ; Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind nonlazybind willreturn uwtable 
       18: define void @with_avx(ptr noalias nocapture noundef writeonly sret(<8 x float>) align 32 dereferenceable(32) %_0, ptr noalias nocapture noundef readonly align 32 dereferenceable(32) %x) unnamed_addr #1 { 
       19: start: 
       20:  %0 = load <8 x float>, ptr %x, align 32 
       21:  %1 = fadd <8 x float> %0, %0 
       22:  store <8 x float> %1, ptr %_0, align 32 
       23:  ret void 
       24: } 
       25:  
       26: ; Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind nonlazybind willreturn uwtable 
       27: define void @without_avx(ptr noalias nocapture noundef writeonly sret(<8 x float>) align 32 dereferenceable(32) %_0, ptr noalias nocapture noundef readonly align 32 dereferenceable(32) %x) unnamed_addr #2 { 
       28: start: 
       29:  %0 = alloca <8 x float>, align 32 
       30:  %1 = alloca <8 x float>, align 32 
       31:  %2 = load <8 x float>, ptr %x, align 32 
       32:  store <8 x float> %2, ptr %1, align 32 
       33:  store <8 x float> %2, ptr %0, align 32 
       34: ; call core::core_arch::x86::avx::_mm256_add_ps 
       35:  call fastcc void @_ZN4core9core_arch3x863avx13_mm256_add_ps17ha5faddbf0c47d313E(ptr noalias nocapture noundef nonnull align 32 dereferenceable(32) %_0, ptr noalias nocapture noundef nonnull align 32 dereferenceable(32) %1, ptr noalias nocapture noundef nonnull align 32 dereferenceable(32) %0) 
not:27                                                                      !~~~                                                                                                                                                                                                                                   error: no match expected
       36:  ret void 
       37: } 
       38:  
       39: attributes #0 = { argmemonly inlinehint mustprogress nofree norecurse nosync nounwind nonlazybind willreturn uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" "target-features"="+avx" } 
       40: attributes #1 = { argmemonly mustprogress nofree norecurse nosync nounwind nonlazybind willreturn uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" "target-features"="+avx" } 
       41: attributes #2 = { argmemonly mustprogress nofree norecurse nosync nounwind nonlazybind willreturn uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" } 
       42:  
       43: !llvm.module.flags = !{!0, !1} 
       44: !llvm.ident = !{!2} 
       45:  
       46: !0 = !{i32 7, !"PIC Level", i32 2} 
       47: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
       48: !2 = !{!"rustc version 1.75.0-nightly (8e736d20b 2023-10-10)"} 
------------------------------------------



@ouz-a
Copy link
Contributor Author

ouz-a commented Oct 10, 2023

how does this affect code-gen test ?

@oli-obk
Copy link
Contributor

oli-obk commented Oct 10, 2023

It can't... I'll assume this is a bug that all PRs are hitting

@ouz-a
Copy link
Contributor Author

ouz-a commented Oct 10, 2023

🤔 It looks like my pr is the only one that is affected.

@oli-obk
Copy link
Contributor

oli-obk commented Oct 10, 2023

can you reproduce locally?

@ouz-a
Copy link
Contributor Author

ouz-a commented Oct 10, 2023

no I can't

@oli-obk
Copy link
Contributor

oli-obk commented Oct 10, 2023

@bors r+ rollup

probably spurious then

@bors
Copy link
Contributor

bors commented Oct 10, 2023

📌 Commit 0bcb058 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 Oct 10, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 10, 2023
In smir use `FxIndexMap` to store indexed ids

Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.

Addresses rust-lang/project-stable-mir#35

r? `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 10, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#109422 (rustdoc-search: add impl disambiguator to duplicate assoc items)
 - rust-lang#115948 (rustdoc: show crate name beside smaller logo)
 - rust-lang#116444 (add test for const-eval error in dead code during monomorphization)
 - rust-lang#116503 (Update docs for mips target tier demotion.)
 - rust-lang#116559 (Mark `new_in` as `const` for BTree collections)
 - rust-lang#116560 (In smir use `FxIndexMap` to store indexed ids)
 - rust-lang#116574 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 10, 2023
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#109422 (rustdoc-search: add impl disambiguator to duplicate assoc items)
 - rust-lang#116250 (On type error of closure call argument, point at earlier calls that affected inference)
 - rust-lang#116444 (add test for const-eval error in dead code during monomorphization)
 - rust-lang#116503 (Update docs for mips target tier demotion.)
 - rust-lang#116559 (Mark `new_in` as `const` for BTree collections)
 - rust-lang#116560 (In smir use `FxIndexMap` to store indexed ids)
 - rust-lang#116574 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 100713e into rust-lang:master Oct 10, 2023
8 of 11 checks passed
@rustbot rustbot added this to the 1.75.0 milestone Oct 10, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 10, 2023
Rollup merge of rust-lang#116560 - ouz-a:efficient_ids, r=oli-obk

In smir use `FxIndexMap` to store indexed ids

Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.

Addresses rust-lang/project-stable-mir#35

r? ``@oli-obk``
bors-ferrocene bot added a commit to ferrocene/ferrocene that referenced this pull request Oct 12, 2023
48: Pull upstream master 2023 10 12 r=tshepang a=Dajamante

* rust-lang/rust#113487
* rust-lang/rust#116506
* rust-lang/rust#116448
* rust-lang/rust#116640
  * rust-lang/rust#116627
  * rust-lang/rust#116597
  * rust-lang/rust#116436
  * rust-lang/rust#116315
  * rust-lang/rust#116219
* rust-lang/rust#113218
* rust-lang/rust#115937
* rust-lang/rust#116014
* rust-lang/rust#116623
* rust-lang/rust#112818
* rust-lang/rust#115948
* rust-lang/rust#116622
* rust-lang/rust#116621
  * rust-lang/rust#116612
  * rust-lang/rust#116611
  * rust-lang/rust#116530
  * rust-lang/rust#95967
* rust-lang/rust#116578
* rust-lang/rust#113915
* rust-lang/rust#116605
  * rust-lang/rust#116574
  * rust-lang/rust#116560
  * rust-lang/rust#116559
  * rust-lang/rust#116503
  * rust-lang/rust#116444
  * rust-lang/rust#116250
  * rust-lang/rust#109422
* rust-lang/rust#116598
  * rust-lang/rust#116596
  * rust-lang/rust#116595
  * rust-lang/rust#116589
  * rust-lang/rust#116586
* rust-lang/rust#116551
* rust-lang/rust#116409
* rust-lang/rust#116548
* rust-lang/rust#116366
* rust-lang/rust#109882
* rust-lang/rust#116497
* rust-lang/rust#116532
* rust-lang/rust#116569
  * rust-lang/rust#116561
  * rust-lang/rust#116556
  * rust-lang/rust#116549
  * rust-lang/rust#116543
  * rust-lang/rust#116537
  * rust-lang/rust#115882
* rust-lang/rust#116142
* rust-lang/rust#115238
* rust-lang/rust#116533
* rust-lang/rust#116096
* rust-lang/rust#116468
* rust-lang/rust#116515
* rust-lang/rust#116454
* rust-lang/rust#116183
* rust-lang/rust#116514
* rust-lang/rust#116509
* rust-lang/rust#116487
* rust-lang/rust#116486
* rust-lang/rust#116450
* rust-lang/rust#114623
* rust-lang/rust#116416
* rust-lang/rust#116437
* rust-lang/rust#100806
* rust-lang/rust#116330
* rust-lang/rust#116310
* rust-lang/rust#115583
* rust-lang/rust#116457
* rust-lang/rust#116508
* rust-lang/rust#109214
* rust-lang/rust#116318
* rust-lang/rust#116501
  * rust-lang/rust#116500
  * rust-lang/rust#116458
  * rust-lang/rust#116400
  * rust-lang/rust#116277
* rust-lang/rust#114709
* rust-lang/rust#116492
  * rust-lang/rust#116484
  * rust-lang/rust#116481
  * rust-lang/rust#116474
  * rust-lang/rust#116466
  * rust-lang/rust#116423
  * rust-lang/rust#116297
  * rust-lang/rust#114564
* rust-lang/rust#114811
* rust-lang/rust#116489
* rust-lang/rust#115304

Co-authored-by: Peter Hall <peter.hall@hyperexponential.com>
Co-authored-by: Emanuele Vannacci <emanuele.vannacci@gmail.com>
Co-authored-by: Neven Villani <vanille@crans.org>
Co-authored-by: Alex Macleod <alex@macleod.io>
Co-authored-by: Tamir Duberstein <tamird@gmail.com>
Co-authored-by: Eduardo Sánchez Muñoz <eduardosm-dev@e64.io>
Co-authored-by: koka <koka.code@gmail.com>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: Philipp Krones <hello@philkrones.com>
Co-authored-by: Camille GILLOT <gillot.camille@gmail.com>
Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
Co-authored-by: Ralf Jung <post@ralfj.de>
bors-ferrocene bot added a commit to ferrocene/ferrocene that referenced this pull request Oct 13, 2023
48: Pull upstream master 2023 10 12 r=tshepang a=Dajamante

* rust-lang/rust#113487
* rust-lang/rust#116506
* rust-lang/rust#116448
* rust-lang/rust#116640
  * rust-lang/rust#116627
  * rust-lang/rust#116597
  * rust-lang/rust#116436
  * rust-lang/rust#116315
  * rust-lang/rust#116219
* rust-lang/rust#113218
* rust-lang/rust#115937
* rust-lang/rust#116014
* rust-lang/rust#116623
* rust-lang/rust#112818
* rust-lang/rust#115948
* rust-lang/rust#116622
* rust-lang/rust#116621
  * rust-lang/rust#116612
  * rust-lang/rust#116611
  * rust-lang/rust#116530
  * rust-lang/rust#95967
* rust-lang/rust#116578
* rust-lang/rust#113915
* rust-lang/rust#116605
  * rust-lang/rust#116574
  * rust-lang/rust#116560
  * rust-lang/rust#116559
  * rust-lang/rust#116503
  * rust-lang/rust#116444
  * rust-lang/rust#116250
  * rust-lang/rust#109422
* rust-lang/rust#116598
  * rust-lang/rust#116596
  * rust-lang/rust#116595
  * rust-lang/rust#116589
  * rust-lang/rust#116586
* rust-lang/rust#116551
* rust-lang/rust#116409
* rust-lang/rust#116548
* rust-lang/rust#116366
* rust-lang/rust#109882
* rust-lang/rust#116497
* rust-lang/rust#116532
* rust-lang/rust#116569
  * rust-lang/rust#116561
  * rust-lang/rust#116556
  * rust-lang/rust#116549
  * rust-lang/rust#116543
  * rust-lang/rust#116537
  * rust-lang/rust#115882
* rust-lang/rust#116142
* rust-lang/rust#115238
* rust-lang/rust#116533
* rust-lang/rust#116096
* rust-lang/rust#116468
* rust-lang/rust#116515
* rust-lang/rust#116454
* rust-lang/rust#116183
* rust-lang/rust#116514
* rust-lang/rust#116509
* rust-lang/rust#116487
* rust-lang/rust#116486
* rust-lang/rust#116450
* rust-lang/rust#114623
* rust-lang/rust#116416
* rust-lang/rust#116437
* rust-lang/rust#100806
* rust-lang/rust#116330
* rust-lang/rust#116310
* rust-lang/rust#115583
* rust-lang/rust#116457
* rust-lang/rust#116508
* rust-lang/rust#109214
* rust-lang/rust#116318
* rust-lang/rust#116501
  * rust-lang/rust#116500
  * rust-lang/rust#116458
  * rust-lang/rust#116400
  * rust-lang/rust#116277
* rust-lang/rust#114709
* rust-lang/rust#116492
  * rust-lang/rust#116484
  * rust-lang/rust#116481
  * rust-lang/rust#116474
  * rust-lang/rust#116466
  * rust-lang/rust#116423
  * rust-lang/rust#116297
  * rust-lang/rust#114564
* rust-lang/rust#114811
* rust-lang/rust#116489
* rust-lang/rust#115304

Co-authored-by: Emanuele Vannacci <emanuele.vannacci@gmail.com>
Co-authored-by: Neven Villani <vanille@crans.org>
Co-authored-by: Alex Macleod <alex@macleod.io>
Co-authored-by: Tamir Duberstein <tamird@gmail.com>
Co-authored-by: Eduardo Sánchez Muñoz <eduardosm-dev@e64.io>
Co-authored-by: koka <koka.code@gmail.com>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: Philipp Krones <hello@philkrones.com>
Co-authored-by: Camille GILLOT <gillot.camille@gmail.com>
Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
Co-authored-by: Ralf Jung <post@ralfj.de>
Co-authored-by: ShE3py <52315535+she3py@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants