EPFL-LAP / dynamatic

DHLS (Dynamic High-Level Synthesis) compiler based on MLIR
Other
61 stars 19 forks source link

Add support infrastructure for associating attributes to operands #46

Closed lucas-rami closed 1 year ago

lucas-rami commented 1 year ago

MLIR attributes only attach to operations, not SSA values. However, in our compilation flow, we regularly want to attach attributes to individual channels (here defined as one use of an SSA value i.e., an mlir::OpOperand). For example, in the context of buffer placement, individual channels may have specific buffering properties which need to be stored in the IR.

We already have partial support for associating attributes to channels as part of the buffer placement infrastructure. Here, channel-specific buffering properties are internally stored in a handshake::OpBufPropsAttr attribute--itself a map from result index to handshake::ChannelBufPropsAttr--attached to the operation that produces the corresponding SSA value. Dynamatic already contains abstractions that present those attributes as if they were really attached to SSA values rather than operations and handle attribute storage automatically in the background. This buffer placement-specific logic should be