Skip to content

Move existing fuzzers to test/fuzz#9053

Open
alexreinking wants to merge 9 commits intomainfrom
alexreinking/move-fuzzers
Open

Move existing fuzzers to test/fuzz#9053
alexreinking wants to merge 9 commits intomainfrom
alexreinking/move-fuzzers

Conversation

@alexreinking
Copy link
Member

@alexreinking alexreinking commented Mar 17, 2026

This PR moves the existing fuzz tests that were under test/correctness to test/fuzz, and integrates them into the fuzz test framework from #9050.

Checklist

  • Tests added or updated (not required for docs, CI config, or typo fixes)
  • Documentation updated (if public API changed)
  • Python bindings updated (if public API changed)
  • Benchmarks are included here if the change is intended to affect
    performance.
  • Commits include AI attribution where applicable (see Code of Conduct)

template<typename T>
auto PickValueInArray(T &array) -> decltype(auto) {
return array[ConsumeIntegralInRange(static_cast<std::size_t>(0), std::size(array) - 1)];
auto PickValueInArray(const std::initializer_list<T> &list) -> decltype(auto) {
Copy link
Contributor

@mcourteaux mcourteaux Mar 17, 2026

Choose a reason for hiding this comment

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

Why decltype(auto) instead of simply T? What does that even mean? it's already auto? The signature that exists is perfectly fine IMO.

Copy link
Contributor

@mcourteaux mcourteaux left a comment

Choose a reason for hiding this comment

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

Nice. Why does git not detect the file moves? It's treating it as a full new file.

}
if (gen_cse) {
ops.emplace_back([&] {
return common_subexpression_elimination(random_expr(t, depth, overflow_undef));
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably won't produce many Lets if everything is random... 🤷🏻

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe I misunderstood how lossless_cast did it, then?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you did. The original fuzzer was keeping a list of Exprs that it had already generated, and picks random ones from it to combine larger expressions. That increases the chances of having common subexpressions. See the std::vector<Expr> exprs on top of the generator.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right... this will require some reimagining then.

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.

3 participants