This is an archive of the discontinued LLVM Phabricator instance.

[mlir][dataflow] Unify dependency management in AnalysisState.
ClosedPublic

Authored by phisiart on Jun 29 2023, 4:55 PM.

Details

Summary

In the MLIR dataflow analysis framework, when an AnalysisState is updated, it's dependents are enqueued to be visited.

Currently, there are two ways dependents are managed:

  • AnalysisState::dependents stores a list of dependents. DataFlowSolver::propagateIfChanged() reads this list and enqueues them to the worklist.
  • AnalysisState::onUpdate() allows custom logic to enqueue more to the worklist. This is called by DataFlowSolver::propagateIfChanged().

This cleanup diff consolidates the two into AnalysisState::onUpdate(). This way, DataFlowSolver does not need to know the detail about AnalysisState::dependents, and the logic of dependency management is entirely handled by AnalysisState.

Diff Detail

Event Timeline

phisiart created this revision.Jun 29 2023, 4:55 PM
Herald added a project: Restricted Project. · View Herald Transcript
phisiart requested review of this revision.Jun 29 2023, 4:55 PM
phisiart edited the summary of this revision. (Show Details)Jun 29 2023, 5:02 PM
phisiart edited reviewers, added: Mogball; removed: aartbik.Jun 29 2023, 5:02 PM
phisiart retitled this revision from MLIR dataflow analysis API: unify dependency management in AnalysisState. to [mlir][dataflow] Unify dependency management in AnalysisState..Jun 29 2023, 5:04 PM
Mogball accepted this revision.Jun 29 2023, 10:44 PM

Much better, thanks!

mlir/include/mlir/Analysis/DataFlowFramework.h
302

Please spell out this auto. The MLIR guidelines for using auto are that:

  1. The type is visible verbatim on the RHS, like auto thing = dyn_cast<Thing>(foo) or
  2. It's "too complicated", like std::vector<FooBar>::iterator.
This revision is now accepted and ready to land.Jun 29 2023, 10:44 PM
phisiart updated this revision to Diff 536516.Jun 30 2023, 11:05 PM

Explicitly spell out WorkItem instead of auto.

phisiart marked an inline comment as done.Jun 30 2023, 11:06 PM

@Mogball Hi, I don't have commit access. Could you commit this patch for me? Thanks!

@phisiart Yes. Also you should email chris and ask for commit access

This revision was automatically updated to reflect the committed changes.