Skip to content

Commit 2231b46

Browse files
authored
Merge pull request #217 from ecstatic-morse/design-minutes
Add design meeting minutes for 2019-11-08
2 parents 3a5f440 + fc4941d commit 2231b46

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Unify Dataflow Frameworks (#202)
3+
type: docs
4+
---
5+
6+
# Design Meeting 2019-11-08
7+
8+
[Zulip Stream](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/design.20meeting.202019-11-08)
9+
10+
# Agenda
11+
12+
- Design doc: https://hackmd.io/@39Qr_z9cQhasi25sGjmFnA/Skvd9rztS
13+
14+
15+
- Explain the current state of things
16+
- We currently have two wholly separate APIs for dataflow, one for bit-vector problems and one that allows arbitrary transfer functions but still restricts the lattice to a powerset of indices.
17+
- I want to merge these two to make code more DRY.
18+
- The prototype implementation is described pretty thoroughly in the design doc, but maybe go over it a bit?
19+
20+
- Discuss the [prototype implementation][proto] in general
21+
- The prototype is not very ambitious. It mostly preserves the existing `BitDenotation` API but extends it to arbitrary transfer functions.
22+
- Do we want to maintain the status quo? Have two separate implementations forever? Once arbitrary lattices are supported, maybe they won’t fit as nicely into the same API.
23+
- OTOH, adding backwards analysis would have to be done in two places.
24+
- There have been more ambitious changes attempted. Perhaps we want to do one of these instead? Or at least incorporate some of their ideas into a framework that hews closer to the existing one.
25+
- nagisa worked on a [new dataflow framework][nagisa] that works for arbitrary lattices and transfer functions back in 2016.
26+
- eddyb was looking into a simultaneous forwards/backwards [dataflow-like thing][eddyb] for NRVO.
27+
28+
- Discuss the prototype in detail (If we decide we still want to go this way)
29+
- How do we feel about the `{before_,}*_effect` naming convention? It takes a bit of getting used to, and doesn’t extend nicely to backwards dataflow.
30+
- OTOH, having a canonical `statement_effect` which most implementers want to use and a secondary, prefixed effect which is only rarely used is good.
31+
- Should we be passing a `mir::Statement` to the `statement` effect methods? What about `mir::Body` to `bits_per_block`?
32+
- Should we use specialization to implement this?’
33+
- Should the `Analysis` methods take `&self` or `&mut self`?
34+
- Some may depend on the results of an earlier dataflow analysis and want to hold a cursor.
35+
- However, transfer functions should be pure for a given MIR, so maybe forcing those analyses to use interior mutability is appropriate.
36+
- Are we okay with a `ResultsCursor` becoming the common way to inspect results?
37+
- How do we implement a zipped `ResultsVisitor`?
38+
39+
- Discuss what extensions to the framework we want to prioritize
40+
- Backwards dataflow (currently implemented by hand to do check liveness in generators)
41+
- Arbitrary lattices (would make MIR const-propagation more powerful)
42+
- OTOH, the current linear const-propagation gets most of the benefits without the overhead of dataflow.
43+
- Optimizations:
44+
- Don’t cache block transfer functions on acyclic MIR (reduces memory usage)
45+
- Extended basic blocks? @Mark-Simulacrum
46+
47+
# Minutes
48+
- Background on the need for arbitrary transfer functions for dataflow and const qualification.
49+
- Alternatives to the prototype:
50+
- Perhaps we could express these more advanced dataflow problems in datalog/datafrog?
51+
- nikomatsakis wanted to test more in the polonius repo before committing to this upstream.
52+
- The need for `apply_call_return_effect`:
53+
- We need some version of this, but not necessarily the current version.
54+
- API details
55+
- Skipped most of these, since they can be figured out later.
56+
- mir_borrowck might benefit from `ResultsCursor` now that it is implemented.
57+
- Optimizations/extensions
58+
- Some interest in not caching block transfer functions for acyclic MIR.
59+
- This is pretty easy, I will prioritize this.
60+
- Probably not going to do EBBs anytime soon.
61+
62+
# Conclusions
63+
- There was consensus on pursuing some version of the prototype instead of something more radical.
64+
- Details will be hashed out in a PR to come.
65+
- @ecstaticmorse will pursue this.
66+
67+
[proto]: https://github.com/rust-lang/rust/pull/65672
68+
[nagisa]: https://github.com/rust-lang/rust/pull/35608
69+
[eddyb]: https://github.com/rust-lang/rust/pull/47954

0 commit comments

Comments
 (0)