Skip to content

DmdAnal: Implement Boxity analysis

In an attempt to fix #19407 (closed), I opened !5624 (closed). But while writing up !5624 (closed), it became increasingly clear that it would just be a stop gap solution and what we really want is a boxity analysis. E.g., an analysis that determines which parts of parameters will still be needed boxed after WW, so that we don't unbox them in the first place. We believe that this will fix #19407 (closed) once and for all.

In !5624 (comment 351008), Simon proposes the following:

As you say, this is not very satisfying. How about this instead

data SubDemand
  = ...
  | Prod Boxity ![Demand]

data Boxity = BoxNeeded | BoxDiscarded

Let's use "P" for Prod BoxDiscarded and "Q" for Prod BoxDiscarded.

Now in Note [Turn LP(A) into LP(M) in signatures] we can give g a signature of

<1P(1,A,...,A)>   <LQ(A,1)>

by changing that top-level P to a Q when committing g's signature. (I.e. same idea: do something special when commiting to a signature.)

Now in both we return BoxNeeded if either side is BoxNeeded. For lub it's more of a tossup.

When doing w/w we don't take apart if we see BoxNeeded.

This amounts a adding a simple boxity analysis, but just by adding one bit to Prod which seems pretty non-invasive.

Let's try that.

Edited by Sebastian Graf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information