You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Benchmarks need to track size and memory use metrics #7972
We're solidly in optimization territory that is not just latency sensitive but size and memory usage sensitive. In order to avoid bad optimizations, we need to be tracking:
Compiled artifact size
Initial memory usage and initialization latency (some optimizations move parts of the computation to initialization time)
Particularly on some backends this init cost can be very high; like this is vulkan on android (1092ms compiling shaders, 47ms executing, and webgpu/wasm/metal will be similar):
We're going to need to focus on reducing our total executable count at some point as binary size and init time scale nonlinearly with the total number (which also useful to track, but not the whole story, and some platforms are particularly hurt more). We can also do things like deriving pipelines/specialization that may speed things up or performing shader compilation on multiple threads, but the biggest and best lever is always total count.
For memory usage we have the stats API we need exposed here (and can add more fields): https://github.com/google/iree/blob/79a03bed8f78ac914386616fb96df0ab6985342d/iree/hal/allocator.h#L98-L105
We can query before/after init, etc. Today we are pretty good about being net 0 per invocation (ignoring I/O) but things like the caching allocator break the assumptions there and as we do more pooling allocator work we'll want to have that tracked. Really easy to make an allocator that goes really fast by allocating all the memory on your machine and that kind of behavior often gets ignored when only looking at individual invocation times.
Another useful metric is compiled artifact entropy (using something like https://www.fourmilab.ch/random/ which is just apt install ent, or the primitive way of gzipping and looking at the delta). This lets us know if we are including a bunch of padding, expanding constants that are mostly uniform values (like tensor<4096x4096xf32> where only the first element is non-zero), etc.
Activity
ScottTodd commentedon Dec 28, 2021
Duplicate of #6161
benvanik commentedon Dec 28, 2021
+1!
Particularly on some backends this init cost can be very high; like this is vulkan on android (1092ms compiling shaders, 47ms executing, and webgpu/wasm/metal will be similar):

We're going to need to focus on reducing our total executable count at some point as binary size and init time scale nonlinearly with the total number (which also useful to track, but not the whole story, and some platforms are particularly hurt more). We can also do things like deriving pipelines/specialization that may speed things up or performing shader compilation on multiple threads, but the biggest and best lever is always total count.
For memory usage we have the stats API we need exposed here (and can add more fields): https://github.com/google/iree/blob/79a03bed8f78ac914386616fb96df0ab6985342d/iree/hal/allocator.h#L98-L105
We can query before/after init, etc. Today we are pretty good about being net 0 per invocation (ignoring I/O) but things like the caching allocator break the assumptions there and as we do more pooling allocator work we'll want to have that tracked. Really easy to make an allocator that goes really fast by allocating all the memory on your machine and that kind of behavior often gets ignored when only looking at individual invocation times.
Another useful metric is compiled artifact entropy (using something like https://www.fourmilab.ch/random/ which is just
apt install ent, or the primitive way of gzipping and looking at the delta). This lets us know if we are including a bunch of padding, expanding constants that are mostly uniform values (like tensor<4096x4096xf32> where only the first element is non-zero), etc.allieculp commentedon Apr 10, 2023
Sending to backlog due to the date of the issue - please reprioritize if needed.
ScottTodd commentedon Apr 10, 2023
This was a duplicate of #6161 - let's just close it.