Desired function
Provide a scalar cost for candidate codegen/optimization decisions, incorporating performance and resource objectives.
Futamura role
Used by compiler (and by online JIT decisions) to select among multiple valid compiled results.
Inputs
- User weights per metric / overall weighting function of performance and resources objectives
- Piece of code, profiling data
Processing
- Record offline statistics of program performance - large corpus, should include:
- run time (wall time, CPU time, etc.)
- code size
- compile time
- memory usage
- power
- latency (of main loop, like server requests per second)
- Build ML model and fit statistical distributions and their parameters e.g. mean/variance/tail - should try to get good fits
- Using modeling to normalize metrics to common/standardized scale (e.g. percentiles)
- Combine via weighted linear combination or lexicographic ordering.
- Optionally include risk terms (measures of variance / tail spread of predicted distribution, use non-median measures of performance like 10th percentile)
Outputs
- Provide scalar cost for search/heuristics.
- Provide simple sensitivity analysis / breakdown - contributions of each metric to final score (observability)
- drives copy-and-patch vs. advanced tracing/loop analysis decisions, other optimization decisions
Desired function
Provide a scalar cost for candidate codegen/optimization decisions, incorporating performance and resource objectives.
Futamura role
Used by compiler (and by online JIT decisions) to select among multiple valid compiled results.
Inputs
Processing
Outputs