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

Fuzzer: Adjust parameters by input size, sometimes #7276

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

kripken
Copy link
Member

@kripken kripken commented Feb 5, 2025

Rather than always have a fixed max of heap types, globals, etc. allow more if the
input size is large. This adds variety.

There is a cost to this variety, we go from 0.89% ignored runs to 1.1% (that is,
slightly more runs contain something that prevents us from doing the work
we want, like hitting a host limitation or seeing the testcase just traps). This
increase seems small enough to be reasonable, and we only do this half the
time, so the old behavior is still being tested at half throughput.

@kripken kripken requested a review from tlively February 5, 2025 18:28
// A typical random wasm input from fuzz_opt.py is fairly large (to minimize
// the process creation overhead of all the things we run from python), and
// the defaults are tuned to that.
double size = random.remaining();
Copy link
Member

Choose a reason for hiding this comment

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

Why does random.remaining() correspond to the input size? This seems non-obvious, so perhaps is worth a comment.

// the process creation overhead of all the things we run from python), and
// the defaults are tuned to that.
double size = random.remaining();
const double MEAN_SIZE = 40 * 1024;
Copy link
Member

Choose a reason for hiding this comment

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

Is this number taken from measurements? Do we expect it to change much over time? (Not that it would matter much if it did.)


auto bits = random.get();
if (bits & 1) {
fuzzParams->MAX_NEW_GC_TYPES = fuzzParams->MAX_NEW_GC_TYPES * ratio;
Copy link
Member

Choose a reason for hiding this comment

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

Can we use *= ratio here and below?

// Only increase the number of tries. Trying fewer times does not help
// find more interesting patterns.
if (ratio > 1) {
fuzzParams->TRIES = fuzzParams->TRIES * ratio;
Copy link
Member

Choose a reason for hiding this comment

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

Can we give TRIES a more descriptive name?

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