-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add support for .NET 7/C# #29
Conversation
Still missing:
|
There's also two issues:
That forces the generator to include
The Because of that I'm thinking to move all types of array to |
Currently, the test is faling due to out-of-memory. That issue is already know: SteveSandersonMS/dotnet-wasi-sdk#11. However, that is might a hint of poor performance and the lack stack-reuse. The code should re-use the space and should prevent additional allocation. It can be either an lack of C# optimization or bug in the current Karmem code. More experimentation soon. |
__attribute__((export_name("InputMemoryPointer"))) | ||
uint32_t InputMemoryPointer() { | ||
MonoObject* err; | ||
MonoObject* res = mono_wasm_invoke_method (_ID_InputMemoryPointer, _CLASS_Benchmark, NULL, &err); |
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.
How release that pointer? 🧐
Looking into Span internals, seems that is optimized by JIT, which might explains why karmem.Slice is ~5ms slower. I'm not C# expert, but sounds like there's some internal code optimized and I'm not sure if there's any equivalent of Currently, benchmark for Vec3 is ~75ms (and ~70ms using Span), on Ryzen 3900X (M1 tests soon). That still significantly slower than Go, Zig, C, AS and even Swift (with #11 optimization). I'm not sure what I can do to optimize it, and sounds like issues on C# runtime directly. |
Ok. Compiling without
|
29c5431
to
35e31d3
Compare
The tests are passing on TCP/Native, the Fuzzing is falling on WASM. However, the Flatbuffers is also failling on WASM, while working on TCP/Native. I'll assume that it's an issue of DotNet-WASI-SDK (SteveSandersonMS/dotnet-wasi-sdk#11), however it might be one issue from Karmem itself. |
This patch adds support for .NET 7.
That change makes possible to use uint/ulong as index-key. However, since C# doesn't have `usize`, we need to use `ulong`.
Before that patch, Karmem.Slice doesn't support other value rather than Karmem.IViewer.
Before that patch, the value was retrieved by copy. That prevents modifications of non-primitive values doesn't reflects to the original List<T>.
That implements the Reset function, which is present for all generated code.
Before that patch, new allocations are not cleared
That changes makes possible to compile to WASM with the standard benchmark exported functions.
Now it's possible to compile and test/bench with `make dotnet`.
… instead of opaque pointers Previously, the Viewer struct is one opaque pointer to the data. Now, that was changed to "hold" the content and be able to use unsafe to cast it directly, instead of having one temporary variable. The performance improves from ~104ms to ~89ms. The struct uses `Unsafe.AsPointer(this)` to get their own pointer.
Previously, we remain check for implementation of IViewer. However, since last patch it's no longer necessary and we can remove the interface. That also improves the performance from ~89ms to ~75ms.
That reverts the #37a7496 commit, however Viewers is also supported.
Now, the generated code uses Span.
Previously, the size of the string was wrongly calculated and defined.
That change makes clear that Viewers are not suppose to be modified.
Some languages are failing the fuzzing for reasons outside our control.
That makes possible to test without need WebAssembly
To compile for WASM you need to provide `-p:IS_WASM=true` building tags
Previously, the Flatbuffers and Karmem are included, even when not used.
No description provided.