fitzgen opened issue #6009:
This is what
wasm-mutate
does to generate pseudo-random semantics-preserving Wasm programs from an input Wasm module. We could also do it in our own mid end to exercise the back half of the compiler pipeline.
I was talking with @jacarte the other day as well and he had a similar idea: do the `wasm-mutate` e-graphs thing (select a random e-node from the e-class rather than the best e-node). I guess this would also fit in with the chaos mode work.
_Originally posted by @fitzgen in https://github.com/bytecodealliance/wasmtime/issues/5967#issuecomment-1464716718_
remlse commented on issue #6009:
Related to #4134
Jacarte commented on issue #6009:
(Commenting here the same I wrote in the issue)
The concept of "semantically equivalent" is actually subjective. The rewriting rule can be anything that changes the final code. In a potential real chaos mode, you can add whatever transformation rule, for example,
x => x + 1
.
Jacarte edited a comment on issue #6009:
(Commenting here the same I wrote in the issue)
The concept of "semantically equivalent" is actually subjective. The rewriting rule can be anything that changes the final code. In a potential real chaos mode, you can add whatever transformation rule, for example,
x => x + 1
. Applying that rule wil eventually stress the memory boundaries.Yet, all of this are assumptions :), but, we have some of these "non-semantic" rules in wasm-mutate, https://github.com/bytecodealliance/wasm-tools/blob/458ff31e50249646eb89a23519de926be6732b65/crates/wasm-mutate/src/mutators/peephole/rules.rs#L394
cfallin commented on issue #6009:
@Jacarte I may be missing some context here to interpret your suggestion, but in the context we are imagining in the chaos-mode test infrastructure, we do actually need semantics-preserving transforms only. The idea is that every compilation with arbitrary chaos-mode choices is still a valid compilation. Unless we pair e.g.
x -> x + 1
with equivalent updates of uses ofx
everywhere (x' - 1
) then we've broken the input program. Perhaps you're thinking in a purely generative context (creating new, arbitrary programs) rather than a transforming/optimizing context?
Jacarte commented on issue #6009:
@Jacarte I may be missing some context here to interpret your suggestion, but in the context we are imagining in the chaos-mode test infrastructure, we _do_ actually need semantics-preserving transforms only.
I agree, it was just a suggestion on disabling the semantic-aware restriction :big_smile:
The idea is that every compilation with arbitrary chaos-mode choices is still a valid compilation. Unless we pair e.g.
x -> x + 1
with equivalent updates of uses ofx
everywhere (x' - 1
) then we've broken the input program. Perhaps you're thinking in a purely generative context (creating new, arbitrary programs) rather than a transforming/optimizing context?Yeah, that was the case, sorry for the missunderstanding.
Eitherway, here you can find a small (maybe not enough) explanation on what we did https://www.jacarte.me/assets/pdf/wasm_mutate.pdf
Last updated: Nov 22 2024 at 16:03 UTC