-
Notifications
You must be signed in to change notification settings - Fork 17
Support binaryen version_121 #167
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
base: master
Are you sure you want to change the base?
Conversation
components/wasm-opt-sys/build.rs
Outdated
| let fp16_dir = binaryen_dir.join("third_party/FP16/include"); | ||
| CFG.exported_header_dirs.push(&fp16_dir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to compile. Not sure if I should move this up a few lines so it's next to where src, tools, and output are added to the exports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it so all of the cpp files from binaryen are added in the build, but I'm not sure if every single one is needed.
| } | ||
|
|
||
| // FIXME binaryen unicode path handling is broken on windows | ||
| // TODO: How do I fix this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw a comment on the issue about issues with Windows paths saying this is fixed in binaryen now, but I'm not sure if any more work is needed here or if this repo gets it "for free".
| @@ -1,3 +1,5 @@ | |||
| #![allow(clippy::new_without_default)] | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured this warning would be more annoying than helpful since the new method on the types it was complaining about don't take args.
| /// Outline instructions. | ||
| /// TODO: This is gated behind conditional compilation in the CPP. | ||
| /// Need to figure out how to handle that on the rust end. | ||
| Outlining, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated in the TODO, this is gated behind conditional compilation in the C++ code and I'm not sure how to handle that on the Rust end. Would that just be adding a new feature and gating this enum variant behind a cfg attribute?
|
|
||
| // TODO: Figure out how to fix, or if this is still even needed | ||
| #[test] | ||
| fn optimization_read_module_error_works() -> anyhow::Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result being tested in the assert no longer errors. I don't know if this is because I made a mistake doing the upgrade, or if it's due to a change in the unerlying C++ code in the new version.
Comparing PassRunner::run between version_116 and version_121, there is only one difference: the former does an assert at the start of the function and the latter doesn't.
|
Thanks a lot for this work @SleeplessOne1917 - here's hoping we can get this merged. |
|
I see that a test failed during the CI build, but I ran it locally and it was all green. |
|
Thanks for doing all this legwork @SleeplessOne1917. Pass argumentsThe most difficult failure here looks to be related to binaryen "pass arguments". This causes the failures in Some of the problems here are in the The pass args are kind of an obscure and underdocumented feature of binaryen. We could just break them, but I think this can be fixed. In the broken tests, this problem arises when using the On the command line, this used to look like Now it appears to only work as Internally to binaryen the It looks like to me like the fix is:
I will hack on this myself shortly unless someone else really wants to tackle it, but I don't expect anything more after waiting so long here. I haven't looked at the failure in Almost all the conformance tests are failing. This indicates that the API is not configuring binaryen the same way as wasm-opt is. I have not looked into it yet. These are run with The initial run takes a long time because it is rebuilding the c++ |
|
@brson I made your suggested changes except for fixing the tests. The conformance tests are now failing with a different issue and I'm not sure how to advance. Most of the conformance tests are failing when the API outfile is compared with the Rust out file. All the test output says is that one massive byte vector was produced when it should have been another massive byte vector and I can't see anything that indicates what the actual issue is. |
|
Is this ready to be merged? binaryen 116 does not provide a binary for linux arm64 which was added with 117 :( |
|
Besdies the CI build failing, we'll need to address the points I made in the comments I haven't marked as resolved already before merging. I'm hoping this can be merged sooner rather than later since |
Closes #166.
Besides updating the project to be compatible with binaryen version_121, I made a few other changes:
struminstead of separate dependency onstrum_macros.Pass::nameand instead useIntoStaticStrto generate static strings for enum variants.PassOptionsgenerateStackIRandoptimizeStackIRfields (these are present in binaryen version_121 but did not exist yet in version_116).containsPass(present in binaryen version_121 but did not exist yet in version_116).cargo clippy.I'm opening this as a draft since I'm not really familiar with binaryen or the WASM spec more generally. I made this PR by referring to previous commits in this repository adding support for newer binaryen versions.
@brson @Aimeedeer pinging you two to make sure you see this since this repo hasn't received any new commits on the master branch for close to a year and you are the primary contributors.