313 points · by lnyan · 5y ago · 138 comments
BS. There's so much effort getting Pytorch working on TPUs, and at the end of it it's incredibly slow compared to what you have in Tensorflow. I hate this myth and wish it would die.
Old thread on this, detailing exactly why this is true: https://news.ycombinator.com/item?id=24721229
A lot of this is probably due to supporting CPUs and GPUs with the same interface. There are quite profound differences in how CPUs and GPUs are programmed, so the interface tends to restrict especially more "CPU-oriented" approaches.
I have nothing against supporting GPUs (although I think their use is overrated and most people would do fine with CPUs), but Python really needs a general purpose, high performance autodiff.
As someone who works with machine learning models day-to-day (yes, some deep NNs, but also other stuff) - GPUs really seem unbeatable to me for anything gradient-optimization-of-matrices (i.e. like 80% of what I do) related. Even inference in a relatively simple image classification net takes an order of magnitude longer on CPU than GPU on the smallest dataset I'm working with.
Was this a comment about specific models that have a reputation as being more difficult to optimize on the GPU (like tree-based models - although Microsoft is working in this space)? Or am I genuinely missing some optimization techniques that might let me make more use of our CPU compute?
In general it's more that some specific models are easy for GPUs. Most models probably are not.
Pytorch makes it pretty easy to get large GPU accelerated speed-ups with a lot of code we used to traditionally limit to Numpy. And this is for things that have nothing to do with neural-networks.
GPUs (or "wide SIMDs" more generally) have quite profound limitations. Branching is very limited, recursion is more or less impossible and parallelism is possible only for identical operations. This makes for example many recursion-based time-series methods (e.g. Bayesian filtering) very tricky or practically impossible. From what I gather, running recurrent networks is also tricky and/or hacky on GPU.
GPUs are great for some quite specific, yet quite generally applicable, solutions, like tensor operations etc. But being tied to GPUs' inherent limitations also limits the space of approaches that are feasible to use. And in the long run this can stunt the development of different approaches.
Please provide sources for this claim
Like there is for general purpose Julia code? (https://github.com/FluxML/Zygote.jl)
> I have nothing against supporting GPUs (although I think their use is overrated and most people would do fine with CPUs),
Do you run much machine learning code? All those matrix multiplications run a good bit faster on the GPU.
Well, not everything. Julia's Zygote AD system can autodiff most Julia code (currently with the exception of code that mutates arrays/matrices).
Even things like mixed-precision training are fairly easy to do through the API.
I guess the TPU also doesn't require kernel drivers because you talk to it over network instead of PCIE. But you cannot buy a TPU, only the int8 edge TPU is for sale. (And I've heard that the edge TPU's are absolutely top-notch for performance per $ and Watt right now, as an aside.)
> edge TPU's are absolutely top-notch for performance per $ and Watt right now
Do you mean "aren't"? The performance per $ and Watt is not awesome even when it was released, I was hoping for great toolchain support but that also didn't happen.
https://github.com/tensorflow/tensorflow/tree/master/tensorf...
https://github.com/tensorflow/tensorflow/blob/master/tensorf...
It is true that it is not Google who are distributing binaries compiled with ROCm support through PyPI (tensorflow and tensorflow-gpu is uploaded by Google, but tensorflow-rocm is uploaded by AMD). Is this what you meant by "not officially supporting"?
Of course it doesn't really help that Google refuses to release a more powerful TPU that can compete with e.g. Xavier NX or a V100 or RTX3080 so for lots of applications there isn't much of a choice but to use NVIDIA.
What I have in mind is something like RK3399Pro, it has a proprietary NPU at roughly 3Tops / 1.5W (on paper). But its toolchain is rather hard to use. Hisilicon had similar offerings. There are also Kendryte K210 which claims 1Tops @ 0.3W but I haven't get any chance to try it.
I was already playing with RK3399Pro When Edge TPU was announced, life is tough when you had to feed your model into a blackbox "model converter" from the vendor. That's the part I hope Edge TPU excels at. But months later I was greeted by... "to use Edge TPU, you have to upload your TFLite model to our online model optimizer", which is worse!
If it exists, I wanna buy it
[1] https://blog.haschek.at/2018/fight-child-pornography-with-ra... [2] https://nsfw-categorize.it/
ROCm has not been abandoned. PyTorch is built on top of rocBLAS, rocFFT, and Tensile (among other libraries) which are all under active development. You can watch the commits roll in day-by-day on their public GitHub repositories.
I can't speak about hardware support beyond what's written in the docs, but there are more senior folks at AMD who do comment on future plans (like John Bridgman).
I want to buy AMD because they are more open than Nvidia. But Nvidia supports CUDA day one for all their graphic cards and AMD still don't have rocm support on most of their product even years after their release [0]
Given AMD size & budget, the reason why they don't hire a few more employee full time on making rocm work with their own graphic card is beyond me.
The worst is how they keep people in waiting. It's always vague phrases like "not currently", "may be supported in the future", " "future plan", " we cannot comment on specific model support ", etc.
AMD doesn't want rocm on consumer card ? Then say it. Stop making me check rocm repos every week to get always more disappointed.
AMD plans to support it on consumer card ? Then say it and give a release date : "In May 2021 , the RX 6800 will get rocm support, thanks for your patience and your trust in our product".
I like AMD for their openness and support of standards, but they are so unprofessional when it comes to Compute
The reason is that it would take more than a few more employees to provide optimized support across all GPUs. If nothing else, it's a significant testing burden.
CUDA works with basically any card made in the last 5 years, consumer or compute. ROCm seems to work with a limited set of compute cards only.
There's a ROCm team in Debian [1] trying to push ROCm forward (ROCm being open), but just getting supported hardware alone is already a major roadblock, which stalls the effort, and hence any contributions Debian could give back.
The following is my speculation. For what I noticed, Polaris and Vega had a brute force approach; you could throw a workload on them and they would brute force through it. Navi generation is more gamer oriented; it does not have the hardware for the brutal approach, it relies more on optimizations from the software running on it and using it in specific ways. Provides better perfomance for games, but worse compute - and that's why it is not and is not going to be supported by ROCm.
The downside of course is, that you can no longer buy Vega. If I knew it last time it was on sale...
That's not very helpful if we can't use them on our own computers... Not many devs are able to put their hands on a datacentre-class card...
It’s Linux only so no Mac, Windows or WSL.
No support what so ever for APUs which means if you have a laptop without a dedicated GPU you’re out of luck (tho discrete mobile GPUs aren’t officially supported either and often do not work).
They’ve not only haven’t been supporting any of their consumer based R“we promise it’s not GCN this time”DNA GPUs, but since December last year (2020) they’ve dropped support for all pre-Vega GCN cards which means that Polaris (400/500 series) which is not only the most prolific of AMD GPUs that have been released in the past 5 years or so but also the most affordable ones are no longer supported.
That’s on top of all the technical and architectural software issues that plague the framework.
> It’s Linux only so no Mac, Windows or WSL.
I don't see really a problem here. You want Office or Photoshop? It runs on Mac and Windows only, so you better get one. You want ROCm? Get Linux for exactly the same reason.
Every decision AMD made with ROCm seems to boil down too “i never want to be actually competitive with CUDA”.
Everything from being Linux only and yes that’s is a huge huge huge limitation because most people don’t want ROCm but many would like Photoshop or Premier or Blender being able to use it. Especially with the OpenCL issues AMD has....
Through them not supporting their own hardware to other mind boggling decisions like the fact that ROCm binaries are hardware specific so you have no guarantee of interoperability and worse no guarantee for future compatibility and in fact it does break.
The point is that I can take a 6 years old CUDA binary and run it today still on everything form an embedded system through a high end server, it would maintain its compatibility across multiple generations of GPU hardware, multi operating systems and multiple CPU architectures.
And if you can’t understand why that is not only valuable but more or less mandatory for every GPGPU application you would ever ship to customers, perhaps you should stick to photoshop.
AMD is a joke in this space and they are very much actively continuing in making themselves one with every decision they make.
It’s not that they’ve abandoned ROCm is that it’s entire existence is telegraphing “Don't take use seriously, because we don’t”.
Keep in mind that not only is it Linux only, it doesn't work on consumer hardware either.
It would be very nice for them to refresh their compute cards as well.
With the price to match for those...
Example: I bought a 16GB Radeon VII for €550 (including 19% VAT). That would be a decent value proposition for Deep Learning even today. However, the card appears to trade second hand(!) for €1300+ on e-bay, because you apparently can run 90-100 MH/sec or so (this is an estimate I found on the web, I don't engage in this type of thing). As a result, you would not be able to get consumer Vega with these performance characteristics for a good price even if AMD produced them.
Maybe out-of-the-box support for PyTorch will result in more polish. Who knows? Another issue is that AMD has not yet implemented support for consumer GPUs after Vega. You'd think that targeting researchers on a budget (most of academia) would help them improving the ecosystem and weed out bugs. But they only seem interested in targeting large data centers.
It's all a shame, because as you say, AMD graphics on Linux is awesome. And I think many Linux enthusiasts and researchers would be happy to use and improve ROCm to break NVIDIA's monopoly. Only if AMD actually cared.
If the problems you encountered are related to a particular ROCm software library, I would encourage you to open an issue on the library's GitHub page. You will get the best results if you can get your problem directly in front of the people responsible for fixing it. Radeon VII is one of the core supported platforms and bugs encountered with it should be taken seriously. In fact, if you want to point me at the bug reports, I will personally follow up on them.
ROCm has improved tremendously over the past 6 months, and I expect it to continue to improve. There have been growing pains, but I believe in the long-term success of this project.
As for long term success, good luck, but once bitten twice shy.
Are all of these support issues something that is on the ROCm/AMD/driver side, or are they on the side of libraries like pytorch?
They're actively refusing to comment on 5000-series.
I managed to get it to work for my 5500 XT, but only in Ubuntu and for the 5.4 kernel and it wasn’t straightforward.
It would be nice if a project like Mesa would exist for OpenCL.
In the future, I suppose Vulkan will be used instead for compute though.
Is anyone training ML models on their ultra-thin laptop?
I don’t think anyone is seriously training their ML models on their ultra thin laptop but I think the ability to do so would make it easier for lots of people to get started with what they have. It might be that they don’t have lots of extra cash to throw around or it’s hard to justify on something they are just starting.
Cloud training is also just less convenient and an extra hassle compared to doing things locally, even if it’s something like google collab which is probably the best option right now for training on thin laptops
Even when TensorFlow and PyTorch implement training support on the M1, it will be useless for practically anything except training 2-3 layer models on MNIST.
So why should valuable engineering time be spent on this?
Counter example: none of the AMD consumer GPUs can be used for training. So no, not any modern discrete GPU blows away the M1.
The M1 might not be a great GPGPU system, but it is much better than many systems with discrete GPUs.
I still prefer to work on a GPU workstation because it's the difference between running an experiment in minutes vs hours, makes it easier to iterate.
Some of that speed on a low-power laptop would be great. Much less friction.
There is an unofficial Bruhnspace project...but it is really sad that AMD has made a management decision that prevents use of a perfectly viable Ryzen laptop to make use of these libraries.
Unlike...say a M1
Another reason is certainly that they simply don't need to - just like Intel's iGPU, people working with deep learning opt for discrete GPUs (either built-in or external), both just isn't an option (yet?) for M1-based systems.
The audience would be a niche within a niche and the cost-benefit-ratio doesn't seem to justify the effort for them.
AMD's net income for 2020 was about $2.5B. If it was a management priority, they would fund more people to focus on this.
I would love to support open-source drivers, but AMD's efforts with ROCm on consumer hardware are a joke. It's been said in other comments that AMD only cares about the datacenter. That certainly seems to be the case. So until AMD takes this seriously and gets a legitimate developer story together, I'm spending my money elsewhere.
Fair enough. Thing is, AMD's market share in the mobile market has been below 15% over the past years [1] and only last year increased to about 20%.
Of these 20%, how many notebooks are (think realistically for a second) intended to be used for DL while also not featuring an NVIDIA dGPU?
ROCm on consumer cards isn't a priority for AMD, since profits are small compared to the datacentre market and there's not that many people actually using consumer hardware for this kind of work.
I always feel there's a ton of bias going on and one should refer to sales data and market analysis to find out what the actual importance of one's particular niche really is.
AMD's focus w.r.t. consumer hardware is on gaming an CPU performance. That's just how it is and it's not going to change anytime soon. On the notebook side of things, and AMD APU + NVIDIA dGPU is the best you can get right now.
[1] https://www.tomshardware.com/news/amd-vs-intel-q3-2020-cpu-m...
- https://developer.apple.com/documentation/mlcompute
- https://blog.tensorflow.org/2020/11/accelerating-tensorflow-...
For a more personal take on your answer - do consider the rest of world. For example, Ryzen is very popular in India. Discrete GPU are unaffordable for that college student who wants to train a non-English NLP model on GPU.
Besides, Apple is the most valuable company in the world and has exactly the kind of resources AMD doesn't have.
> or example, Ryzen is very popular in India. Discrete GPU are unaffordable for that college student who wants to train a non-English NLP model on GPU.
Well Google Collab is free and there are many affordable cloud-based offers as well. Training big DL models is not something you'd want to do on a laptop anyway. Small models can be trained on CPUs, so that shouldn't be an issue.
Inference is fast enough on CPUs anyway and if you really need to train models on your Ryzen APU, there's always other libraries, such as TensorflowJS, which is hardware agnostic as it runs on top of WebGL.
That's why I don't think this is a big deal at all - especially given that Intel still holds >90% of the integrated GPU market and doesn't even have an equivalent to ROCm. Again, niche within a niche, no matter where you look.
If this is not the case then this is a really big deal.