Stream: git-wasmtime

Topic: wasmtime / issue #4129 Cranelift: develop a generic lazy ...


view this post on Zulip Wasmtime GitHub notifications bot (May 10 2022 at 23:24):

cfallin opened issue #4129:

As part of #4128, we should develop a lazy analysis framework that permits us to easily compute properties of CLIF values, operators, or program points between operators (depending on the analysis). This framework should accept pluggable lattice types, lattice meet functions, and transfer functions, ideally permitting these to be written in ISLE.

We should look into the following ideas:

view this post on Zulip Wasmtime GitHub notifications bot (May 10 2022 at 23:24):

cfallin labeled issue #4129:

As part of #4128, we should develop a lazy analysis framework that permits us to easily compute properties of CLIF values, operators, or program points between operators (depending on the analysis). This framework should accept pluggable lattice types, lattice meet functions, and transfer functions, ideally permitting these to be written in ISLE.

We should look into the following ideas:

view this post on Zulip Wasmtime GitHub notifications bot (May 10 2022 at 23:24):

cfallin labeled issue #4129:

As part of #4128, we should develop a lazy analysis framework that permits us to easily compute properties of CLIF values, operators, or program points between operators (depending on the analysis). This framework should accept pluggable lattice types, lattice meet functions, and transfer functions, ideally permitting these to be written in ISLE.

We should look into the following ideas:

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2022 at 17:14):

fitzgen commented on issue #4129:

We can do the more abstract interpretation-y implementation of the forwards analysis (rather than the work queue-y implementation that would rely on use lists) by walking blocks and walking each instruction in a block and doing the analysis for each instruction that way, no?

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2022 at 17:41):

cfallin commented on issue #4129:

Yes, but it runs into the same problem with cycles whether we do it lazily (reaching backward on request) or eagerly (walking forward and evaluating for each new def): when we hit a blockparam, what do we do? Walking backward, we might recurse over the edge and find a cycle; we need a way to take some initial value, but remember to "come back" later (hence side-info). Walking forward, we have to plug in some initial value but again we need to record the loop and come back to it.

In other words I think that the supporting-cycles-with-fixpoint feature and the lazy-backward-or-eager-forward decision are orthogonal; the former requires additional info (esssentially, for us to reify the graph somehow so we can iterate over it) whether or not we do the latter.

view this post on Zulip Wasmtime GitHub notifications bot (May 18 2022 at 05:30):

cfallin commented on issue #4129:

I've done some initial prototyping work in this direction over the past week or so in this branch (somewhat misnamed isle-memoization as it's really an eager approach now):

So then I began to work out an eager approach (roughly, Datalog-like rather than Prolog-like, for anyone familiar with both): scan the function top to bottom and evaluate an ISLE constructor at each {value, instruction, program point} (depending on analysis), filling a table in. That's what the branch linked above is.

The two major issues with this are:

Said another way, I was pushing the design above in the direction of Prolog/Datalog because I know that these can be used for general and powerful program analysis (I've done it!) but there are additional tricks one does there that ISLE can't express.

In addition to that, on a more subjective level, I was starting to approach and slightly exceed my complexity-budget comfort level in that branch ("is this really better than hand-coding X...?").

So I think I want to conclude now, given the few weeks' experimentation here, that the analyses should not (yet) be in ISLE, though the mid-end rewrites can probably still be, as the language is explicitly a pattern-rewriting language now. In the fullness of time, we might be able to revisit this, and get the benefits (chiefly: fusing with lowering, and ability to formally verify analyses); but let's not force it before its time.

(I'll leave this issue open as an "enhancement" in the tracker to keep these ideas around for that future time!)

view this post on Zulip Wasmtime GitHub notifications bot (Nov 02 2022 at 16:22):

fitzgen commented on issue #4129:

I think we can close this? We have a (Rust, not ISLE) framework with the recent e-graphs stuff.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 02 2022 at 17:05):

cfallin commented on issue #4129:

Yes, I think so; we've found that the best balance of design concerns here lands at in-Rust analyses, but we have a general forward-direction analysis framework now, so I'll close this.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 02 2022 at 17:05):

cfallin closed issue #4129:

As part of #4128, we should develop a lazy analysis framework that permits us to easily compute properties of CLIF values, operators, or program points between operators (depending on the analysis). This framework should accept pluggable lattice types, lattice meet functions, and transfer functions, ideally permitting these to be written in ISLE.

We should look into the following ideas:


Last updated: Dec 23 2024 at 13:07 UTC