[Mesa-dev] [PATCH 0/7] nir: Go on a diet!

Jason Ekstrand jason at jlekstrand.net
Fri May 27 01:30:30 UTC 2016


I was poking around with build sizes yesterday and realized that NIR, even
when built with -Os, is over 1 MB.  That seemed a bit insane (libLLVM.so
is only 37 MB on my system) so I went digging for places where we may be
able to save a few KB.  The first two patches just shrink some datatypes so
that the alu and intrinsic info tables are a bit smaller.  The other 5
are some size optimizations that shrink nir_opt_algebraic.o from 280KB to
44KB when built with -Os.

I'm a bit unsure of what I think about the nir_opt_algebraic changes with
"compact" expressions.  They do shrink things by *a lot* but they also make
it a bit more complicated (as if nir_search weren't complicated enough).
In particular, it means that if add a field to one of the Python classes
representing a variable, constant, or expression and don't properly add it
to the implementaiton of __eq__, strange hard-to-debug things may happen.
I'll let someone other than myself decide whether or not they think it's
horrid.

Jason Ekstrand (7):
  nir: Use uint8_t instead of unsigned for nir_intrinsic_info fields
  nir: Use uint8_t for nir_op_info fields
  nir/search: Make nir_replace_instr take a value for the search
    expression
  nir/search: Use bitfields to shrink struct sizes
  nir/search: Add support for "compact" expressions
  nir/algebraic: Make objects hashable
  nir/algebraic: Use compact expressions and don't emit duplicates

 src/compiler/nir/nir.h            |  18 ++--
 src/compiler/nir/nir_algebraic.py | 173 ++++++++++++++++++++++++++++----------
 src/compiler/nir/nir_search.c     |  78 ++++++++++++-----
 src/compiler/nir/nir_search.h     |  40 +++++++--
 4 files changed, 225 insertions(+), 84 deletions(-)

-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list