News for hackers. Stuff that matters.
Re:AMD May Get Across the CUDA Moat by nextaccountic on Friday October 06, 2023 @11:53PM (#37798875)
> CUDA is the only reason I have an Nvidia card, but if more projects start migrating to a more agnostic environment, I'll be really grateful.

What AMD really needs is to have 100% feature parity with CUDA without changing a single line of code. Maybe for this to happen it needs to add hardware features or something (I see people saying that CUDA as an API is very tailored to the capabilities of nvidia GPUs), I don't know.

If AMD relies on people changing their code to make it portable, it already lost.

Re:AMD May Get Across the CUDA Moat by javchz on Saturday October 07, 2023 @02:05AM (#37799378)
I think that could work too. I wonder if they could do a translation layer, something like Apple with the M1 chips that translates JIT x86 to ARM.
Re:AMD May Get Across the CUDA Moat by JonChesterfield on Saturday October 07, 2023 @06:38AM (#37800587)
That's a fun idea. Qemu parses a binary into something very like a compiler IR, optimises it a bit, then writes it out as a binary for the same or another target in JIT like fashion. So that sort of thing can be built. Apple's rosetta is functionally similar, I expect it does the same sort of thing under the hood. Valgrind is another from the same architecture.

It would be a painful reverse engineering process - the cuda file format is sort of like elf, but with undocumented bonus constraints, and you'd have to reverse the instruction encoding to get sass, which isn't documented, or try to take it directly to ptx which is somewhat documented, and then convert that onward.

It would be far more difficult than compiling cuda source directly. I'm not sure anyone would pay for a cuda->amdgpu conversion tool, and it's hard to imagine AMD making one as part of ROCm.

Re:AMD May Get Across the CUDA Moat by mrweasel on Saturday October 07, 2023 @02:30AM (#37799486)
> I see people saying that CUDA as an API is very tailored to the capabilities of nvidia GPUs

I'm wondering how true that is, because that could give NVidia issues in the future if they need to redesign their GPU should they hit some limit with the current designs. Dependence on certain instruction makes sense, but there's not technical preventing AMD from implementing those instructions, only legal mumbo jumbo.

Re:AMD May Get Across the CUDA Moat by mschuetz on Saturday October 07, 2023 @04:22AM (#37800002)
Not just feature parity, but proper UX. Things need to just work, without spending hours or days to make them work.
Re:AMD May Get Across the CUDA Moat by weebull on Saturday October 07, 2023 @07:43AM (#37800890)
Blame Nvidia. They are the ones the got the industry hooked on a proprietry API.
Re:AMD May Get Across the CUDA Moat by mschuetz on Sunday October 08, 2023 @06:52AM (#37809422)
Why would I blame NVIDIA? If it wasn't for them, we'd still only have needlessly cumbersome APIs and ecosystems. They did what Khronos always failed to do: They created something that is both easy, powerful and fast. Khronos always heavily neglects the easy part.
Re:AMD May Get Across the CUDA Moat by freilanzer on Monday October 09, 2023 @06:02AM (#37818751)
Blame them for being anti competitive and anti consumer.
Re:AMD May Get Across the CUDA Moat by mschuetz on Monday October 09, 2023 @10:42AM (#37820939)
How are they preventing the competition to create something better than CUDA? And how does it hurt the consumers that they are providing a fantastic product that others refuse to provide?
Re:AMD May Get Across the CUDA Moat by JonChesterfield on Saturday October 07, 2023 @06:19AM (#37800512)
The idea was supposed to be people convert cuda to hip, which is a pretty similar language, either by hand or by running a tool called 'hipify' that comes with rocm. You can then compile that unmodified for amdgpu or for nvptx.

I think where that idea goes wrong is in order to compile it unmodified for nvptx, you need to use a toolchain which knows hip and nvptx, which the cuda toolchain does not. Clang can mostly compile cuda successfully but it's far less polished than the cuda toolchain. ROCm probably has the nvptx backend disabled, and even if it's built in, best case it'll work as well as clang upstream does.

What I'm told does work is keeping all the source as cuda and using hipify as part of a build process when using amdgpu - something like `cat foo.cu | hipify | clang -x hip -` - though I can't personally vouch for that working.

The original idea was people would write in opencl instead of cuda but that really didn't work out.

Re:AMD May Get Across the CUDA Moat by pjmlp on Saturday October 07, 2023 @10:40AM (#37802095)
Both ideas are already lost before starting, Hip isn't polyglot as CUDA, and OpenCL is mostly stuck in C.