-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCN backend. #7
Comments
Great! I think what is missing at the moment is:
Once we had those two things, getting an accelerate-llvm-gcn backend up and running should be relatively easy. |
I've been doing some research and it doesn't look promising. llvm code that is generated seems to quite low level e.g. for drivers on linux (which means not portable, and means you need to mess around below the mesa stack), OpenCL takes another form of binary (possibly partly compatible). And the only other option I've found is to use HSA-runtime to upload the kernels, but HSA is designed for AMDs APUs so I'm not sure how useful that is either. The final option is to find some way to have LLVM spit out SPIR (OpenCLs bytecode) so that any OpenCL device can work. |
The low-level nature of LLVM is fine; that's all handled by I should probably mention that I expect to use no OpenCL at all. The HSA actually looks like a promising avenue. This example looks like it is showing how to launch the same "hello world" kernel as at the bottom of the LLVM AMDGPU documentation. That example is all wrapped in C++ (worryingly), but it looks like the actual I'd have to look closer at the other examples, and maybe a few others, but to me I think the next step is a Haskell FFI binding to the HSA Runtime API. |
Yeah I had found that repository, but most documentation I've found showed them targeting APUs this pages Title even states that it only supports Kaveri & Carrizo APUs. I'll try get something working on my Non-APU system, I guess that would be the best way to prove myself wrong. |
It might be worthwhile shooting an email to AMD / LLVM mailing list or opening a github issue on that repo asking for advice / clarification / pointer to the correct documentation explaining how to use the LLVM AMD target. I don't have a machine with an AMD card in it at the moment so I can't be much help trying things out, sorry. |
Possibly useful links: |
With MacOS (ROCm is Linux-only), I've been having problems getting If I compile an OpenCL kernel with Apple's own
I get a kernel which I can use with However,
Produces an error like this with
Looking at a hex dump of the two files, they seem quite similar: Apple:
AMDGCN:
So AFAICT, they appear to be "the same kind of thing". At least I'm not seeing two completely different set of magic numbers, etc. Does anyone know if I'm missing something here? Has anyone come across instructions for running AMDGCN-compiled code on a Mac? |
If you have an older version of LLVM available, it might be worth trying that? I know the NVIDIA tools are also based off of LLVM, but typically lag by a few releases. |
There's no cross-platform way to load GCN binaries other than OpenCL. (And no alternative of any kind on macOS!) That's not to say that it'd be generating OpenCL code, but it has to work with the API a little to load the object files. |
@typedrat thanks for the info! |
I got an AMD GPU again and I got curious about this bug. These have appeared: https://github.com/RadeonOpenCompute/clang-ocl/blob/master/clang-ocl.in This mentions no Windows support which leaves me out of options: ROCm/clang-ocl#4 |
There is some documentation on the AMD toolchain here. |
Unfortunately all of that is about the HSA stuff, which is the old name for ROCm, and is also Linux-only (and quite a pain to get working properly, from painful recent experience.) There's nothing to be done as it stands, AMD simply refuses to provide a workable target on other OSes.
|
@typedrat wow thanks for the insight! Well, I just bought a Radeon VII, so let's see what we can do. |
This is a bit beyond my expertise, but in case it helps, I thought I would drop a mention of https://github.com/google/clspv. This project apparently provides LLVM modules for targeting Vulkan compute shaders. I could be entirely wrong but this sounds like it could be the lynch pin of an accelerate-llvm-vulkan, with broad device support. Sorry if this isn't helpful. I don't know enough to know if not. |
@gozzarda oh nice find, thanks! |
If there's still any interest in something like this, time has done a lot of the work for us, since there is now ROCm support on Windows and Macs with discrete GPUs and x86 processors are pretty firmly deprecated. It's still a bit annoying to get ROCm working on Linux and the supported GPU list is a lot shorter than you'd really hope for it to be, but a ROCm-based backend is definitely becoming more feasible. I'll probably be working on a low-level library for GPU compute on AMD hardware with Haskell soon no matter what. |
Hey, I posted on the User group a few weeks back about AMD/OpenCL support, but this was suggested as an enhancement, I would love to attempt to get something working, could someone point me in the right direction on getting started?
The text was updated successfully, but these errors were encountered: