Skip to content

Support all Midgard GPUs

Antonio Caggiano requested to merge fix-counter-names into master

Get rid of counter enum as it is not flexible enough for all GPUs. Even between GPUs of the same family it is quite difficult to make it work with a single shared collection of counters. Therefore we introduce a struct Counter which stores useful information, like its offset within other counters, block it belongs to, and name.

With this struct Counter, it is not possible to subdivide counters in blocks as before. Therefore I simplify enum CounterBlocks by using the same subdivision as mali_counter_names.h. With this technique, we can derive the block a counter belongs to by its offset.

About the value of a counter: I now make use of std::variant, which can be either an integer or a floating point type according to the counter.

The function to retrieve the value of a counter within counters memory is now a member of struct Counter, named getter. It has a default value, default_getter, which uses a counter's offset and block id to find its value within a device counters memory dump. The idea is that in order to create a derived counter, one could use a different calculation strategy by assigning another function to Counter::getter.

E.g. Here I use lambdas to declare different strategies for calculating the value of a derived counter. Lambdas are extremely useful in this context as they can capture the counters they depend on.

Edited by Antonio Caggiano

Merge request reports