Stream: t-compiler/wg-polonius

Topic: Using Datapond in Polonius


Vytautas Astrauskas (Aug 02 2020 at 13:45, on Zulip):

@lqd Does it make sense to work on improving Datapond so that eventually Polonius could be rewritten in actual Datalog? Or are there any fundamental problems that would prevent this such as procedural macros not being supported in the Rust compiler?

bjorn3 (Aug 02 2020 at 14:38, on Zulip):

proc macros are used in the compiler (rustc_macros)

lqd (Aug 02 2020 at 18:38, on Zulip):

it's an interesting question, but at the same time I'm not sure what you envision when saying "rewritten in actual datalog" ? like changing the engine to Soufflé or having the implementation looking like regular rules rather than the datafrog DSL ?

lqd (Aug 02 2020 at 18:42, on Zulip):

assuming you mean the 2nd: on the one hand, yes. For example, I've wanted to evaluate Demand Transformation over our different rules and that would be evidently easier with datapond generating the rules. On the other hand, and this is why I've also avoided doing that, I'm not 100% sure about what to do to make the current rules/implementation scale to what we need it to.

lqd (Aug 02 2020 at 18:46, on Zulip):

specifically, and this is my personal opinion only, I feel we cannot easily take advantage of the fact that we are doing dataflow over a CFG. The "specialized solution" vs "generic solution".

lqd (Aug 02 2020 at 18:47, on Zulip):

there are things it does super well, and I think it's perfect for documentation, explanation, specification/validation, that is more like a reference implementation

lqd (Aug 02 2020 at 18:50, on Zulip):

on the other hand, no engine is going to look at some of our rules and rewrite them as reachability queries over the condensation graph

lqd (Aug 02 2020 at 18:52, on Zulip):

or optimize some state because the graph is acyclic

lqd (Aug 02 2020 at 18:53, on Zulip):

or prune the computation of a subgraph because it's dominated by a kill node

lqd (Aug 02 2020 at 18:56, on Zulip):

so I have to do those by hand, and at this point I wonder if I should actually be doing the computation in a dataflow framework :)

Vytautas Astrauskas (Aug 02 2020 at 19:48, on Zulip):

bjorn3 said:

proc macros are used in the compiler (rustc_macros)

Thanks! I knew that there was some work on that, but I did not know whether it was merged or not.

Vytautas Astrauskas (Aug 02 2020 at 19:50, on Zulip):

at the same time I'm not sure what you envision when saying "rewritten in actual datalog" ?

The oversimplified, but hopefully more clear idea would be using a procedural macro datapond! that generates the necessary code from the datalog facts.

lqd (Aug 02 2020 at 19:53, on Zulip):

right right like we talked about in Barcelona then

Vytautas Astrauskas (Aug 02 2020 at 19:53, on Zulip):

lqd said:

so I have to do those by hand, and at this point I wonder if I should actually be doing the computation in a dataflow framework :)

If you did that in the dataflow framework, would it still use the same data representation (tuples of numbers)? I am asking because, at least in theory, one could mix Datalog with Rust code.

Vytautas Astrauskas (Aug 02 2020 at 19:54, on Zulip):

lqd said:

right right like we talked about in Barcelona then

Exactly.

lqd (Aug 02 2020 at 20:00, on Zulip):

(again this is just my opinion :) for dataflow-like computations I'd assume it could be similar, but rustc already has such a dataflow framework. What I also meant to say was that a lot of things already exist there, so some of what I'm saying could be less "redo some polonius things in a dataflow framework" than "use what rustc already does instead of redoing them in datalog"

lqd (Aug 02 2020 at 20:01, on Zulip):

or using, say, dominators and postdominators features already present in MIR

lqd (Aug 02 2020 at 20:02, on Zulip):

rustc doesn't have a Nuutila implementation so I've done one but it could easily be integrated into the existing SCC features in rustc_data_structures

Vytautas Astrauskas (Aug 02 2020 at 20:08, on Zulip):

lqd said:

(again this is just my opinion :) for dataflow-like computations I'd assume it could be similar, but rustc already has such a dataflow framework. What I also meant to say was that a lot of things already exist there, so some of what I'm saying could be less "redo some polonius things in a dataflow framework" than "use what rustc already does instead of redoing them in datalog"

Makes sense. :smiling_face:

Vytautas Astrauskas (Aug 02 2020 at 20:09, on Zulip):

Thanks for explaining!

lqd (Aug 02 2020 at 20:11, on Zulip):

we might talk about this for the next sprint (tomorrow until wednesday)

lqd (Aug 02 2020 at 20:13, on Zulip):

and that question seems like it'd fit right in the discussion/planning/etc parts of it

nikomatsakis (Aug 03 2020 at 13:20, on Zulip):

Yeah, I'm of two minds about this.

nikomatsakis (Aug 03 2020 at 13:21, on Zulip):

I can imagine that literally using datalog is not going to be a win, but I'm not entirely convinced yet.

Last update: Jun 20 2021 at 01:00UTC