-
Notifications
You must be signed in to change notification settings - Fork 6
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
ASTKernel.plan_cpu is not deterministic with Py3 #108
Comments
This is subtle. Can see a nonzero diff with
there is zero diff on
and following does not work
Seems that @5d633c0843434703e2ab87bd0b649112ecc368d5 is not a good patch... |
Mentioned patch probably does not play a role. The problem is that Py3 result is non-deterministic, provbably somewhere else than @5d633c0843434703e2ab87bd0b649112ecc368d5. Py2 seems to be fine. |
Did you verify that the issue (of non-determinism) isn't in TSFC? |
Not really. But without the |
It's hash randomization in python interpreter, see https://docs.python.org/3/using/cmdline.html#cmdoption-R. With |
Then it probably happens through the iteration of a |
Yes, that's a very reasonable explanation. Ugh, that was subtle. |
Preliminary testing suggests that this patch may fix the issue: diff --git a/coffee/rewriter.py b/coffee/rewriter.py
index de9710e..47753df 100644
--- a/coffee/rewriter.py
+++ b/coffee/rewriter.py
@@ -568,7 +568,7 @@ class ExpressionRewriter(object):
self.licm('only_const').licm('only_outlinear')
# Transform the expression based on the sharing graph
- nodes, edges = sgraph.nodes(), sgraph.edges()
+ nodes = [n for n in nodes if n in sgraph.nodes()]
if not (nodes and all(sgraph.degree(n) > 0 for n in nodes)):
self.factorize(mode='heuristic')
self.licm('only_const').licm('only_outlinear') |
Following example produces different code with Py2 and Py3. Note that both work as expected and are validated against other form compilers.
The text was updated successfully, but these errors were encountered: