Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Binary expression tree calculator #647

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

breiters
Copy link

@breiters breiters commented Nov 18, 2024

This replaces the stack-based calculator with a binary expression tree (as discussed at SC'23).

  • The tree is constructed only once per metric at the point of time when a perfgroup is read. It can then be evaluated arbitrarily often with varying counter values.
  • According to my (very basic) measurements, it speeds up formula evaluation by a factor of x5 - x15 (depending on the formula) on my laptop: (e.g. 1833 cycles (tree-based) vs. 25909 cycles (stack-based) to evaluate the (Zen2) formula: Memory data volume [GBytes] 1.0E-09*(DFC0+DFC1)*(4.0/(num_numadomains/num_sockets))*64.0)
  • Currently, only addition, subtraction, multiplication, and division are implemented. Can be extended (if required at all)

TODOs:

  • Implement proper error handling (currently marked as comment with TODO, or implemented with exit(EXIT_FAILURE)) Need some help / discussion here
  • Test correctness (currently both, the stack-based method and the expression tree method, are applied and the program exits if the results don't match)
  • Remove stack-based code if the code changes are accepted
  • Write interface documentation for expression tree interfaces
  • Adopt LIKWID code style? Need some help / discussion here
  • Move finding of counter index in index list to tree building phase (iff possible) Need some help / discussion here
  • Possibly replace the three arrays metricnames, metricformulas, metrictrees in the GroupInfo struct with one array of type struct metric. This would simplify the code, make it more clear, and less error-prone. Need some help / discussion here

@breiters breiters marked this pull request as ready for review November 18, 2024 18:02
@breiters breiters marked this pull request as draft November 18, 2024 19:06
This replaces the stack-based calculator with a binary expression tree. The tree is constructed only once per metric when a perfgroup is read and can be evaluated arbitrarily often.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant