Skip to content

Add a pca-metrics command#315

Merged
fitzgen merged 2 commits into
bytecodealliance:mainfrom
fitzgen:pca-metrics
Jun 22, 2026
Merged

Add a pca-metrics command#315
fitzgen merged 2 commits into
bytecodealliance:mainfrom
fitzgen:pca-metrics

Conversation

@fitzgen

@fitzgen fitzgen commented Jun 8, 2026

Copy link
Copy Markdown
Member

This records various static and dynamic metrics for use in principal component analysis.

Static metrics include:

  • Various entity counts: number of functions, number of instructions, number of data segments, etc...
  • Static: instruction mix: ratio of integer vs float vs memory load vs etc... instructions

There are two categories of dynamic metrics:

  1. Dynamic Wasm instruction mix: This is recorded via instrumenting the benchmark with counters for each instruction category and incrementing an instruction's associated counter as the program runs (with an optimization to batch these increments up once per basic block).

  2. Callgrind-based metrics: The benchmark is run through callgrind with a fixed cache and branch predictor simulation configuration (so the metrics are independent of the host machine's microarchitecture) and then we report the cache read/write miss ratio, branch prediction miss ratio, number of Wasm instructions executed per native instruction, etc...

@fitzgen fitzgen requested a review from posborne June 8, 2026 19:57
@fitzgen fitzgen force-pushed the pca-metrics branch 2 times, most recently from 3ab5157 to 6a023ad Compare June 8, 2026 20:08
This records various static and dynamic metrics for use in principal component
analysis.

Static metrics include:

* Various entity counts: number of functions, number of instructions, number of
  data segments, etc...
* Static: instruction mix: ratio of integer vs float vs memory load vs
  etc... instructions

There are two categories of dynamic metrics:

1. Dynamic Wasm instruction mix: This is recorded via instrumenting the
   benchmark with counters for each instruction category and incrementing an
   instruction's associated counter as the program runs (with an optimization to
   batch these increments up once per basic block).

2. Callgrind-based metrics: The benchmark is run through callgrind with a fixed
   cache and branch predictor simulation configuration (so the metrics are
   independent of the host machine's microarchitecture) and then we report the
   cache read/write miss ratio, branch prediction miss ratio, number of Wasm
   instructions executed per native instruction, etc...
@fitzgen

fitzgen commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

@posborne gentle review ping

@posborne posborne left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in review @fitzgen; couple false starts before I found the time to work through reading the full set of changes. Looks good to me, I haven't had a chance to interact with the code yet, though I hope to a bit in the near(ish) future.

@fitzgen fitzgen merged commit fbd0d4c into bytecodealliance:main Jun 22, 2026
12 checks passed
@fitzgen fitzgen deleted the pca-metrics branch June 22, 2026 19:14
@fitzgen

fitzgen commented Jun 22, 2026

Copy link
Copy Markdown
Member Author

Thanks @posborne !

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.

2 participants