calyxir/calyx

Toplevel `ref` cells are not kept after `compile_invoke` pass

Closed this issue · 1 comments

The external-to-ref PR #1952 also removed a well-formedness check so that toplevel components can now contain ref cells. In terms of eventually deprecating @external in favor of ref, it seems like we may want to change the behavior of how the compiler handles ref cells in the toplevel in particular. Namely, the standard compilation currently removes these cells from the top level, so that they are not part of the components' struct. I believe this removal happens in the compile_invoke pass, but I'm not certain about that.

To keep ref in line with how @external behaves, I think it would make sense to both raise the ports of cells to the toplevel, and keep them in the struct. This is in line with how @external doesn't cause cell removal from toplevel components.

In terms of immediate consequences, this would allow yxi to interface with programs that have ref cells in their toplevel, as yxi relies on traversing through memory cells to determine the interface of a program.

Unfortunately this means that #1932 should be reopened.

I think this can be closed as it does not block yxi from finding ref memories anymore since it was moved to a standalone tool #2125.