Wasm32-unknown-unknown

I’ve also asked about this here: Concrete for Web Assembly · Issue #282 · zama-ai/concrete · GitHub

I haven’t tried yet, but I anticipate issues when compiling to wasm32-unknown-unknown. Does anyone know if this will work? I see that there is some kind of Wasm support, but unfortunately it uses wasm-pack which might not be compatible with wasm32-unknown-unknown.

It would be nice to have a pure wasm32-unknown-unknown build if it isn’t already supported, this is necessary for running these libraries on the Internet Computer, which is the blockchain I’m building for.

Hello,

As far as I can tell (as I’ve been working on the wasm binding lately) is that wasm-pack builds a binary targetting wasm32-unknown-unknown using rustc and then generates some javascript on top.

However some code that compiles to wasm will actually trigger some asserts/aborts. It is for example the case for the code benchmarking the fft algorithms to choose the best one, as std::time is not available for wasm32-unknown-unknown. I discovered that the hard way. Same thing for multithreaded code via rayon, some init is not done as wasm32 lacks some threading specification “to remain widely compatible” according to some sources.

Finally it’s a 32 bits target, as the wasm32 indicates. Some keys won’t fit in memory (as I’ve had to learn again the hard way). In practice it seems implementations use i32 for indexing memory meaning you “only” have 2GB of RAM to work with, which can prove too small for FHE and big parameter sets.

If you have other questions feel free to ask them here :slightly_smiling_face:

Cheers