GHC WebAssembly Weekly Update, 2023-04-05

Testsuite update

The testsuite driver refactoring patch (!9515) along with the ci-images update (ci-images!114) has finally landed. The driver is now more robust against livelock issues that used to arise in previous versions that used multi-threading, and it supports using emulators like wasmtime or qemu to run target executables when testing a cross GHC.

I’ve now opened a subsequent draft MR (!10224) to actually run the entire testsuite for the wasm backend. There are ~85 remaining unexpected failures (compared to ~7k expected passes), and I’m working towards triaging the remaining failures and get it down to 0.

As a part of the work on !10224, I’ve done these smaller pieces of work:

  • Two patches to time (#239) (#240) that fixes upstream wasm CI and compilation failures for the JS backend. It’s a part of the work to bump the time submodule, which is originally proposed by @hsyl20 at !10221. These two patches have already been merged, but there are some more hadrian fixes needed due to the usage of DeriveLift in time, see !10221 for more context about this.
  • A patch to process (#286) that skips the process tests on platforms without a process model (e.g. wasm32-wasi). This one is still pending review.
  • A recently added test case, AtomicFetch, doesn’t work on 32-bit platforms (#23217). I pushed a fix in !10224 that fixes it at least for wasm32.
  • Closed a few outdated issues with the wasm label, since they have already been fixed some time ago.
10 Likes

Thanks for the weekly updates! While there are usually not many comments/replies to these status updates (I certainly never replied before), I do like reading about them.

As a question: is there a more global roadmap/list of milestones for the webassembly backend? The updates so far typically seem to include fairly low-level progress on fixing bug and/or testcase XYZ, I find it a bit hard to know what the big-picture is? E.g. what are the main tasks/steps that need to be done before one can e.g. run pandoc or the gloss examples, in a browser? [1]

Note that in particular I’m not asking for a concrete timeline, nor am I trying to rush this project in anyway. I really appreciate the efforts! and I’m guessing there is a lot of work left to be done; it’s just hard to get a good grasp of what that work entails exactly.

[1] Note that I purposely picked s.t. crazy like gloss, since I imagine that would also involve some sort of interop with compiling related c-code for the windowing etc to webassembly?

1 Like

Thanks for your interest. I’ll try to summarize a bit the current & upcoming milestones I have in mind as a bullet-pointed list:

  • Run the whole GHC testsuite on CI. I’m currently working on this one. It’s a must-have before I move on to actually implement new features.
  • Get the nofib benchmark suite working, for all cross backends including the wasm backend. This is the foundation for performance-related refactorings, things like changing low-level calling conventions or such.
  • Template Haskell. I implemented it once in Asterius, and I don’t see any reason why the same technique won’t work for the GHC wasm backend.
  • JSFFI. This will enable the javascript calling convention of foreign imports & exports, as well as first class JS values on the GHC heap.

So once we get to the point where TH works, there’s hope for porting pandoc. As for gloss or anything graphics-related, it’ll be a longer story that won’t fit into a short post I write when waiting for things to build :slight_smile:

Q1 is over and I’m admittedly overdue for delivering the testsuite thing. But it’s close to finishing and let’s wait and see where we can get at Q2. Feel free to ask more questions anytime!

5 Likes