T Compiler Meeting Agenda 2022 07 07

T-compiler Meeting Agenda 2022-07-07

Announcements

Other WG meetings

MCPs/FCPs

  • New MCPs (take a look, see if you like them!)
    • No new proposals this time.
  • Old MCPs (not seconded, take a look)
    • “Dealing with type/const ambiguities” compiler-team#480 (last review activity: 5 months ago)
    • “Removing codegen logic for nvptx-nvidia-cuda (32-bit target)” compiler-team#496 (last review activity: 3 months ago)
    • “Arbitrary annotations in compiletest” compiler-team#513 (last review activity: about 60 days ago)
    • “Add support for the LoongArch architecture” compiler-team#518 (last review activity: about 19 days ago)
  • Pending FCP requests (check your boxes!)
    • “Stabilize -Zgcc-ld=lld as -Clink-self-contained=linker -Clinker-flavor=gcc-lldcompiler-team#510
    • “Increase the minimum linux-gnu versions” rust#95026
    • “session: stabilize split debuginfo on linux” rust#98051
  • Things in FCP (make sure you’re good with it)
    • No FCP requests this time.
  • Accepted MCPs
  • Finalized FCPs (disposition merge)
    • “Remove migrate borrowck mode” rust#95565
    • “Modify MIR building to drop repeat expressions with length zero” rust#95953
    • “Lang: Stabilize usage of rustc_nonnull_optimization_guaranteed on -1” rust#97122
    • “Remove a back-compat hack on lazy TAIT” rust#97346
    • “make cenum_impl_drop_cast deny-by-default” rust#97652
    • “make const_err show up in future breakage reports” rust#97743
    • “lub: don’t bail out due to empty binders” rust#97867
    • “allow unions with mutable references and tuples of allowed types” rust#97995

WG checkins

  • @_WG-rustc-dev-guide by @Santiago Pastorino and @Yuki Okushi|217081 (previous checkin):

Most notable changes

  • diagnostics: structs with new slug syntax #1377
  • diagnostics: more translation and diagnostic derive documentation #1363
  • add section on user types #1359

Most notable WIPs

  • Describe Type Alias Impl Trait (TAIT) Inference Algorithm #1297

Checkin text

Backport nominations

T-compiler stable / T-compiler beta

  • :beta: “don’t succeed evaluate_obligation query if new opaque types were registered” rust#98614
    • authored by @oli, not yet merged
    • assigned reviewer @Wesley Wiser
    • Fixes rust#98608 and rust#98604, unsoundness issues
    • also nominated for stable backport (@_oli suggests this to be included in a point release, should that happen)
  • :beta: “Create fresh lifetime parameters for bare fn trait too” rust#98637
    • authored by @cjgillot, not yet merged
    • assigned reviewer @Vadim Petrochenkov
    • fixes rust#98616 and rust#98726, P-high and P-critical regressions now in beta
  • :beta: “Do not call check_expr in check_compatible, since it has side-effects” rust#98785
    • PR authored and nominated for backport by @Michael Goulet (compiler-errors), not yet merged
    • assigned reviewer @Jack Huey
    • fixes various diagnostics rust#98784, rust#98894 and rust#98897
  • :beta: “Update llvm-project” rust#98567
    • authored by @Patryk Wychowaniec , approved by @cuviper
    • fixes a number of issues (at least one P-critical (comment)
  • :beta: “Return a FxIndexSet in is_late_bound query.” rust#98959
    • authored by @cjgillot
    • fixes P-critical regression rust#98890 and affects #96655
  • :stable: “don’t succeed evaluate_obligation query if new opaque types were registered” rust#98614
    • (nominated for beta)

T-rustdoc stable / T-rustdoc beta

  • :beta: “rustdoc: filter ‘_ lifetimes from ty::PolyTraitRef” rust#98727
    • T-rustdoc agrees on backport
    • Q: do small T-rustdoc PRs like these need a T-compiler backport signoff or can they be straight approved?
  • No stable nominations for T-rustdoc this time.

:back: / :shrug: / :hand:

PRs S-waiting-on-team

T-compiler

  • “Increase the minimum linux-gnu versions (to kernel 3.2 / glibc 2.17)” rust#95026
    • me (@_apiraino) tried to summarize and see if we are at point to have an actionable or more teams should chime in (T-compiler or T-lang?)
    • Write a rust-lang blog post (comment)?
    • Done in blog post for 1.61 (comment)
    • concerns raised for very old systems and IoTs (comment)
    • at some point we need to keep up with LLVM evolution (comment)
    • Set a Minimum Supported Linux Kernel, so vendors can pin that version (comment)?
    • T-libs decided to move forward (comment)

Oldest PRs waiting for review

T-compiler

  • “Warn about dead tuple struct fields” rust#95977 (last review activity: about 35 days ago)
    • unsure if ready for review (some people commented by it’s still assigned to T-lang)
    • does it need a reviewer from T-compiler?
  • “Simplify some code that depend on Deref” rust#97077 (last review activity: about 33 days ago)
    • marked as blocked on #95576 (which is now merged)
    • ready for another review? cc @oli
  • “Convert a hard-warning about named static lifetimes into a lint” rust#98079 (last review activity: about 21 days ago)
    • (note from @_apiraino) @Esteban K├╝ber any pending comments? Author replied but unsure it they’re waiting (in case I’ll flip the review switch)
  • “Use object instead of LLVM for reading bitcode from rlibs” rust#98100 (last review activity: about 21 days ago)
    • bot assigned review to @Wesley Wiser
  • “Improve the function pointer docs” rust#98180 (last review activity: about 19 days ago)
    • Assigned to @Josh Triplett (with their T-libs hat?)
    • needs also a T-compiler review?

Issues of Note

Short Summary

P-critical

T-compiler

  • “Wrong cast of u16 to usize on aarch64” rust#97463
    • latest updates from Felix in PR #97800 comment
  • “Wrong optimization” rust#98568
  • “Function type with opaque return type can be coerced to dyn Fn with arbitrary return type” rust#98608
  • “Missing dyn keyword in bare_trait_objects with Rust 2015 edition produces faulty error instead of warnings” rust#98726
  • py ./x.py no longer works on Windows” rust#98650
    • reported upstream (issue)
    • Q: Any actionable for us? Is this a “wontfix” i.e. leave #98650 open and remove I-prioritize and regression label?
  • for<'a> &'a T: 'a and closures regressed” rust#98437
    • discussed last week (notes)

T-rustdoc

  • No P-critical issues for T-rustdoc this time.

P-high regressions

P-high beta regressions

  • No P-high beta regressions this time.

Unassigned P-high nightly regressions

  • No unassigned P-high nightly regressions this time.

Performance logs

triage logs for 2022-07-05

Overall the week is a small improvement on average, with some benchmarks (particularly in the primary category) showing significant improvements due to the enablement of MIR inlining in #91743. Inlining promises to improve the quality of our generated LLVM IR and make other optimizations more worthwhile, so it’s great to see these early results already being quite impactful.

Triage done by @simulacrum. Revision range: baf382e63c023259fa1f9042f8f479f183ca6ed3..880646ca9c6dc21e04efe2f1940369a45b71ff2d

Summary:

mean max count
Regressions (primary) 1.9% 11.9% 111
Regressions (secondary) 3.4% 11.9% 106
Improvements (primary) -2.8% -9.7% 105
Improvements (secondary) -4.4% -16.8% 97
All (primary) -0.4% 11.9% 216

3 Regressions, 6 Improvements, 6 Mixed; 4 of them in rollups 46 artifact comparisons made in total

Regressions

Fix FFI-unwind unsoundness with mixed panic mode #97235 (Comparison Link)

mean max count
Regressions (primary) 0.5% 1.2% 86
Regressions (secondary) 0.9% 2.5% 36
Improvements (primary) N/A N/A 0
Improvements (secondary) N/A N/A 0
All (primary) 0.5% 1.2% 86

PR author notes this added a new query for each MIR body, so this is an expected regression, and given the soundness fix is not too large to need further investigation.

Rollup of 5 pull requests #98874 (Comparison Link)

mean max count
Regressions (primary) 0.6% 0.9% 13
Regressions (secondary) 1.4% 2.4% 12
Improvements (primary) N/A N/A 0
Improvements (secondary) N/A N/A 0
All (primary) 0.6% 0.9% 13

Some possibly real, though small, regressions. Unclear cause; rollup doesn’t obviously contain any sensitive PRs.

Rollup of 8 pull requests #98904 (Comparison Link)

mean max count
Regressions (primary) 0.7% 0.9% 8
Regressions (secondary) 1.1% 2.3% 16
Improvements (primary) N/A N/A 0
Improvements (secondary) N/A N/A 0
All (primary) 0.7% 0.9% 8

Interestingly, regressions here are remarkably similar to those in #98874 (previous rollup in this list). Not seeing an obvious connection between the PRs in the two rollups, though.

Improvements

proc_macro/bridge: stop using a remote object handle for proc_macro Punct and Group #98188 (Comparison Link)

mean max count
Regressions (primary) N/A N/A 0
Regressions (secondary) N/A N/A 0
Improvements (primary) -0.5% -1.4% 15
Improvements (secondary) -1.6% -5.0% 16
All (primary) -0.5% -1.4% 15

Update smallvec to 1.8.1. #98558 (Comparison Link)

mean max count
Regressions (primary) N/A N/A 0
Regressions (secondary) N/A N/A 0
Improvements (primary) N/A N/A 0
Improvements (secondary) -1.7% -2.4% 9
All (primary) N/A N/A 0

CTFE interning: don’t walk allocations that don’t need it #97585 (Comparison Link)

mean max count
Regressions (primary) N/A N/A 0
Regressions (secondary) N/A N/A 0
Improvements (primary) -1.0% -1.0% 2
Improvements (secondary) -2.5% -9.3% 32
All (primary) -1.0% -1.0% 2

Optimize Vec::insert for the case where index == len. #98755 (Comparison Link)

mean max count
Regressions (primary) N/A N/A 0
Regressions (secondary) N/A N/A 0
Improvements (primary) -0.4% -1.0% 8
Improvements (secondary) -1.2% -2.4% 13
All (primary) -0.4% -1.0% 8

fully move dropck to mir #98641 (Comparison Link)

mean max count
Regressions (primary) 0.5% 0.7% 2
Regressions (secondary) N/A N/A 0
Improvements (primary) -0.7% -2.4% 34
Improvements (secondary) -0.8% -2.1% 22
All (primary) -0.7% -2.4% 36

interpret: track place alignment together with the type, not the value #98846 (Comparison Link)

mean max count
Regressions (primary) N/A N/A 0
Regressions (secondary) N/A N/A 0
Improvements (primary) -0.7% -0.9% 8
Improvements (secondary) -1.2% -2.3% 13
All (primary) -0.7% -0.9% 8

Mixed

Rollup of 9 pull requests #98612 (Comparison Link)

mean max count
Regressions (primary) 0.7% 1.0% 5
Regressions (secondary) 5.2% 9.9% 6
Improvements (primary) -1.0% -1.1% 2
Improvements (secondary) -0.8% -2.4% 22
All (primary) 0.2% -1.1% 7

Rollup of 7 pull requests #98656 (Comparison Link)

mean max count
Regressions (primary) 1.4% 11.3% 131
Regressions (secondary) 3.5% 11.2% 73
Improvements (primary) N/A N/A 0
Improvements (secondary) -2.2% -3.1% 8
All (primary) 1.4% 11.3% 131

Asked for further investigation on the PR, noting #98277 as a possible cause.

move MIR syntax into a dedicated file and ping some people whenever it changes #98649 (Comparison Link)

mean max count
Regressions (primary) 0.5% 0.5% 1
Regressions (secondary) 1.6% 4.3% 20
Improvements (primary) -0.3% -0.4% 5
Improvements (secondary) -0.3% -0.3% 3
All (primary) -0.2% 0.5% 6

This is probably noise, but it’s not very clear. Regressions are minor enough that further investigation does not seem warranted.

Enable MIR inlining #91743 (Comparison Link)

mean max count
Regressions (primary) 1.3% 7.2% 54
Regressions (secondary) 1.7% 6.1% 68
Improvements (primary) -2.6% -10.0% 118
Improvements (secondary) -3.4% -17.3% 76
All (primary) -1.4% -10.0% 172

A fairly large improvement for some benchmarks, and particularly large for bootstrap times (nearly 9% win). There are some fairly large regressions to a few select benchmarks which stress the inlining more than helping LLVM (e.g., stm32f4), but overall this is a great improvement in many cases.

Avoid unnecessary work in finalize_resolutions_in. #98569 (Comparison Link)

mean max count
Regressions (primary) 0.3% 0.5% 7
Regressions (secondary) 0.5% 0.7% 7
Improvements (primary) -1.0% -1.0% 2
Improvements (secondary) -2.1% -2.4% 6
All (primary) 0.0% -1.0% 9

Wins/losses balance out; already labeled as triaged.

Don’t use match-destructuring for derived ops on structs. #98446 (Comparison Link)

mean max count
Regressions (primary) N/A N/A 0
Regressions (secondary) 1.3% 1.9% 19
Improvements (primary) -0.6% -1.5% 66
Improvements (secondary) -5.4% -12.3% 33
All (primary) -0.6% -1.5% 66

Overall an excellent, though somewhat small, improvement. Regressions are small and limited to a couple very artificial stress tests rather than real-world

Nominated Issues

T-compiler

  • “Revert #94158, “Apply noundef metadata to loads of types that do not permit raw init”” rust#98966
    • nominated by @Ben Kimock (Saethlin)
    • Summary for the nomination:

    In #66151 we have decided against turning technically UB code into a panic on account of the amount of code that would be affected, so it doesn’t seem right to turn technically into directly visible to LLVM. If the breakage from adding a panic for this case is too high, the danger from turning this case into visible UB should be as well.

    • cc @Thom Chiovoloni

RFC

  • No nominated RFCs for T-compiler this time.

Next week’s WG checkins

  • @_WG-llvm by @nagisa and @Nikita Popov
  • @_WG-traits (Types team) by @nikomatsakis and @Jack Huey