Various patches are going in to improve IR efficiency, which is super exciting. I just saw this one which is another nice step forward. At this point, my favorite workload is bottlenecked on three things (listed in order of “hotness”):
-
Non-empty
StringAttr::get
- there are some minor optimizations that are probably possible here, but this really needs a concurrent hash table to make major gains with. These things are for string attributes on operations, so these inherently need to be StringAttr’s. -
Non-empty
DictionaryAttr::get
- This is predominantly for the attribute dictionary at the top level of an operation. For example, thestd.constant
op has a “value” attribute that stores the value of the constant. This is represented with an extra level of DictionaryAttr that holds a single entry{"value"=<whatever>}
, and that DictionaryAttr needs to be allocated and uniqued. -
OperandRange is very hot as are getOperand calls because of how Operation is laid out. There has been some discussion about rearranging this so that Use records are at a constant offset from “Operation::this” and successors/regions are at variable offsets.
I’d like to talk about the second one here: it is really wasteful in both time and memory to create and store the extra level of DictionaryAttr, and it is also inefficient to query this thing “by string”, and there is a fixed arity of these attributes. Has anyone thought about ways of flattening this into an Operation and making it indexed by integer instead of looked up by string? We could keep the DictionaryAttr around for non-defined attributes like dialect attributes.
-Chris