Open qianxu1998 opened 4 months 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.
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
:CFDFCToBBListAttr
: Holds a map from CFDFC index to the corresponding list of BB indices. For example{"0" : [1, 2], "1" : [3, 4, 5]}
, means CFDFC 0 contains BB 1 and BB 2, and CFDFC 1 contains BB 3, BB 4 and BB 5.CFDFCThroughputAttr
: Holds a map from CFDFC index to the corresponding throughput value (floating value). For example, {"0" : 0.5, "1": 0.25}. This means CFDFC 0 has a throughput of 0.5 and CFDFC 1 has a throughput of 0.25.Buffer placement pass is changed accordingly to add those two attributes directly in the funcop.
CFDFCToBBListAttr
is named ashandshake.cfdfc
andCFDFCThroughputAttr
is named ashandshake.tp
. Taking fir as an example, after adding the two attributes the top of the generatedhandshake_buffered.mlir
looks like: