util: Add function print information about a ralloc tree
In release mode print the ralloc tree header pointers. In debug mode,
will look at the child allocations recursively checking for the canary
values. In most cases this should work and give us extra information
about the type of the subtree (GC, Linear) and the allocation sizes.
For example, calling it at the end of spirv_to_nir() will output the
following tree with a summary at the end (lines elided to focus on the
general structure of the output)
```
0xca8d00 (472 bytes)
0xdf2c60 (32 bytes)
0xdf2c00 (32 bytes)
0xdf2ba0 (32 bytes)
0xdf2b40 (32 bytes)
(...)
0xcde8b0 (64 bytes)
0xcde760 (72 bytes)
0xd2de40 (168 bytes)
0xcce660 (64 bytes)
0xcce510 (72 bytes)
0xcce5a0 (120 bytes)
0xcce490 (64 bytes)
(...)
0xcbc450 (456 bytes)
0xdf55c0 (160 bytes)
0xdf5730 (72 bytes)
0xdf57c0 (80 bytes)
0xdf5530 (72 bytes)
0xdf56a0 (80 bytes)
(...)
0xcbe840 (128 bytes)
0xcc4310 (4 bytes)
0xcbc660 (536 bytes) (gc context)
0xde6b40 (32576 bytes) (gc slab or large block)
0xddb160 (32704 bytes) (gc slab or large block)
0xdc8d50 (32704 bytes) (gc slab or large block)
(...)
0xcde9a0 (32704 bytes) (gc slab or large block)
0xcd6720 (32704 bytes) (gc slab or large block)
0xcce6e0 (32768 bytes) (gc slab or large block)
0xcbc330 (72 bytes)
0xd680a0 (208 bytes)
0xca9010 (78560 bytes)
0xca8f20 (176 bytes)
==== RALLOC INFO ptr=0xca8d30 info=0xca8d00
ralloc allocations = 4714
- linear = 0
- gc = 23
- other = 4691
content bytes = 1055139
ralloc metadata bytes = 226272
linear metadata bytes = 0
====
```
There's a flag to pass so only the summary at the end is printed.
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25482>