You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question regarding Faasm's dynamic linking implementation.
From what I understand, to actually run a wasm module, you need to compile it and then load the compiled code into memory.
In the case of dynamic linking implemented in Faasm, is it also compiled before actually running? Is there any other like AOT is used to reduce the load time?
Regarding memory footprint, if the wasm needs to be compiled again, that means the wasm module will always have their own compiled copy of the dynamic linked wasm library module. Is it true that actually we cannot use this dynamic linking to reduce the runtime memory footprint of the runtime instances?
Dynamic linking in Faasm works as follows:
All dynamically linked modules in Faasm are compiled to wasm, and we run AOT machine code generation on them too (just like the functions themselves)
When another module calls dlopen, we find the compiled wasm and machine code, and load them using the same mechanism normally used to load a function
The simplest example of dynamic linking is in the demo function demo/dynlink, which is compiled from the fake task here.
If a given module is dynamically linked by multiple functions on the same node, it will only be loaded once and cached by Faasm. Therefore, it would indeed be more memory efficient for modules to reuse code via dynamic linking. However, whether this would be significant depends on the size of the wasm memory, for example, if my application is using multiple GB of memory to hold some data, it won't be that significant to save a few kBs by reusing a dynamically linked module.
The text was updated successfully, but these errors were encountered:
I received this over email:
Dynamic linking in Faasm works as follows:
dlopen
, we find the compiled wasm and machine code, and load them using the same mechanism normally used to load a functiontool-conventions
. This happens in theWAVMWasmModule.cpp
fileThe simplest example of dynamic linking is in the demo function
demo/dynlink
, which is compiled from thefake
task here.If a given module is dynamically linked by multiple functions on the same node, it will only be loaded once and cached by Faasm. Therefore, it would indeed be more memory efficient for modules to reuse code via dynamic linking. However, whether this would be significant depends on the size of the wasm memory, for example, if my application is using multiple GB of memory to hold some data, it won't be that significant to save a few kBs by reusing a dynamically linked module.
The text was updated successfully, but these errors were encountered: