Commit 7db02782 authored by Robert Bradshaw's avatar Robert Bradshaw

More non-determanism fixes.

parent 64a34cf2
......@@ -1324,7 +1324,7 @@ class GlobalState(object):
for py_string in c.py_strings.values():
py_strings.append((c.cname, len(py_string.cname), py_string))
for c, cname in self.pyunicode_ptr_const_index.items():
for c, cname in sorted(self.pyunicode_ptr_const_index.items()):
utf16_array, utf32_array = StringEncoding.encode_pyunicode_string(c)
if utf16_array:
# Narrow and wide representations differ
......
......@@ -1987,7 +1987,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
def create_import_star_conversion_utility_code(self, env):
# Create all conversion helpers that are needed for "import *" assignments.
# Must be done before code generation to support CythonUtilityCode.
for name, entry in env.entries.items():
for name, entry in sorted(env.entries.items()):
if entry.is_cglobal and entry.used:
if not entry.type.is_pyobject:
entry.type.create_from_py_utility_code(env)
......@@ -2016,7 +2016,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
old_error_label = code.new_error_label()
code.putln("if (0);") # so the first one can be "else if"
for name, entry in env.entries.items():
for name, entry in sorted(env.entries.items()):
if entry.is_cglobal and entry.used:
code.putln('else if (__Pyx_StrEq(name, "%s")) {' % name)
if entry.type.is_pyobject:
......
......@@ -7832,7 +7832,7 @@ class ParallelStatNode(StatNode, ParallelNode):
def initialize_privates_to_nan(self, code, exclude=None):
first = True
for entry, (op, lastprivate) in self.privates.items():
for entry, (op, lastprivate) in sorted(self.privates.items()):
if not op and (not exclude or entry != exclude):
invalid_value = entry.type.invalid_value()
......@@ -7874,7 +7874,7 @@ class ParallelStatNode(StatNode, ParallelNode):
"""
self.modified_entries = []
for entry in self.assignments:
for entry in sorted(self.assignments):
if entry.from_closure or entry.in_closure:
self._allocate_closure_temp(code, entry)
......@@ -7899,7 +7899,7 @@ class ParallelStatNode(StatNode, ParallelNode):
self.temps = temps = code.funcstate.stop_collecting_temps()
privates, firstprivates = [], []
for temp, type in temps:
for temp, type in sorted(temps):
if type.is_pyobject or type.is_memoryviewslice:
firstprivates.append(temp)
else:
......@@ -7922,7 +7922,7 @@ class ParallelStatNode(StatNode, ParallelNode):
# Now clean up any memoryview slice and object temporaries
if self.is_parallel and not self.is_nested_prange:
code.putln("/* Clean up any temporaries */")
for temp, type in self.temps:
for temp, type in sorted(self.temps):
if type.is_memoryviewslice:
code.put_xdecref_memoryviewslice(temp, have_gil=False)
elif type.is_pyobject:
......@@ -8094,7 +8094,7 @@ class ParallelStatNode(StatNode, ParallelNode):
c = self.begin_of_parallel_control_block_point
temp_count = 0
for entry, (op, lastprivate) in self.privates.items():
for entry, (op, lastprivate) in sorted(self.privates.items()):
if not lastprivate or entry.type.is_pyobject:
continue
......@@ -8303,7 +8303,7 @@ class ParallelWithBlockNode(ParallelStatNode):
if self.privates:
privates = [e.cname for e in self.privates
if not e.type.is_pyobject]
code.put('private(%s)' % ', '.join(privates))
code.put('private(%s)' % ', '.join(sorted(privates)))
self.privatization_insertion_point = code.insertion_point()
self.put_num_threads(code)
......@@ -8623,7 +8623,7 @@ class ParallelRangeNode(ParallelStatNode):
code.putln("#ifdef _OPENMP")
code.put("#pragma omp for")
for entry, (op, lastprivate) in self.privates.items():
for entry, (op, lastprivate) in sorted(self.privates.items()):
# Don't declare the index variable as a reduction
if op and op in "+*-&^|" and entry != self.target.entry:
if entry.type.is_pyobject:
......
......@@ -223,6 +223,12 @@ class Entry(object):
def all_entries(self):
return [self] + self.inner_entries
def __lt__(left, right):
if isinstance(left, Entry) and isinstance(right, Entry):
return (left.name, left.cname) < (right.name, right.cname)
else:
return NotImplemented
class InnerEntry(Entry):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment