Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement weak partial ordering (WPO) of the graph for concurrent fixpoint iteration. #5

Closed
wants to merge 2 commits into from

Conversation

skkeem
Copy link
Contributor

@skkeem skkeem commented Oct 28, 2019

This implements the Weak Partial Ordering (WPO) of a graph that generalizes the WTO.
It can be used to implement concurrent fixpoint iteration algorithms.
It is implemented in an iterative style so that it does not stack overflow during the WPO construction.

  • Test cases are added, including the cases for the irreducible graphs.
  • Ran clang-format to clean up the codes.

Publications:

  • Sung Kook Kim, Arnaud J. Venet, and Aditya V. Thakur. Deterministic Parallel Fixpoint Computation. To appear in POPL 2020
  • preprint: arXiv:1909.05951

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Oct 28, 2019
Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@int3 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@int3 int3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working through the paper, but this looks pretty awesome. Thank you!!

private:
// WPO nodes.
std::vector<WpoNodeT> m_nodes;
// Top level nodes. Nodes that are outside of any component.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Top level nodes. Nodes that are outside of any component.
// Top level nodes: Nodes that are outside of any component.

}

private:
// Construct auxilary data-structures.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/auxilary/auxiliary/

bool is_widening_point() const { return m_widen; }

private:
// Add successor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for comments that state things that are obvious from the code :)


using WpoIdx = uint32_t;

class SimpleGraph2 final {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you factor SimpleGraph from the WeakTopologicalOrderingTest into a separate file and reuse it here?

int i = 0;
std::ostringstream wto;
bool first = true;
while (!wl.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check-properties-and-print-wto-string code seems to be repeated across many tests... could it be factored out?

worklist_h.pop_back();
for (auto p : m_non_back_preds[v]) {
auto rep_p = rep[dsets.find_set(p)];
auto it = nested_SCCs_h.find(rep_p);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The it here will shadow the it in line 412.

@int3
Copy link
Contributor

int3 commented Nov 8, 2019

We've decided to merge this as-is and do the fixups ourselves. Thanks for all your work @skkeem! We're super excited to productionize this :)

facebook-github-bot pushed a commit to facebook/redex that referenced this pull request Nov 8, 2019
…point iteration. (#5)

Summary:
This implements the Weak Partial Ordering (WPO) of a graph that generalizes the WTO.
It can be used to implement concurrent fixpoint iteration algorithms.
It is implemented in an iterative style so that it does not stack overflow during the WPO construction.
- Test cases are added, including the cases for the irreducible graphs.
- Ran clang-format to clean up the codes.

Publications:
- Sung Kook Kim, Arnaud J. Venet, and Aditya V. Thakur. Deterministic Parallel Fixpoint Computation. To appear in POPL 2020
- preprint: [arXiv:1909.05951](https://arxiv.org/abs/1909.05951)
Pull Request resolved: facebook/SPARTA#5

Reviewed By: yuxuanchen1997

Differential Revision: D18169499

Pulled By: int3

fbshipit-source-id: 64fcc87ce94b33c34fdbe89a327ebb7e99b64697
facebook-github-bot pushed a commit to facebook/redex that referenced this pull request Nov 8, 2019
…point iteration. (#5)

Summary:
This implements the Weak Partial Ordering (WPO) of a graph that generalizes the WTO.
It can be used to implement concurrent fixpoint iteration algorithms.
It is implemented in an iterative style so that it does not stack overflow during the WPO construction.
- Test cases are added, including the cases for the irreducible graphs.
- Ran clang-format to clean up the codes.

Publications:
- Sung Kook Kim, Arnaud J. Venet, and Aditya V. Thakur. Deterministic Parallel Fixpoint Computation. To appear in POPL 2020
- preprint: [arXiv:1909.05951](https://arxiv.org/abs/1909.05951)
Pull Request resolved: facebook/SPARTA#5

Reviewed By: yuxuanchen1997

Differential Revision: D18169499

Pulled By: int3

fbshipit-source-id: 64fcc87ce94b33c34fdbe89a327ebb7e99b64697
@facebook-github-bot
Copy link

@int3 merged this pull request in 862564b.

@ssj933
Copy link
Contributor

ssj933 commented Dec 16, 2019

Hi @skkeem , I am not sure if the get_num_outer_preds(WpoIdx exit) funtion is the corresponding method for NumOuterSchedPreds in paper. As I found the result given for one of the node in the following graph doesn't seem to match expectation.

Construct a SimpleGraph2 using following codes:

SimpleGraph2 g;
g.add_edge("1", "12");
g.add_edge("1", "16");
g.add_edge("1", "18");
g.add_edge("1", "26");
g.add_edge("12", "45");
g.add_edge("12", "75");
g.add_edge("12", "46");
g.add_edge("16", "74");
g.add_edge("16", "75");
g.add_edge("18", "92");
g.add_edge("26", "93");
g.add_edge("45", "46");
g.add_edge("46", "47");
g.add_edge("47", "73");
g.add_edge("73", "74");
g.add_edge("73", "75");
g.add_edge("73", "73");
g.add_edge("74", "46");
g.add_edge("75", "45");
g.add_edge("92", "93");
g.add_edge("93", "45");
g.add_edge("93", "46");

WeakPartialOrdering<std::string> wpo(
    "1", [&g](const std::string& n) { return g.successors(n); }, false);

Traverse through the graph and print out get_num_outer_preds for exit nodes, and predecessors of each nodes. The result for exit node with NodeId "46" only have number for head node with NodeId "46". However in the component for exit node with NodeId "46", there is another node with NodeId "74", it have two predecessors in WPO, one is node with NodeId "16" which is outside of the component, another is node with NodeId "73" which is inside of the component, so I think get_num_outer_preds for exit node with NodeId "46" should have node with NodeId "74" have value 1 (but there is no value for node with NodeId "74").
(This could cause some node not been visited because the counter couldn't reach their num_preds after the component didn't stabilize and need to re-run. )

Thanks for your help!

@skkeem
Copy link
Contributor Author

skkeem commented Dec 17, 2019

Hello @ssj933,

Thank you for bringing this to my attention.

wpo.get_num_outer_preds(x)[v] should be equal to NumOuterSchedPreds(v, x) in the paper.

As you have correctly pointed out, wpo.get_num_outer_preds(x_46)[74] (= NumOuterSchedPreds(74, x_46)) should be 1.

I have fixed the bug and added corresponding test cases in PR #7 .

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants