[Mesa-dev] [PATCH 2/2] i965: perf: reduce i965 binary size

Kenneth Graunke kenneth at whitecape.org
Mon Mar 19 21:19:58 UTC 2018


On Friday, March 16, 2018 8:03:59 AM PDT Lionel Landwerlin wrote:
> Performance metric numbers are calculated the following way :
> 
>    - out of the 256 bytes long OA reports, we accumulate the deltas
>      into an array of uint64_t
> 
>    - the equations' generated code reads the accumulated uint64_t
>      deltas and normalizes them for a particular platforms
> 
> Our hardware is such that a number of counters in the OA reports
> always return the same values (i.e. they're not programmable), and
> they return the same values even across generations, and as a result a
> number of equations are identical in different metric sets across
> different generations.
> 
> Up to now we've kept the generated code of the equations separated in
> different files (per generation/GT), and didn't apply any
> factorization of the common equations. We could have make some
> improvement by reusing equations within a given metrics file, but we
> can go even further and reuse across generations (i.e. all files).
> 
> This change changes the code generation to emit a single file in which
> we reuse equations emitted code based on the hash of equations'
> strings.
> 
> Here are the savings in a meson build :
> 
> Before :
>    $ du -h ./build/src/mesa/drivers/dri/libmesa_dri_drivers.so ./build/src/mesa/drivers/dri/libmesa_dri_drivers.so.old
>    43M	./build/src/mesa/drivers/dri/libmesa_dri_drivers.so
>    47M	./build/src/mesa/drivers/dri/libmesa_dri_drivers.so.old
> 
>    $ size build/src/mesa/drivers/dri/libmesa_dri_drivers.so build/src/mesa/drivers/dri/libmesa_dri_drivers.so.old
>        text   data          bss	     dec            hex filename
>    13054002 409424	 671856	14135282	 d7aff2	build/src/mesa/drivers/dri/libmesa_dri_drivers.so
>    14550386 409552	 671856	15631794	 ee85b2	build/src/mesa/drivers/dri/libmesa_dri_drivers.so.old
> 
>    $ size build/src/mesa/drivers/dri/libmesa_dri_drivers.so
>      text	   data	    bss	    dec	    hex	filename
>      14550386	 409552	 671856	15631794 ee85b2	build/src/mesa/drivers/dri/libmesa_dri_drivers.so
> 
> As a side comment here is the size of the drivers if we remove all of
> the metrics from the build :
> 
>    $ du -sh build/src/mesa/drivers/dri/libmesa_dri_drivers.so
>    40M	build/src/mesa/drivers/dri/libmesa_dri_drivers.so
> 
> v2: Fix an issue with hashing of counter equations (Lionel)
>     Build system rework (Emil)
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> Reviewed-by: Emil Velikov <emil.velikov at collabora.com> (build system part)

This is a good idea and your Python changes all looked reasonable.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180319/c62f9165/attachment.sig>


More information about the mesa-dev mailing list