This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Interfaces] Optimize the implementation of InterfaceMap to reduce generated code size.
ClosedPublic

Authored by rriddle on Oct 23 2020, 4:52 PM.

Details

Summary

An InterfaceMap is generated for every single operation type, and is responsible for a large amount of the code size from MLIR given that its internals highly utilize templates. This revision refactors the internal implementation to use bare malloc/free for interface instances as opposed to static variables and moves as much code out of templates as possible. This led to a decrease of over >1mb (~12% of total MLIR related code size) for a downstream MLIR library with a large amount of operations.

Depends On D90085

Diff Detail

Event Timeline

rriddle created this revision.Oct 23 2020, 4:52 PM
rriddle requested review of this revision.Oct 23 2020, 4:52 PM
jpienaar accepted this revision.Oct 26 2020, 5:08 PM
jpienaar added inline comments.
mlir/include/mlir/Support/InterfaceSupport.h
185

Could this just be a range loop?

This revision is now accepted and ready to land.Oct 26 2020, 5:08 PM
rriddle updated this revision to Diff 301114.Oct 27 2020, 4:03 PM
rriddle marked an inline comment as done.

Rebase

This revision was landed with ongoing or failed builds.Oct 27 2020, 4:21 PM
This revision was automatically updated to reflect the committed changes.