I have an error as "Error: Raw("unimplemented V128(0)")"

42 views
Skip to first unread message

Sakine Yalman

unread,
Aug 10, 2021, 11:45:04 AM8/10/21
to sp...@googlegroups.com
Hi Scale-Mamba team,

I would like to work with matrices in my code. However, I get an error  - Error: Raw("unimplemented V128(0)") - I tried to find out where it is the problem, but I guess I am getting some kind of memory allocation error. Could you please help me to find out what I am missing?

I prepared and attached a small toy example for you to show my problem. I hope it is clear enough.


Best regards,
Sakine

main.rs

Nigel Smart

unread,
Aug 11, 2021, 5:57:56 AM8/11/21
to sp...@googlegroups.com
Hi

This is indeed a weird one. We will look into this, it looks like a problem
in the transpilation of wasm into scasm to me. I think the root cause is
the way you have done the matrices. This kind of "unstructured" data
is what in C/C++ would be stuck on the call stack, and this can cause
problems in the transpilation as the SCALE runtime does not really have
a stack like modern processors do; and wasm love the stack as its
really a stack based rather than register based assembly.

I rewrote the function using our Matrix class and it seemed to work.
See attached. Here the data gets stored within the SCALE runtime
memory. This is a much safer place to store stuff in the Rust pipeline
than it was in Mamba; thus a lot of the library functions we have
written write/read direct from this memory.

We have not really played that much with the Matrix types yet.
Having concentrated more on the Vector/Slice types, so some
things are not yet as well developed as for the Vector/Slice things.
If you see something for Vector/Slice which you think would be
good for Matrix let us know and we can easily add it.

Yours

Nigel
--
You received this message because you are subscribed to the Google Groups "SPDZ/SCALE-MAMBA Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spdz+uns...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/spdz/CAMV6rAVAXGUpVOJzUS27FTKr%3Dwy%3DLPgXVGpgNgkyKedkpGh39A%40mail.gmail.com.

main.rs
OpenPGP_signature

Sakine Yalman

unread,
Aug 11, 2021, 6:30:20 AM8/11/21
to Nigel Smart, sp...@googlegroups.com
Hi Nigel,

Thank you for your reply and the function.

Sorry that I forgot to tell the weird thing that it was working for a 2x2 matrix. Therefore, I thought that the way of doing matrices is okay.

I will apply the way you wrote to my code and will let you know if I need more help for the features of matrices. Thank you!

Best Regards,
Sakine

Nigel Smart <nigel.pa...@gmail.com>, 11 Ağu 2021 Çar, 10:57 tarihinde şunu yazdı:

Nigel Smart

unread,
Aug 11, 2021, 6:41:04 AM8/11/21
to Sakine Yalman, sp...@googlegroups.com
Indeed. See the AES example in the RustDocumentation.
These "stack based" memories seem to work for really small
matrices all OK. But then when they get bigger the optimizer
seems to kick in and get confused. We are not quite sure where
this happens in the pipeline.

As you can tell the pipeline is written with a lot of "magic".
We basically (at a high level) take the rust pump it into the
normal compiler down to wasm, and then alter this to fit scasm.

Nigel
OpenPGP_signature

Sakine Yalman

unread,
Aug 11, 2021, 6:44:09 AM8/11/21
to Nigel Smart, sp...@googlegroups.com
I see. I will check the AES example. Thank you for your explanation :)

Nigel Smart <nigel.pa...@gmail.com>, 11 Ağu 2021 Çar, 11:41 tarihinde şunu yazdı:
Reply all
Reply to author
Forward
0 new messages