[Mesa-dev] [PATCH] anv: Disable __gen_validate_value if NDEBUG is set.

Kenneth Graunke kenneth at whitecape.org
Fri Jun 8 08:25:20 UTC 2018


On Thursday, June 7, 2018 4:46:24 PM PDT Jason Ekstrand wrote:
> On Thu, Jun 7, 2018 at 4:02 PM, Kenneth Graunke <kenneth at whitecape.org>
> wrote:
> 
> > We were enabling undefined memory checking for genxml values based on
> > Valgrind being installed at build time, even for release builds.  This
> > generates piles and piles of assembly whenever you touch genxml.
> >
> > With gcc 7.3.1 and -O3 and -march=native on a Kabylake with Valgrind
> > installed at build time:
> >
> >       text    data    bss     dec    hex filename
> >    5978385  262884  13488 6254757 5f70a5 libvulkan_intel.so
> >    3799377  262884  13488 4075749 3e30e5 libvulkan_intel.so
> >
> > That's a 36% reduction in text size.
> > ---
> >  src/intel/vulkan/anv_private.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> >  Eric,
> >
> >  You probably will want to make the equivalent change in
> >  src/broadcom/cle/v3d_packet_helpers.h
> >
> >  --Ken
> >
> > diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_
> > private.h
> > index b47420f89ec..b035bf1c943 100644
> > --- a/src/intel/vulkan/anv_private.h
> > +++ b/src/intel/vulkan/anv_private.h
> > @@ -36,7 +36,9 @@
> >  #include <valgrind.h>
> >  #include <memcheck.h>
> >  #define VG(x) x
> > +#ifndef NDEBUG
> >  #define __gen_validate_value(x) VALGRIND_CHECK_MEM_IS_DEFINED(&(x),
> > sizeof(x))
> > +#endif
> >
> 
> We could probably be fancier if we wanted to and disable all valgrind
> checks in release builds but this should take care of the hot-paths and
> leave us with at least something in release builds.
> 
> Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

Yeah, we could...I think we probably still want to record mappings
so that valgrind works on people's applications (without reporting
a million errors from the driver).  But we don't need to do our own
internal validation...

--Ken
-------------- 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/20180608/804945d1/attachment.sig>


More information about the mesa-dev mailing list