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

Fix fieldversion2 #1059

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Fix fieldversion2 #1059

wants to merge 5 commits into from

Conversation

cosunae
Copy link
Contributor

@cosunae cosunae commented Nov 10, 2020

Technical Description

Fixes the field version for #1056
The problem is caused by the fact that the algorithm is trying to also fix the cases where the graph does not contains outdegree=0 nodes.

if(stencilSCCs->empty() && !SCCs->empty() && !graph.isDAG()) {

However this can be a normal case, like the example of #1056
Here we fix it by accepting that the graph (that is not a DAG) does not have to contain nodes with outdegree=0 or indegree=0.
Instead we fixed the algorithms that require this condition (see ReadBeforeWriteConflict.cpp)

Resolves / Enhances

#1056

Example

(again) example is in #1056

@cosunae
Copy link
Contributor Author

cosunae commented Nov 10, 2020

launch jenkins

@cosunae
Copy link
Contributor Author

cosunae commented Nov 10, 2020

launch jenkins

Copy link
Contributor

@Stagno Stagno left a comment

Choose a reason for hiding this comment

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

Small changes requested, overall it's ok.

Do we understand now how we could get into this unresolvable race condition, though?

// If the LHSAccessID is not part of the SCC, we cannot resolve the race-condition
for(std::set<int>& scc : *stencilSCCs) {
if(!scc.count(LHSAccessID)) {
if(dump)
graph.toDot("rc_" + instantiation->getName() + ".dot");
reportRaceCondition(statement, *instantiation);
// The function call above throws, so do not need a return here any longer. Will refactor
// further later. return RCKind::Unresolvable;
}
}

I'm still doubtful about that, because dawn will bail out, but a correctly placed kernel-split can always solve a race condition. If it's not possible anymore to reach that condition, then it's dead code.

@@ -96,8 +98,8 @@ class DependencyGraph {
DependencyGraph() = default;

/// @brief Insert a new node
Vertex& insertNode(int ID) {
auto [iter, inserted] = vertices_.emplace(ID, Vertex{adjacencyList_.size(), ID});
Vertex& insertNode(int Value) {
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
Vertex& insertNode(int Value) {
Vertex& insertNode(int value) {

we Capitalize only public members of classes

@@ -68,7 +68,9 @@ class DependencyGraph {
};

protected:
// map of Value (i.e. normally accessID to Vertex object
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
// map of Value (i.e. normally accessID to Vertex object
// map from accessID to Vertex object

Isn't this always the case?
Also the description of Vertex::Value below could be improved ... doesn't it always correspond to an accessID?

Comment on lines 43 to +46
for(int k = 0+0; k <= ( m_k_size == 0 ? 0 : (m_k_size - 1)) + 0+0; ++k) {
for(auto const& loc : getEdges(LibTag{}, m_mesh)) {
m_c_0(deref(LibTag{}, loc), (k + 0)) = m_c(deref(LibTag{}, loc), (k + 0));
} }}{
for(int k = 0+0; k <= ( m_k_size == 0 ? 0 : (m_k_size - 1)) + 0+0; ++k) {
for(auto const& loc : getEdges(LibTag{}, m_mesh)) {
m_a(deref(LibTag{}, loc), (k + 0)) = ((m_b(deref(LibTag{}, loc), (k + 0)) / m_c_0(deref(LibTag{}, loc), (k + 0))) + (::dawn::float_type) 5);
m_a(deref(LibTag{}, loc), (k + 0)) = ((m_b(deref(LibTag{}, loc), (k + 0)) / m_c(deref(LibTag{}, loc), (k + 0))) + (::dawn::float_type) 5);
} for(auto const& loc : getEdges(LibTag{}, m_mesh)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test can be removed then. It was testing that a versioned field was generated, but it's not generated anymore.

@Stagno
Copy link
Contributor

Stagno commented Dec 1, 2020

launch jenkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants