177 points · by fzliu · 3y ago · 65 comments
Is 8bit/4bit support in the works? Will it work with bitsandbytes out of the box? Speedy inference is great, but in practice many users are running the biggest ~4-bit LLM that will fit into their RAM/VRAM pool these days. This is why llama.cpp is so good, its (AFAIK) the only implementation that will split a 4 bit quantized model so easily.
I'd be more interested if they had a GPU port of Stable Diffusion, which is really compute-intensive. That's where the GPU has a major advantage over CPU, on lower-end chips like M1/M2 and M1/M2 Pro.
> specialized for CPU
Mojo's SIMD execution model should map directly to GPUs. Instead of writing shaders thinking about a single GPU thread, you access the assembly ISA directly, thinking about an entire warp/simdgroup. That's how I think when writing SIMD-group matrix kernels anyway.
- Apache TVM (mlc-llm is a good demo)
- Hidet (a torch.compile backend)
- Alibaba BladeDISC
- Nvidia TensorRT (a classic, but much less of a nightmare to install now)
- Torch MLIR (SHARK has some demos/implementations)
Pytorch Eager Mode with some optimizations: ~6it/s
Pytorch Inductor (torch.compile with dynamic=True): ~7it/s
AITemplate: ~9it/s
All of them support changing settings and such, albeit with some work in progress bugs/caveats.
That is 512x512 on a 2060, so I would expect the gains to be bigger on newer GPUs with more overhead to take advantage of.
HIP: AMD GPU 'framework'
This takes Neural Network defined in python and convert them to C++ code calling CUDA / HIP for maximum inference speed
i wonder how well tinygrad's apporach will work out, ops fusion sounds easy, just walk a graph, pattern match it and lower to hardware provided ops?
Anyway if anyone wants to understand the philosophy behind tinygrad, this file is great start https://github.com/geohot/tinygrad/blob/master/docs/abstract...
LLaMA is a memory-bound AI model, where the dominant factor in execution time is how fast the processor transfers weights from RAM to registers. LLaMA.cpp uses a misaligned memory pattern that's painful to the RAM I/O interface and requires many CPU instructions to re-align. It also has access to 1/2 the bandwidth of the GPU on Apple's highest-end chips, making GPU *theoretically* 2x faster without algorithm changes.
Funny how you announced it the exact day after I open-sourced a high-bandwidth 4-bit GEMV kernel for LLaMA. If anyone wants to see how to achieve 180+ GB/s on the M1/M2 Max, you can reproduce the methodology here:
https://github.com/ggerganov/llama.cpp/pull/1642#issuecommen...
I later explained the technique to write very optimized kernels for a specific quantization format. *It's very unlikely my code was copied verbatim*, but it was probably used as inspiration and/or a reference. I also disclosed a high-precision means of measuring bandwidth utilization, which is critical for designing such GPU kernels.
However, for whatever reason, when Greg Gerganov started work on the Metal backend, you made a product announcement almost a day later. That seems like a non-coincidence and there must be some logical explanation.
I am losing my bibliography, etymology and vocabulary with every single AI advancement article.
Where learn AI vocab, please?
-
I nee an FN AI teacher to just give me daily updates on AI and verbiage, models, etc...
Hey AI - if you're so smart, build a podcast that teaches me about yourself and how to be a better meat parent whom made you.///\\\\
What I'm not sure is what "HIP" is in this context.
The way I'm reading this is it's the difference between running code in an interpreter vs. on the bare metal (for the GPU)
You write in HIP C++ language and run them on either NVIDIA or AMD platforms. This way you get cross-platform code and are not stuck with Nvidia.
Use HIPify tool to automatically convert existing sources from CUDA to HIP.
It's been around for many years - but the fact that so many people still don't know about it - speaks for the sad state of AMD communication.
https://docs.amd.com/bundle/HIP-Programming-Guide-v5.3/page/...