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

MLCSE: lay groundwork for optimizing for size #399

Merged
merged 4 commits into from
Feb 29, 2024

Conversation

AndyAyersMS
Copy link
Member

Add a new --optimizeSize option where PolicyGradient tries to reduce code size instead of perf score.

Since there are now two possible optimization objectives, we have the potential for trading off one for the other. Update MCMC to track the "pareto frontier" for the methods it explores and save the data for visualization.

Contributes to dotnet/runtime#92915.

Add a new `--optimizeSize` option where PolicyGradient tries to reduce
code size instead of perf score.

Since there are now two possible optimization objectives we have the
potential for trading off one for the other.  Update MCMC to track the
"pareto frontier" for the methods it explores, and save the data for
visualization.

Contributes to dotnet/runtime#92915.
@AndyAyersMS
Copy link
Member Author

@EgorBo PTAL
cc @dotnet/jit-contrib

Example of a pareto frontier below. This shows the "best" size/score combinations achievable with CSEs, relative to the current JIT heuristic.

image

Note these "curves" must pass through or below (1,1); this point represents the current JIT heuristic behavior.

Here it passes through, meaning that we can either have smaller code or lower perf score than the current JIT, but not both. The lines joining the points are fictional as the observations are discrete, but they help visualize the nature of tradeoff. Also note we're at the mercy of MCMC's exploration strategy; it may be we should be doing more extensive random sampling and a more thorough exploration would change the shape of the curve in interesting ways. Will have to experiment some here.

Here's a case where the curve is below (1,1). For this method reducing code size seems "easy" but just one CSE sequence both reduces size and perf score.

image

@AndyAyersMS
Copy link
Member Author

This needs a few more fixes since I changed all the ratios to divide by the baseline (meaning lower than 1.0 is now better in the geomeans, etc) but did not update the scoring logic... hope to push them soon.

FYI @NoahIslam @LogarithmicFrog1

@AndyAyersMS
Copy link
Member Author

@EgorBo ping

Copy link
Member

@EgorBo EgorBo left a comment

Choose a reason for hiding this comment

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

Sorry for missed ping!

@AndyAyersMS AndyAyersMS merged commit d3c8618 into dotnet:main Feb 29, 2024
6 checks passed
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