summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorMathieu Bridon <[email protected]>2018-06-27 12:37:38 +0200
committerEric Engestrom <[email protected]>2018-07-05 12:52:12 +0100
commitfe8a153648f98c6dfbb621f31c212253c06f9467 (patch)
tree78b15537997acfd893d35997dd62183516fc0818 /src/compiler
parentd337713ec4f94d5dde101c879fda9c6332a074c3 (diff)
python: Stabilize some script outputs
In Python, dictionaries and sets are unordered, and as a result their is no guarantee that running this script twice will produce the same output. Using ordered dicts and explicitly sorting items makes the build more reproducible, and will make it possible to verify that we're not breaking anything when we move the build scripts to Python 3. Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_algebraic.py3
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index d6784df004e..847c59dbd89 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -25,6 +25,7 @@
from __future__ import print_function
import ast
+from collections import OrderedDict
import itertools
import struct
import sys
@@ -601,7 +602,7 @@ ${pass_name}(nir_shader *shader)
class AlgebraicPass(object):
def __init__(self, pass_name, transforms):
- self.xform_dict = {}
+ self.xform_dict = OrderedDict()
self.pass_name = pass_name
error = False
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index db907df8545..2f1cba398f0 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -23,6 +23,7 @@
# Authors:
# Jason Ekstrand ([email protected])
+from collections import OrderedDict
import nir_algebraic
import itertools
@@ -628,7 +629,7 @@ optimizations = [
'options->lower_unpack_snorm_4x8'),
]
-invert = {'feq': 'fne', 'fne': 'feq', 'fge': 'flt', 'flt': 'fge' }
+invert = OrderedDict([('feq', 'fne'), ('fne', 'feq'), ('fge', 'flt'), ('flt', 'fge')])
for left, right in list(itertools.combinations(invert.keys(), 2)) + zip(invert.keys(), invert.keys()):
optimizations.append((('inot', ('ior(is_used_once)', (left, a, b), (right, c, d))),