[Mesa-dev] [PATCH v2 0/9] Unit tests for minmax optimization pass

Iago Toral Quiroga itoral at igalia.com
Tue Sep 30 23:35:36 PDT 2014


This addresses review feedback for the original series sent by Petri:
http://lists.freedesktop.org/archives/mesa-dev/2014-July/064222.html

I have already sent a new version of the first patch in that series that
implements the optimization pass, and has already been reviewed. This series
addresses feedback from Dylan Baker for the remaining patches that implement
the unit tests as well as new tests for mixed vectors (since now we can do
some optimizations for those).

The changes are:

* Patch 2: glsl: Refactor the python test case generator

- Fix copyright
- Formatting of comments and blank lines to ease readability.
- Consider using shlex.split instead of quote_word

Petri suggested that these changes went in a separate patch, since
the original only moved code that already existed from one place to another,
so the patch that implements these cleanups in this series is
patch 8: glsl: test case generator cleanups.

Notice that I did not do the last item about shlex.split because I think
shlex.split is not what we need. We  need to escape parameters for the bash
command and that may involve adding and/or escaping quotes and shlex.split
will not do that. I can replace the call to quote_word (and hence remove its
definition) by simply doing this:

return ' '.join('"{0}"'.format(word.replace("'", "'\"'\"'")) for word in args

but I am not sure if this covers all the cases we need, so I did not do it,
even when it does work for the few unit tests we have at the moment. Please let
me know if we want this better than using quote_word.

I am not very familiar with python, so maybe someone else can suggest a
better implementation for this.

* Patch 3: glsl: Make compare_ir sort expression operands for commutative
operations

- Make constants all caps and put them at the top of the file, following
python style.


* Patch 9: Add tests for minmax prune

- Rewrite the tests now that we can do some optimization for mixed vectors.
Specifically, test that we can reduce trees of minmax expressions that
operate on constant vectors, even when some components compare as less and
some as greater (mixed), to constants.

- Remove unnecessary imports, fix single-line strings to single quotes
instead of triple quotes and use enumerate for loop counters.

The rest of patches in the series have not been modified, but need to
get a Reviewed-by too.

Iago Toral Quiroga (1):
  glsl: test case generator cleanups

Petri Latvala (8):
  glsl: Fix directory handling in optimization-test
  glsl: Refactor the python test case generator
  glsl: Make compare_ir sort expression operands for commutative
    operations
  glsl: Generalize assignment and declaration IR sexp creation functions
  glsl: Add const_vec4 IR sexp creation function to
    test_case_generator.py
  glsl: Add min and max IR sexp creation functions to
    test_case_generator.py
  glsl: Add support for do_minmax_prune in test_optpass
  glsl: Add tests for minmax prune

 src/glsl/test_optpass.cpp                       |   2 +
 src/glsl/tests/compare_ir                       |   4 +-
 src/glsl/tests/lower_jumps/create_test_cases.py | 336 +++------------------
 src/glsl/tests/minmax/.gitignore                |   3 +
 src/glsl/tests/minmax/create_test_cases.py      | 142 +++++++++
 src/glsl/tests/optimization-test                |   2 +-
 src/glsl/tests/sexps.py                         |  37 +++
 src/glsl/tests/test_case_generator.py           | 371 ++++++++++++++++++++++++
 8 files changed, 599 insertions(+), 298 deletions(-)
 create mode 100644 src/glsl/tests/minmax/.gitignore
 create mode 100644 src/glsl/tests/minmax/create_test_cases.py
 create mode 100644 src/glsl/tests/test_case_generator.py

-- 
1.9.1



More information about the mesa-dev mailing list