169 points · by g42gregory · 2y ago · 94 comments
If you are a LLM startup blocked on compute, send me a dm
You're right, it's harder. Saying this as someone who's done more work on the former than the latter. (I have, with a team, built a rocket engine. And not your school or backyard project size, but nozzle bigger than your face kind. I've also written CUDA kernels and boy is there a big learning curve to the latter that you gotta fundamentally rethink how you view a problem. It's unquestionable why CUDA devs are paid so much. Really it's only questionable why they aren't paid more)
I know it is easy to think this problem is easy, it really looks that way. But there's an incredible amount of optimization that goes into all of this and that's what's really hard. You aren't going to get away with just N for loops for a tensor rank N. You got to chop the data up, be intelligent about it, manage memory, how you load memory, handle many data types, take into consideration different results for different FMA operations, and a whole lot more. There's a whole lot of non-obvious things that result in high optimization (maybe obvious __after__ the fact, but that's not truthfully "obvious"). The thing is, the space is so well researched and implemented that you can't get away with naive implementations, you have to be on the bleeding edge.
Then you have to do that and make it reasonably usable for the programmer too, abstracting away all of that. Cuda also has a huge head start and momentum is not a force to be reckoned with (pun intended).
Look at TensorRT[0]. The software isn't even complete and it still isn't going to cover all neural networks on all GPUs. I've had stuff work on a V100 and H100 but not an A100, then later get fixed. They even have the "Apple Advantage" in that they have control of the hardware. I'm not certain AMD will have the same advantage. We talk a lot about the difficulties of being first mover, but I think we can also recognize that momentum is an advantage of being first mover. And it isn't one to scoff at.
Coming from FPGA (both Verilog and VHDL), to me CUDA offers the best way to handle all three parts in comparison to let‘s say OpenCL, Vulkan, or Metal.
For game developers this might be different, as here you always use high-level language and packages (in most cases).
AMD need‘s to rethink there strategy regarding compute tool stack radically. If the HelloWorldMatrixMul is longer as ten lines and not compile on every new AMD powered notebook out of the box, they have no chance to beat NVIDIA. (I know, that the last point is not given for NVIDIA. But it would give AMD the doubleplus good, currently missing.)
Anybody who has worked with them knows that it's basically the same.
Optimizing kernels for all architectures and all models is a hard problem as there are lot of cases to handle, but getting good utilization for a particular model on a particular architecture (like MI300 / Mixtral) is not that hard.
I have a specific reason to believe this is all already optimized: poor adoption of Infinity Fabric by unsophisticated people, whereas NVLink is on every 3090 and DGX/HGX box. But that doesn't mean DC users haven't optimized.
Nvidia is pouring $$$ into protecting their advantage as anemic as it might be. They give free compute and gpu resources to universities etc to cement the dependence on cuda. When you’re a beginner or someone who needs to just “get shit done” you’ll go nvidia at the expense of the greater good.
This description isn't fair. Nvidia was pouring money into CUDA for 16 years. AMD/Intel only woke up once ChatGPT launched and nvidia started printing money. It's not fair to call it "protecting their advantage" when nvidia invested into the ecosystem for years and AMD couldn't even bother to ship working examples with OpenCL. I'm not sure why choosing the company that decided to invest in the platform for years is at the expense of the "greater good." What "greater good" is there above actually working software?
AMD's ML / ROCm support for their consumer cards is still awful.
It's actually quite brilliant. It never occurred to me before that the resources we had access to at university weren't the most popular because that's what the library wanted. They were the most popular because the provider made them cheap/free to widen their moat over the competition.
It reminds me of Thomson Reuters launching Eikon, a superior alternative (imho) to Bloomberg terminals. Every business school has Bloomberg terminals. But few/none had Eikon, which is why nobody knows how to use one.
Most operations are memory bound: slow because memory access takes longer than computation itself. The problem is we have to shove the whole model, billions of weights, in the SRAM once for every token generated. That creates slowness.
Something doesn’t quite add up for this dependence on CUDA. Sure, I’m installing some dependency hellscape Python research project from GitHub I reasonably expect idiosyncratic hardware dependencies, but surely the companies in this space are beyond that on the maturity timeline.
I think part of the problem is something you're touching on here. The ML software space is horrifically put together. It's a bunch of research projects cobbled together. Hence the dependency hell, and very few people who actually know how to port it. Cuda siits at the bottom of the stack with its design assumptions baked into everything above it (see PyTorch for a good example of that). Nobody wrote a hardware agnostic layer over the top, and now the thought of pulling out a Jenga block at the bottom scares everyone.
Cuda is an intentionally leaky abstraction layer over the hardware, and its worked.
Not true. PyTorch has had an MPS backend[1] for Apple Silicon for quite some time now. And lately, they've also added a HIP backend[2] for AMD hardware. I've written CUDA kernels for PyTorch in the past, it'd have been a lot easier if PyTorch were a thin wrapper over CUDA, but it isn't.
Obviously you can use cuda to write more than ML algos, but that’s its overwhelming use case.
Thus my point is if AMD ported PyTorch to their hardware (and PT is not cuda-only) it would create a more level playing field on which they could compete (in a cousin vs cousin battle) by eliminating the switching cost for the majority of developers.
This is the same reason cpu mfrs have compiler ports but generally don’t have to worry about instruction set level compatibility.
Wait, is that actually true? The 4090 is superior in raster to the 7900XTX I thought? Happy to be corrected!
ultimately dlss/frame gen is a hack that no one on a high end card would ever use.
ray tracing nvidia is king but they got the jump. that will normalize over the next generation or two.
Why?
Because Nvidia's DX12/Vulkan-style path in the driver is absolute trash, while their DX11/OGL4-era path is very well tuned. Nvidia's "advantage" is entirely software, the emperor wears no clothes.
With games that Nvidia's money couldn't cripple games, the 7900XTX, the card that both costs less and uses less watts, beats the 4090 in 1080p, 1440p, and 4k targets.
Gamers buy 4090 only because DLSS is significantly better than FSR.
That's before getting to any potential 8 vs 16 bit processing speed differences the two companies are arguing over here.
In any case, if the comparison was being done in 8 bit, the relative performance between the cards should be roughly similar as it is with 16 bit.
Its also important to distinguish 8 bit compute from the actual quantization scheme. vLLM in fact supports 4 bit AWQ, but the computation is not done in 4 bits on the GPU, and it wouldn't even be close to pure 4 bit inference even if the hardware and vLLM supported that.
Also, compute stack is too rough right now. Not sure ROCm will be comparable with CUDA in terms of usability in the next couple of years at least.