-
Notifications
You must be signed in to change notification settings - Fork 30
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
base: master
Are you sure you want to change the base?
Fix fieldversion2 #1059
Conversation
launch jenkins |
launch jenkins |
There was a problem hiding this 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?
dawn/dawn/src/dawn/Optimizer/PassFieldVersioning.cpp
Lines 240 to 249 in 44770e6
// 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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?
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)) { |
There was a problem hiding this comment.
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.
launch jenkins |
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.
dawn/dawn/src/dawn/Optimizer/PassFieldVersioning.cpp
Line 226 in 30ba6f1
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