-
Notifications
You must be signed in to change notification settings - Fork 3
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
[WIP] Update median to support floats #6
base: main
Are you sure you want to change the base?
Conversation
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.
https://www.conventionalcommits.org/en/v1.0.0/
Can use git commit --amend
to fix git commit message and then use git push -f
to force push local branch to remote branch.
I tried make fclean
which cleans the Cargo lock files and removes all the binaries in bin/ and then make
but encountered a build error. Do you get the same?
b76f511
to
59382f6
Compare
These changes replaces ints with floats. Are we planning to keep support for ints? |
I think there are two approaches we can follow:
Let me know what your thoughts are. |
I think we can follow two separate binaries for each operation.
|
I think Bill is right that we need a separate implementation for both ints and floats, rather than converting int to float. Any time you are working with large data or limited memory, the difference between int and float is significant. |
0b7353e
to
7f3ae5f
Compare
7f3ae5f
to
c2310a3
Compare
I increased the memory of the enclave [2936708 KB] and the memory in Currently working on importing data - we need to discuss this. [As this depends on sealing/unsealing and the format of the data - I assume it will be JSON]. |
|
||
let import_data: vec::Vec<f64> = vec![1.24,2.0,3.4,4.7,5.5,10.5]; | ||
let data_string = format!("{:?}",import_data); | ||
let data_slice = data_string.as_str().as_bytes(); |
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.
Why did we change from using the byte string literal to 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 was testing how we handle importing the data, it is not needed for the binary
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.
Cool cool.
@@ -1,6 +1,6 @@ | |||
#![no_std] | |||
use wasmi::{ | |||
self, memory_units::Pages, ExternVal, ImportsBuilder, MemoryInstance, ModuleInstance, | |||
self, memory_units::{Pages}, ExternVal, ImportsBuilder, MemoryInstance, ModuleInstance, |
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.
minor: are these braces around Pages
extra?
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 had another memory unit at some time {Pages, X}
, not needed
@@ -24,7 +24,7 @@ pub fn exec_wasm_with_data( | |||
let module = wasmi::Module::from_buffer(binary)?; | |||
|
|||
// TODO: Calculate the memory size always be larger than `data` | |||
let mem_instance = MemoryInstance::alloc(Pages(200), None)?; | |||
let mem_instance = MemoryInstance::alloc(Pages(13000), None)?; |
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.
Is 13000 an arbitrary number?
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.
Kind of, it was the maximum size I could allocate without errors.
It is 13000*64 KiB memory, which is ~850 MB
The theoretical limit is 65536, (4GB) but I cannot allocate enough memory on my VM
We need to test it with more memory allocated in Enclave.config.xml
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.
Do you have a link to where the theoretical limit comes from?
A single unit of Pages is 65536 bytes I believe - https://docs.rs/memory_units/latest/memory_units/wasm32/struct.Pages.html.
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.
Sorry here you go: https://paritytech.github.io/wasmi/wasmi/struct.MemoryInstance.html
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.
Ok cool thanks.
Have you tried changing these wasm-exec-sgx/wasmi-impl/src/lib.rs Line 39 in c2310a3
|
Yeah, the second part should stay I32, but maybe @sonasi can look into the first part? ( |
Update median to support floating point numbers
TODO
serde_json_wasm
does not support floats (https://docs.rs/serde-json-wasm/latest/serde_json_wasm/)wasmi-impl
get-median-wasm
wasmi-impl