In .mlir modules with large amounts of attributes, e.g. a function with a larger number of argument attributes, the string comparison filtering greatly affects compile time. This revision switches to using a SmallDenseSet in these situations, resulting in over a 10x speed up in some situations.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/IR/AsmPrinter.cpp | ||
---|---|---|
451 | NamedAttribute are keyed on identifier, which are allowing pointer hashing/comparison instead of string, can you use these in the DenseSet? |
mlir/lib/IR/AsmPrinter.cpp | ||
---|---|---|
451 | elidedAttrs is an array of StringRef, so we would have to unique identifiers for each of them. The additional overhead of uniquing elidedAttrs is noticeable, and DenseSet<StringRef> ends up being faster(~200-250 ms). |
mlir/lib/IR/AsmPrinter.cpp | ||
---|---|---|
451 | Surprising to me, it is because we have a lock in the context when retrieving the Identifiers from the elidedAttr? |
mlir/lib/IR/AsmPrinter.cpp | ||
---|---|---|
451 | Actually there would be two hashes using Identifier: one to convert the StringRef to an Identifier, and then another one to hash the Identifier pointer to insert in the DenseSet... |
mlir/lib/IR/AsmPrinter.cpp | ||
---|---|---|
451 | I think it is a combo of all of the above, multiple hashes+locking+etc. |
NamedAttribute are keyed on identifier, which are allowing pointer hashing/comparison instead of string, can you use these in the DenseSet?