EPFL-LAP / dynamatic

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

[Buffer Placement] Add CFDFC Extraction and throughput resutls as attributes of handshake dialect #105

Open qianxu1998 opened 1 month ago

qianxu1998 commented 1 month ago

This PR adds two attributes for the handshake dialect to store the CFDFC extraction and throughput results during the buffer placement pass.

The following two dictionary attributes are defined in HandshakeAttributes.td:

Jiahui17 commented 1 month ago

I did the following:

--- info.funcOp->setAttr("handshake.cfdfc", cfdfcMap);
+++ setUniqueAttr(info.funcOp, cfdfcMap);

This makes it easier to retrieve the value later like the following:

DictionaryAttr dicAttr =
    getUniqueAttr<handshake::CFDFCThroughputAttr>(funcOp)
        .getThroughputMap();
for (const NamedAttribute attr : dicAttr) {
  StringRef cfId = attr.getName();
  FloatAttr cfThroughput = llvm::dyn_cast<FloatAttr>(attr.getValue());
  llvm::errs() << "CFDFC " << cfId << "=" << cfThroughput.getValueAsDouble() << "\n";
}

Otherwise, we need to remember that there is an attribute called "handshake.cfdfc". But here we can get it as a unique attribute.