-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
358 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
agents: | ||
public: "true" | ||
os: "linux" | ||
|
||
steps: | ||
- label: ":haskell: :linux: Primer Wasm targets" | ||
command: | | ||
nix develop .#wasm --print-build-logs --command make wasm32-update | ||
nix develop .#wasm --print-build-logs --command make wasm32-test-opt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# WebAssembly (Wasm) support | ||
|
||
**Note**: WebAssembly support is currently very preliminary. | ||
|
||
For horizontal scalability reasons, we would like to run the `primer` | ||
and `primer-api` packages in the student's browser, rather than on a | ||
backend server. Therefore, we'd like to compile these packages to a | ||
`wasm32-wasi` target and call the (native) Primer API from TypeScript. | ||
|
||
Currently, we can compile these two packages to `wasm32-wasi`, but | ||
with the following caveats: | ||
|
||
1. Neither `haskell.nix` nor `nixpkgs.haskellPackages` support the | ||
`wasm32-wasi` cross-target at the moment, so we can only build Wasm | ||
targets directly via `wasm32-wasi-cabal` and `wasm32-wasi-ghc`. For | ||
interactive development, we provide a special `nix develop` shell | ||
which provides the necessary tools: | ||
|
||
```sh | ||
nix develop .#wasm | ||
``` | ||
|
||
Note that the required tools are currently only available for | ||
`x86_64-linux` Nix systems, so the special `wasm` Nix shell only | ||
exists for that platform. | ||
|
||
2. Once you're in the special Wasm shell, it's advisable to use the | ||
special `wasm32` `Makefile` targets. To build the libraries, run: | ||
|
||
```sh | ||
make wasm32-configure | ||
make wasm32-build | ||
``` | ||
|
||
To build the tests and run them using the `wasmtime` runtime, run: | ||
|
||
```sh | ||
make wasm32-test | ||
``` | ||
|
||
The `wasm32-test`, in particular, needs to run several steps that | ||
you'd otherwise need to run by hand in order to work around | ||
`wasmtime` issues. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test/TestsWasm32.hs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
af21875
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.
Possible performance regression was detected for benchmark 'Primer benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.evalTestM/discard logs/mapEven 1: outlier variance
0.09309383264333644
outlier variance0.02498356344510187
outlier variance3.73
This comment was automatically generated by workflow using github-action-benchmark.
CC: @dhess