Move kmath-memory into a separate project
altavir opened this issue · 4 comments
Create a separate project for low-level multiplatform memory management. Let's call it memory.kt
.
Implement several memory backends:
- ByteBuffer for JVM
- WebGL buffers for JS
- ByteArray for Native
- JEP 393 foreign memory support for JVM (#83). Additional module with JDK 17 target.
The following features should be present:
- Random access primitive read
- Random access primitive write
- Separate lifecycle handlers for readers and writers (control that only one writer could exist at a given time).
- [Optional] Freeze access on borrow via coroutines like
suspend fun Memory.borrow{ block: Memory.()->Unit}
to pass it to other code or external process - [Optional] Kotlinx-serialization infrastructure to perform operations directly on memory (could be useful for ktor-io).
As I see this is already implemented, is it? Thanks.
No, it is not. @CommanderTvis started working on this, but It is not finished. I have some ideas, but it requires a lot of research to understand how it should work and what benefits it has. For example I have an idea about using a Buffer/Matrix/Tensor algebra based on manual memory layout with pooling/nogc implementation of the Memory. But sadly I have no time for it now. All ideas and contributions are welcome.
@altavir Thanks, but the more I dive into the requirements of the "waiting for a hero" issues, the more I see that these are at another level :D