Earlier quoted context omitted.
> 2a. Inline assembly or inspecting the architecture before choosing the @Vector width are both options, so you can write your high-level code with that information in mine if necessary (e.g., to make bolt vector quantization work well in Zig I'm pretty sure you need to inline-assembly one of the swizzling operations). Inline assembly is great but support for intrinsics would be really valuable for Zig IMO.
You can link in intrinsics too. Again, C compatibility is high.
Deep Neural Networks from Scratch in Zig
31–34 of 34 posts
Re: Deep Neural Networks from Scratch in Zig
#32I've been working on mix of ML performance and abstraction for a while and this is a breath of fresh air. Zig is truly a fascinating language, and the semantics revealed in this post are surprisingly powerful. "By hard coding the forward and backward methods at comptime we have some more comfort with the general correctness and expected errors we would receive if we passed in incorrectly shaped data at runtime." This…
Re: Deep Neural Networks from Scratch in Zig
#33I've been working on mix of ML performance and abstraction for a while and this is a breath of fresh air. Zig is truly a fascinating language, and the semantics revealed in this post are surprisingly powerful. "By hard coding the forward and backward methods at comptime we have some more comfort with the general correctness and expected errors we would receive if we passed in incorrectly shaped data at runtime." This…
What does this offer that basic dependent typing doesn't?
it's funny to see it written as "basic" dependent typing, considering it's an extremely complex type system to implement.
Re: Deep Neural Networks from Scratch in Zig
#34> I would guess the constant memory allocation and frees in the training loop are the bottleneck No, the bottleneck would be not utilizing the idling GPU.
Using the CPU with quantized weights on GPT models makes sense, an example is llama.cpp, that’s because these models are constrained by memory bandwidth and not compute (low arithmetic density) https://github.com/ggerganov/llama.cpp