This is an archive of the discontinued LLVM Phabricator instance.

Fix quadratic behavior from Operation::setAttr() (NFC)
ClosedPublic

Authored by mehdi_amini on May 19 2023, 1:11 PM.

Details

Summary

This API tries to ensure some backward compatibility for properties,
but doing so in multiple-layers was causing quadratic behavior.
Instead of setAttrs() repeatingly calling to setAttr() we inline
the logic and apply it locally in a single traversal.

Fixes #62800

Diff Detail

Event Timeline

mehdi_amini created this revision.May 19 2023, 1:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2023, 1:11 PM
mehdi_amini requested review of this revision.May 19 2023, 1:11 PM
matthiaskramm added inline comments.May 19 2023, 1:29 PM
mlir/lib/IR/Operation.cpp
308

"discardable" sounds odd to me, in this context.

"nonInherentAttrs"?

mehdi_amini added inline comments.May 19 2023, 1:34 PM
mlir/lib/IR/Operation.cpp
308

This is the official terminology, this class as methods setDiscardableAttrs() (which does not do this filtering): the plan is to deprecate setAttrs() and redirect users to setDiscardableAttrs() (and handle properties separately).

308

See https://mlir.llvm.org/docs/LangRef/#attributes (search for "discardable" there)

matthiaskramm accepted this revision.May 19 2023, 1:46 PM

Thanks for fixing this issue!

mlir/lib/IR/Operation.cpp
308

Ok, thanks for clarifying!

This revision is now accepted and ready to land.May 19 2023, 1:46 PM
This revision was landed with ongoing or failed builds.May 19 2023, 2:02 PM
This revision was automatically updated to reflect the committed changes.