643 points · by rrampage · 2y ago · 145 comments
If you are interested in open source runtimes, tinygrad has them in Python for both AMD and NVIDIA, speaking directly to the kernel through ioctls and poking the command queues.
https://github.com/tinygrad/tinygrad/blob/master/tinygrad/ru...
https://github.com/tinygrad/tinygrad/blob/master/tinygrad/ru...
(I want a reference implementation of run-simple-stuff which doesn't fall over because of bugs in libhsa so that I know whatever bug I'm looking at is in my compiler / the hardware / the firmware)
The HSA parsing MEC firmware running on the GPUs is riddled with bugs, fortunately you can bypass 90% of it using PM4, which is pretty much direct sets of the GPU registers. That's what tinygrad does.
AMD's software is a really sad state. They don't have consumer GPUs in CI, they have no fuzz testing, and instead of root causing bugs they seem to just twiddle things until the application works.
Between our PM4 backend and disabling CWSR, our AMD GPUs are now pretty stable.
There is a lot one cannot wisely say about the political structures which give rise to the behaviour of the rocm toolchain. Some of the implementation choices reified in the code are far divorced from what I consider reasonable, but one does not take a hatchet to other people's work.
This makes fixing rocm primarily a people oriented problem to which compiler engineers are not necessarily temperamentally suited. I note that a technically inept but politically minded engineer can do extremely widespread damage in a friendly non-toxic collaborative environment.
Cutting the egregiously broken parts of rocm from one's dependency graph is a solid workaround.
Once you already bought the NVIDIA cards what’s the point
Another benefit could be support for platforms that nvidia doesn't care to release CUDA SDKs for.
As a bonus, with open source platforms you are much less subject to whims of company licensing. If tomorrow Nvidia decided to change their licensing strategy and pricing, how many here will be affected by it? OSS doesn’t do that. And even if the project goes in a random direction you don’t like, someone likely forks it to keep going in the right direction (see pfsense/opnsense).
This is just wishful thinking. Anything close to real professional use, not related to IT, and closed source is king: office work, CAD, video editing, music production, and those domains immediately came to mind. Nowhere there open source can seriously challenge commercial, closed sourced competitors.
Yes, in any of those domains one can name open source products, but they are far from "winning" or "the better option".
Linus wasn’t writing Linux for consumers (arguably the Linux kernel team still isn’t), he needed a Unix-like kernel on a platform which didn’t support it
Nvidia is placed with CUDA in a similar way to how Bell was with Unix in the late 1980s. I’m not sure if a legal “CUDA Wars” is possible in the way the Unix Wars was, but something needs to give
Nvidia has a monopoly and many organisations and projects will come about to rectify it, I think this is one example
The most interesting thing to see moving forward is where the most just place is to draw the line for Nvidia they deserve remuneration for CUDA, but the question is how much? The axe of the Leviathan (US government) is slowly swinging towards them, and I expect Nvidia to pre-emptively open up CUDA just enough to keep them (and most of us) happy
After a certain point for a technology so low in the “stack” of the global economy, more powerful actors than Nvidia will have to step in and clear the IP bottleneck
Tech giants are powerful and influence people more than the government, but I think people forget how powerful the government can be when push comes to shove over such an important piece of technology
—————
PS my comparison of CUDA to Unix isn’t perfect, mostly as Nvidia has a hardware monopoly as it stands, but as they don’t fab it themselves it’s just a design/information at the end of the day. There’s nothing physically preventing other companies producing CUDA hardware, just obvious legal and business obstacles
Perhaps a better comparison would be Texas Instruments trying to monopolise integrated circuits (they never tried). But if Fairchild Semiconductors hadn’t’ve independently discovered ICs, we might have seen a much slower logistic curve than we have had with Moore’s law (assuming competition is proportional to innovation)
Besides how they've "opened" their drivers by moving all the proprietary code on-GPU, I don't expect this to happen at all. Nvidia has no incentive to give away their IP, and the antitrust cases that people are trying to build against them border on nonsense. Nvidia monopolizes CUDA like Amazon monopolizes AWS, their "abuse" is the specialization they offer to paying customers... which harms the market how?
What really makes me lament the future is the fact that we had a chance to kill CUDA. Khronos wanted OpenCL to be a serious competitor, and if it wasn't specifically for the fact that Apple and AMD stopped funding it we might have a cross-platform GPU compute layer that outperforms CUDA. Today's Nvidia dominance is a result of the rest of the industry neglecting their own GPGPU demand.
Nvidia only "wins" because their adversaries would rather fight each other than work together to beat a common competitor. It's an expensive lesson for the industry about adopting open standards when people ask you to, or you suffer the consequences of having nothing competitive.
Nobody is forcing you to buy GPUs.
Your logic is flawed in the sense that enough people could also simply write alternatives to Torch, which, by the way, is already open source.
Nobody is forcing you to live under a roof.
Nobody is forcing you to eat.
it's worth noting that "NVIDIA software stack" is an imprecise term. the driver is the part that has the datacenter usage term, and the open-kernel-driver bypasses that. the CUDA stack itself does not have the datacenter driver clause, the only caveat is that you can't run it on third-party hardware. So ZLUDA/GpuOcelot is still verboten, if you are using the CUDA libraries.
Step 2: Port to other GPUs.
At least I assume that is the plan.
why not do this first? because the existing closed sourced CUDA already runs well on nvidia chips. Replicating it with an open stack, while ideologically useful, is going to sap resources away from the porting of it to other GPUs (where the real value can be had - by stopping the nvidia monopoly on ai chips).
Good luck getting a multi-user GPU setup going, for example.
It super sucks when the hardware is capable, but licensing doesn't "allow" it.
Anyway I wonder why amd never challenged nvidia on that market... It smells a bit like amd and nvidia secretly agreed to not compete against each other.
Opencl exists but is abandoned.
some will need specific versions of cuda
right now I masked cuda from upgrades in my system and I'm stuck on an old version to support some projects
I also had plenty of problems with gpu-operator to deploy on k8s: that helm chart is so buggy (or maybe just not great at handling some corner cases? no clue) I ended up swapping kubernetes distribution a few times (no chance to make it work on microk8s, on k3s it almost works) and eventually ended up installing drivers + runtime locally and then just exposing through containerd config
Having a compiler that takes a special C++ or python dialect and compiles it to GPU suitable llvm-ir and then to a GPU binary is one thing (and there's progress on that side: triton, numba, soonish mojo), being able to launch that binary without going through the nvidia driver is another problem.
Also it's much more convenient to use plain C++ rather than a custom shading language, especially if you're writing complex numerical code or need some heavy templated abstractions to do powerful stuff. And the CUDA tooling itself is just much easier to use compared to Vulkan, with its seamless integration of host / device code.
Don't forget about Julia!
So if I understand it correctly there is something in the works
1. Replacing the extremely bloated official packages with lightweight distribution that provides only the common functionality.
2. Paving the way for GPU support on *BSD.
Could you imaging an age where the NVIDIA firmware does LLM/AI/GPU license checking before it does operations on your vectors? (Hello Oracle on SUN e650, My old Friend) ((Worse would be a DRM check against deep-faking or other Globalist WEF Guardrails))
((oracle had(has) an age olde function where if you bought a license for a single proc and threw it inot a dual proc sun enterprise server with an extra proc or so - it knew you have several hundred K to spend on an additional e650 so why not have an extra ~$80K for an additional oracle proc license. Rather than make the app actually USE the additional proc - as there were no changes to oracles garbage FU Maxwell))
Tell us what you really feel
On VMware they extended this to every CPU in the cluster.
A gigantic shower of absolute grifters.
Is it binary SASS code, so one would still need a open source ptxas alternative?
Replacing ptxas is highly non trivial. I will attempt to do so, but it increasingly looks like ptxas is here to stay. I started working on a nvcc + cuda SDK replacement which already works surprisingly well for a day of work.
However, ptxas is in my sight. But I know this is something that to my knowledge nobody that wasn't fed Nvidia documentation under license has ever successfully accomplished.
You can still use their name where there is no likelihood of consumer confusion.
Obviously many companies choose not to to avoid a lawsuit over the issue - but it's unlikely NVidia would win over this method name.
Fun thing, the open source modules takes some proprietary things and moves them to the GSP firmware. Incidentally, the open source modules actually communicate with the GSP firmware using the RM API as well. This understanding may be correct, but now instead of some RM calls being handled in kernel space they are forwarded to the firmware and handled there.
Firsthand example, both SpaceX and Subaru have services called Starlink. Subaru Starlink was first, but SpaceX Starlink is more famous. I've been confused and I've seen others be confused by the two.