[Mesa-dev] Let's talk about -DDEBUG

Dylan Baker dylan at pnwbakers.com
Fri Dec 14 17:37:46 UTC 2018


Quoting Tapani Pälli (2018-12-14 05:03:06)
> 
> 
> On 12/14/18 12:53 PM, Erik Faye-Lund wrote:
> > On Thu, 2018-12-13 at 10:46 -0800, Eric Anholt wrote:
> >> Dylan Baker <dylan at pnwbakers.com> writes:
> >>
> >>> [ Unknown signature status ]
> >>> In the autotools discussion I've come to realize that we also need
> >>> to talk about
> >>> the -DDEBUG guard. It seems that there are two different uses, and
> >>> thus two
> >>> different asks about it:
> >>>
> >>> - Nine (and RadeonSI?) use -DDEBUG to hide generic debugging
> >>> - NIR and Intel (at least) use -DDEBUG to hide really expensive
> >>> checks that are
> >>>    useful, but necessarily tank performance.
> >>>
> >>> The first group would like -DDEBUG in debugoptimized builds, the
> >>> second
> >>> obviously doesn't.
> >>>
> >>> Is the right solution to move the first group being !NDEBUG, or
> >>> would it be
> >>> better to split DEBUG into two different defines such as
> >>> DEBUG_MESSAGES and
> >>> EXPENSIVE_VALIDATION (paint the bikeshed whatever color you like),
> >>> with the
> >>> first for both debug and debugoptimized and the second only in
> >>> debug builds?
> >>
> >> I would like to see NIR validation in debugoptimized builds (which is
> >> the build I use on a regular basis: "please catch all bugs you can at
> >> runtime with asserts, but don't waste CPU time by compiling with
> >> -O0");
> >>
> > 
> > I'm starting to think that we should add explicit options (with
> > reasonable defaults based on ) for things like nir validation. That way
> > it'd be easy for anyone to pimp their buildtype. Meddling directly with
> > CFLAGS feels kinda hacky for something as useful like this.
> > 
> > Something like this?
> 
> Looks nice and is easy to understand. IMO something like 
> 'ENABLE_ASSERTS' would be also much more easier/straightforward than 
> using "-Db_ndebug=false", here I'm thinking about the bug reporters.

I really wish meson wouldn't have called this -Db_ndebug and would have had
something like -Db_asserts, but historical artifacts live on...

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181214/138bbcad/attachment.sig>


More information about the mesa-dev mailing list