sigmoid.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A social space for people researching, working with, or just interested in AI!

Server stats:

574
active users

#zig

10 posts9 participants1 post today

After almost a week of refactoring and experimenting with several different approaches, I've updated my Zig nD SIMD vector library to be compatible with the latest Zig 0.15.1, and at the same time cleaned up some internals.

The solution I settled on is a mix of techniques proposed by others, and was needed due to the removal of the struct/namespace-merging syntax in the new Zig version, which this library heavily relies on. I don't like that the new source code is now more than 2x larger and involves a huge amount of duplication to address the many special cases of supported operations for different vector sizes and types. I might still take another pass to eliminate those (by using `@compileError()` for unsupported cases), but that'd be an implementation detail downstream users don't have to care about. I tried AOT code generation as well, but the special case handling made this feel less maintainable...

UPDATE: The only breaking change is the handling of vector swizzles. I had to remove the hundreds of named swizzle functions and replaced them with a single (comptime optimized) `.swizzle(vec, pattern)`, e.g. `.swizzle(vec, "xxyy")`...

If you're interested, the new code is here:
github.com/thi-ng/zig-thing/bl

The readme contains details about the many supported operations:
github.com/thi-ng/zig-thing/bl

Installation instructions in the main repo readme:
github.com/thi-ng/zig-thing/tr

@floooh is there a way to use sokol-gfx from multiple threads with completely isolated states? No need to synchronize or anything I just want each thread to have it is own state.

Im building a painting app for android. I have canvas (painting) functionality and rasterizer (reading from document and renders the whole document at once) functionality. But I export one dynamic library. Therefore I assume gfx globals shares data between threads? Is there a way to make it thread local?

This is not helping me in the market but what I love doing the most is computer language engineering. I'm learning how to write an #LSP right now to support my born language in neovim. I also discovered #LLVM recently. It lets you compile to any target from a generic ASM. It made me realize something. The first languages where all compiled. Then, we got the interpreted languages. But recently, the new languages are all compiled again! Think of #rust, #go, #zig, #elixir. I wonder if it's because we perfected the tooling in a way that maintaining a compiled language is not that hard anymore. Go is a weird one. It has a garbage collector. Yeah! A compiled language with a garbage collector. It means that there is a process that is embedded in the executable to just do garbage collection. We might now have a real reason anymore to interpret.

Zig's recent (and sudden) removal of `usingnamespace` completely and utterly destroyed my nD vector types library[1] architecture and I have no idea how to solve this...

Now I must find a way to rewrite and expose hundreds of swizzle functions (many of them conditional & dependent on different vector sizes) as well as other size-specific and value type-specific functionality, all whilst trying to keep the existing API intact and not to pollute or complicate it with additional sub-namespaces, forced by the removal of this syntax...

The only way I can see (so far) involves a huge amount of code duplication and/or avoidance of `comptime` type generation. Even though I can follow some of the reasons & explanations given in the release notes[2], they're feeling extremely handpicked and seemingly are not considering so many other use cases for which this struct-merging feature was super, super helpful...

`usingnamespace` was such a great tool to split up defintions/modules of complex types over several functions/files and then merge them via a single `comptime` wrapper into a single exposed type... rest in peace! 😭

[1] github.com/thi-ng/zig-thing/bl
[2]ziglang.org/download/0.15.1/re