Skip to content

Benchmarks need to track size and memory use metrics #7972

Closed as not planned
Closed as not planned

Description

@stellaraccident

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)
  • Peak memory usage
  • Others?

Activity

  1. ScottTodd commented on Dec 28, 2021

    @ScottTodd
    Member

    Duplicate of #6161

  2. benvanik commented on Dec 28, 2021

    @benvanik
    Collaborator

    +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):
    image
    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.

  3. added
    infrastructure
    and removed on Jun 13, 2022
  4. moved this from Not Started to Inbox in (Deprecated) IREEon Apr 5, 2023
  5. allieculp commented on Apr 10, 2023

    @allieculp

    Sending to backlog due to the date of the issue - please reprioritize if needed.

  6. moved this from Inbox to Backlog in (Deprecated) IREEon Apr 10, 2023
  7. ScottTodd commented on Apr 10, 2023

    @ScottTodd
    Member

    This was a duplicate of #6161 - let's just close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    infrastructure

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions