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

[NFC] Make fuzzing params mutable #7257

Merged
merged 8 commits into from
Feb 4, 2025
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Jan 30, 2025

This only makes them mutable, but does not actually mutate them in any
way. The new file parameters.cpp is the same as the old parameters.h,
with the exact same values, but without constexpr etc. on them.

The goal in a later PR is to adjust these to get even more variety in
codegen. E.g. in a huge module we might want many heap type
declarations.

@kripken kripken requested a review from tlively January 30, 2025 23:58
@@ -2420,7 +2419,7 @@ Expression* TranslateToFuzzReader::makeCallRef(Type type) {
// look for a call target with the right type
Function* target;
bool isReturn;
size_t i = 0;
decltype(TRIES) i = 0;
Copy link
Member Author

Choose a reason for hiding this comment

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

this avoids a compiler warning on "comparing signed and unsigned"

@tlively
Copy link
Member

tlively commented Jan 31, 2025

I would strongly prefer not using mutable global state like this. If we want the parameters to be mutable, can we pass them as a configuration object to TranslateToFuzzReader?

@kripken
Copy link
Member Author

kripken commented Jan 31, 2025

Sure, I can do that. But note that that object wouldn't be constant, or at least we'd want to make copies of it with changes (e.g. so that not all functions have the same depth and other params). Does that change your mind?

@tlively
Copy link
Member

tlively commented Jan 31, 2025

Ok, then can we associate different copies of the configuration with the different functions?

@kripken
Copy link
Member Author

kripken commented Jan 31, 2025

Yes. But then it seems odd to pass the configuration in, so I am thinking we'd define a global config in the generator, and create a new one per function and set it active while generating it?

@tlively
Copy link
Member

tlively commented Jan 31, 2025

Why does it seem odd to pass the configuration down to where it will be used? Would that just be too invasive?

@kripken
Copy link
Member Author

kripken commented Feb 3, 2025

If you mean passing constantly in every make*() call, then yes, that would be quite invasive. We'd have dozens (hundreds?) of such places. It seems natural to keep it global, the same way we keep the FunctionContext.

If you mean passing it in from the outside to the fuzzer (that is what I meant before), then it seems odd for the outside to request params but the fuzzer modify them (and the goal is for it to modify them in a dynamic manner).

@tlively
Copy link
Member

tlively commented Feb 3, 2025

Got it, I wasn't sure what you had in mind with "it seems odd to pass the configuration in."

...so I am thinking we'd define a global config in the generator, and create a new one per function and set it active while generating it?

This sounds good to me.

@kripken
Copy link
Member Author

kripken commented Feb 3, 2025

Ok, rewritten as a context with RAII functionality. The RAII part is not yet used as the global context is never replaced, to keep this initial PR NFC.

@kripken kripken merged commit e25eb7f into WebAssembly:main Feb 4, 2025
14 checks passed
@kripken kripken deleted the fuzz.flex.param branch February 4, 2025 16:48
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