-
Notifications
You must be signed in to change notification settings - Fork 824
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
Reproducible builds #2173
Comments
I believe this is due to the introduction of parallel compilation, at least on the LLVM side. How important is deterministic compilation for your use case @xofyarg? Also, have you tried singlepass? |
I just tried singlepass, same issue. My use case is to pre-compile the binary in one location, and distribute it worldwide. The build service is stateless, so it doesn't know if the source is changed or not. The new version introduced some unnecessary pressure on the pipeline, but it acceptable at the moment. |
Thanks for the info! |
This is to test wasmerio#2173, the empty test always pass while the table one fails sometimes.
I add some tests to show the issue in PR #2184. |
I've identified two problems. The easier one is that ModuleInfo::function_names is a HashMap. Maybe this is because it tends to be sparse, as not all functions have names? The iteration order of a hashmap is indeterminate so bincode's output for serializing one is indeterminate. We could either serialize this one differently (for example, in sorted order) or use a different type for it (for example, a BTreeMap). The other issue is inside compiler-cranelift/src/compiler.rs, in a parallel loop over all function_body_inputs we have I haven't looked into compilers or engines besides cranelift+jit. |
This is to test wasmerio#2173, the empty test always pass while the table one fails sometimes.
I've investigated a bit more the issue. If you are using the JIT engine, the issue comes from Cranelift. It emits non-deterministic results when compiling functions. Here are the results for Engines:
Compilers:
|
Note: what was not deterministic was the serialization due to use of |
This PR is testing that we have deterministic builds: |
This is to test #2173, the empty test always pass while the table one fails sometimes.
2692: Make module serialization deterministic r=syrusakbary a=Amanieu Fixes #2173 Includes the tests from #2184. Co-authored-by: Amanieu d'Antras <[email protected]> Co-authored-by: Anbang Wen <[email protected]>
Summary
At version 0.17, the compiler is able to generate the same output with the same input. But after upgrading to 1.0.2, the compilation results differ each time even the wasm file is the same. I tried LLVM and cranelift. I'm using the default options, not sure if I missed anything.
The text was updated successfully, but these errors were encountered: