86 points · by XzetaU8 · 6y ago · 120 comments
The people who picked up CUDA can now easily compile it to target NVIDA and AMD GPUs, as well as x86-64 CPUs, using a pletora of compilers (nvcc, hip's framework, PGI compiler for CUDA->x86, Intel's CUDA compiler, ...). Each upgrade to the CUDA platform has been backward compatible, and improved performance by quite a bit.
Those who went for OpenCL lost Apple's platform support, have so-so AMD and Intel CPU support, and not so great AMD and NVIDIA GPU support, and now are getting an "ecosystem reset".
I find this quite ironic TBH. The main advantage of OpenCL over CUDA on paper was supposed to be the vendor portability, but CUDA is delivering better on that "feature" than OpenCL.
And now they land an ecosystem reset. I hope that people can easily migrate their OpenCL 2.x code to OpenCL 3.0. If doing that requires a rewrite, they might as well rewrite their code in CUDA..
Lets see how they manage Vulkan, which keeps getting extensions that NVidia and AMD first develop in DirectX anyway, like Raytracing and mesh shaders.
Google and Samsung had to adapt Microsoft's HLSL compiler to target SPIR-V, because plenty of game developers weren't willing to write GLSL, or to port their shaders.
For those that don't know shading languages HLSL is closer to C++ in language features, also similar to what PS4 uses, while GLSL is pretty much still stuck in being a C derived shading language.
What is your argument here exactly? Isn't it one of the stated benefits of Vulkan, that because of SPIR-V as a shader language, developers can choose whatever high-level language they write to implement shaders in?
If developers can target Vulkan without re-writing their shaders that seems like a sign of strength not a sign of weakness.
Also in the age of middleware, Vulkan is only a checkbox away, so unless one is writing game engines, it is quite irrelevant.
For example, OctaneRender gave up on the Vulkan backend and replaced their prototype with Optix 7.
I bet no one on the VFX movie industry will care one second about their change.
Implementation and standardization should go hand-in-hand, to make sure that you don't standardize something that's unimplementable.
If you can't find companies to implement the standard while it's being developed, then maybe nobody cares?
Hence why Google and Samsung spent about one year doing it for HLSL, and it still isn't 100% compliant with DXIC.
They have a history of doing it for the past 20 years. So when the article said "Taking some hard earned (and hard learned) lessons to heart,". I laughed.
I am not even sure they learned anything. And it is the same reason I dont understand why everyone is chanting Vulkan. It is the same /similar story with OpenGL vs 3DFx Glide.
I'm not sure why I would want to target 4+ proprietary API's instead of one modern, open API which is well-designed and performs great.
http://blog.wolfire.com/2010/01/Why-you-should-use-OpenGL-an...
How do I run a Python program that imports Tensorflow on my AMD GPU today?
If you are installing TF from source, then it becomes your job. TF docs should help you here, and TF's build-system should be able to guide you through what you need to install.
No that's bullshit and it shows you never have done it.
Tensorflow is CUDA only and does not run over AMD GPU. Because CUDA is proprietary and has a monopoly on GPGPU for now.
It is such a big deal that AMD had to fork tensorflow and try to make their own version it in order to make it "partially" run over HIP. This naturally makes it behind upstream, buggy and partially updated [^1]
CUDA is not portable and will never be.
The sad truth is that, due to CUDA, a big majority of GPGPU programs are now vendor lock-in on Nvidia hardware. That is unacceptable, but it is like that.
[^1]: https://github.com/ROCmSoftwarePlatform/tensorflow-upstream
https://rocm-documentation.readthedocs.io/en/latest/Deep_lea...
“ AMD ROCm is validated for GPU compute hardware such as AMD Radeon Instinct GPUs. Other AMD cards may work, however, they are not officially supported at this time. We appreciate your feedback and we will consider it for future versions of ROCm.”
https://github.com/RadeonOpenCompute/ROCm/issues/887#issueco...
Are these solutions "legal"? I.e. is there a risk NVIDIA can crack down on tools like this from an IP standpoint if they want to at some point in the future?
- NVIDIA themselves ship multiple CUDA to multi-core x86-64 compilers for different programming languages CUDA C/C++/Fortran
- AMD has been shiping hip for a while, advertising it as production ready, without any lawsuits (AFAIK). hip is also being used in production.
- LLVM and clang have had open-source CUDA (and PTX) support for years, and nvidia have not enforced any kind of patents there.
Hip is not Cuda and even remove most mention if cuda from its API. It just mimic cuda API to try to provide compatibility.
And the result is that almost nobody use it today.
I'm sure NVIDIA IP includes the CUDA trademark, their own compilers, SDKs and so on... but the language itself ?
Using open standards avoids this risk, though some companies are unwilling to work with Khronos, citing (not publicly detailed) legal concerns.
> Most developers will port their code from CUDA to HIP and then maintain the HIP version. HIP code provides the same performance as native CUDA code, plus the benefits of running on AMD platforms.
E.g. AMD wants developers to develop primarily in HIP. The CUDA->HIP transpilation tools is to help developers make the switch.
1) Are there issues?
RESOLVED: Yes.
https://www.khronos.org/registry/vulkan/specs/1.2-extensions...
Every party in this is a PoS in once sense or another.
I think the OpenCL people get that, and have listed clvk and clspv on their roadmap. That gives considerably better options for actually running compute workloads than crossing one's fingers and hoping that the GPU vendors will implement the spec out of a sense of pity for the spec writers. Another similar project I learned about recently is vuda[1].
Another project to watch closely is JAX/MLIR, which promises to run Tensorflow workloads directly on Vulkan. In that ecosystem, it's not clear at all what value an OpenCL layer would add.
I have a blog post in draft about very fast prefix sum running on Vulkan, thanks to a comment from fluffything in response to my GPU talk (could you let me know how you would like to be attributed)? I finally got it to within 10% of memcpy bandwidth over the weekend, so I'm going to declare victory and write it up.
It also seems the Vulkan supports a different variant of SPIR-V than OpenCL, with the result that some OpenCL C code can't be compiled to work with Vulkan. [1]
But it does seem like a combination of lifting Vulkan compute restrictions and building compute-oriented APIs on top of it could be a better path forward. Especially since this new version basically seems to be giving up an getting vendors to support the features that would make OpenCL competitive with CUDA.
[1] https://github.com/google/clspv/blob/master/docs/OpenCLCOnVu...
Do Apple and NVIDIA have good support for OpenCL ?
EDIT: From the same article, further below:
> Apple has deprecated OpenCL
> AMD’s OpenCL drivers are a mess,
> NVIDIA’s interest is tempered by the fact that they already have their very successful CUDA API,
OpenGL and OpenCL are still very mich supports by Nvidia and other GPU manufacturers, dependent on the OS.
Because with the reset to OpenCL 1.2-derrived specification good luck with SYCL adoption, let alone anyone caring to write SPIR-V backends.
Once you get in the entreprise market, Nvidia is simply killing it with their low power consumption and low profile cards (P4/T4) so it usually isn't a problem and no one really care for the price difference.
Is it CUDA? openCL1.2? Vulkan has some compute stuff, would that be good enough?
NVidia acknowledged early on that you wouldn't necessarly want to use C on the GPU, and moved CUDA into multi-language support.
So while CUDA C++ is the leading language, you can make use of Fortran, Julia, Haskell, .NET, Java, Python as well.
You also have very nice graphical tooling for GPGPU debugging, where you can debug your shaders just like any other application.
You can go through the GTC 2020 videos, https://www.nvidia.com/en-us/gtc/session-catalog/
Interested to hear opinions on whether that was a reasonable conclusion, and whether this makes a difference to it.
Just bite the bullet and pay the green tax. It's cheaper than your health and sanity.
Edit: And ideally I'd like to be able to learn on my "Intel Integrated Graphics" laptop, although I don't care about performance there.
Maybe I should be looking into something that can target SPIR-V via LLVM, or something? Don't know what good options currently exist for for that. I'm generally a bit lost, if that's not already obvious.
NO.
Rent a cloud server or buy an old computer with a discrete GPU. Don't even try winging it. This is not x86 land where everything works everywhere. Not even close. NVIDIA/CUDA is what everyone does, AMD/OpenCL is like shooting yourself in the foot, and Intel Integrated / OpenCL is like shooting yourself in the head.
Yes, really. Last time I encountered Intel Integrated, I spent an entire weekend trying to port a relatively trivial shader. It would compile and run, but the output was always very wrong. Needless to say, the tooling was no help, and remember this is GPU land where you don't have printf, but I eventually discovered the problem: 8 bit floats. Yes, 8 bit floats are a thing in Intel Integrated land. No, it didn't give me any warning it was using them. "You asked for a float, you got a float, what's the problem?" I imagine an intel engineer saying. Because I'm a stubborn SOB I didn't learn my lesson there and I soldiered on -- next bug was a silent pageout issue.
Does this sound like fun? If so, go for it. If not, buy a discrete GPU. AMD might be OK these days, they've been working on their problems, but once bitten twice shy, so my recommendation is to buy something with an NVIDIA GPU and consider the green tax an investment in your mental health.
You could also get started with a simple Vulkan compute example, but as others have said learning Vulkan is a task unto itself, so if you're just playing around and you're not sure if you really want to invest in learning it for something valuable, it might be more of a time sync than you're interested in.
Just getting through the Vulkan tutorial is a weekend long affair.
Otherwise your whole learning experience is going to be an exercise in frustration with almost zero tangible output.
Right; from that point of view OpenCL 3.0 is a good move; also IEEE should consider such a strategy with SystemVerilog.