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

[llvm_instcount] Leaderboard Submission: Random Search #117

Merged
merged 1 commit into from
Mar 31, 2021

Conversation

ChrisCummins
Copy link
Contributor

@ChrisCummins ChrisCummins commented Mar 3, 2021

This adds a pure random policy that selects actions randomly until a
fixed number of steps (the "patience" of the search) have been
evaluated without an improvement to reward. The search stops after a
predetermined amount of search time has elapsed.

The patience value was selected by running a random 200 searches on
programs from the blas-v0 dataset and selecting the value that
produced the best average reward.

What is in this PR?

Walltime (mean) Codesize Reduction (geomean)
Random search, p=1.25, t=10 42.939s 1.031×
Random search, p=1.25, t=60 91.215s 1.045×
Random search, p=1.25, t=3600 3,630.821s 1.061×
Random search, p=1.25, t=10800 10,512.356s 1.062×

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 3, 2021
@ChrisCummins ChrisCummins changed the title [llvm-ic-v0/cBench-v0] Leaderboard submission: Random Search. [llvm-ic-v0/cBench-v1] Leaderboard submission: Random Search Mar 17, 2021
@ChrisCummins ChrisCummins force-pushed the leaderboard-random branch 2 times, most recently from 790a973 to 92e9868 Compare March 22, 2021 15:09
@ChrisCummins ChrisCummins marked this pull request as ready for review March 22, 2021 15:10
Copy link
Contributor

@hughleat hughleat left a comment

Choose a reason for hiding this comment

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

LGTM. Few comments.

leaderboard/llvm_codesize/random_search/README.md Outdated Show resolved Hide resolved
python -m compiler_gym.bin.validate --env=llvm-ic-v0 \
--reward_aggregation=geomean < "$LOGFILE" | tail -n4
done
```
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, patience ratio is odd. Just straightforward patience makes more sense to me.
I can see that if you don't know the env, then you might need something generic, but not all envs will have fixed action spaces, so this won't help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added extra description

leaderboard/llvm_codesize/random_search/README.md Outdated Show resolved Hide resolved
@ChrisCummins ChrisCummins force-pushed the leaderboard-random branch 2 times, most recently from b84fa03 to 6b58e9e Compare March 22, 2021 18:26
Pseudo-code for this search is:

```c++
float search_with_patience(CompilerEnv env, int patience, int search_time) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the pseudo-code in C++? Is there a C++ interface too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No particular reason, it just feels more pseudo-y to me with types :)

We don't advertise a C++ interface, but it is entirely usable as a C++ library. Here's is an example random search. It looks pretty much the same as in python:

https://github.com/facebookresearch/CompilerGym/blob/development/examples/RandomSearch.cc#L107-L136

Copy link
Contributor

@JD-ETH JD-ETH left a comment

Choose a reason for hiding this comment

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

Looks good to me!

leaderboard/llvm_codesize/random_search/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@benoitsteiner benoitsteiner left a comment

Choose a reason for hiding this comment

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

LGTM

leaderboard/llvm_codesize/random_search/README.md Outdated Show resolved Hide resolved
@ChrisCummins ChrisCummins changed the title [llvm-ic-v0/cBench-v1] Leaderboard submission: Random Search LLVM Instruction Count Leaderboard Submission: Random Search Mar 31, 2021
@ChrisCummins ChrisCummins changed the title LLVM Instruction Count Leaderboard Submission: Random Search [llvm_instcount] Leaderboard Submission: Random Search Mar 31, 2021
@ChrisCummins ChrisCummins force-pushed the leaderboard-random branch 3 times, most recently from fc25871 to c02dc3a Compare March 31, 2021 13:21
This adds a pure random policy that selects actions randomly until a
fixed number of steps (the "patience" of the search) have been
evaluated without an improvement to reward. The search stops after a
predetermined amount of search time has elapsed.

The patience value was selected by running a random 200 searches on
programs from the `blas-v0` dataset and selecting the value that
produced the best average reward.
@ChrisCummins ChrisCummins merged commit 3ed00ef into development Mar 31, 2021
@ChrisCummins ChrisCummins deleted the leaderboard-random branch March 31, 2021 18:52
@ChrisCummins ChrisCummins mentioned this pull request Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants