Skip to content
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

Implement basic CLBlast support #110

Merged
merged 5 commits into from Jul 21, 2023
Merged

Implement basic CLBlast support #110

merged 5 commits into from Jul 21, 2023

Conversation

LoganDark
Copy link
Contributor

@LoganDark LoganDark commented Jul 3, 2023

Most of the work was getting CMake to find it. Just enable RWKV_CLBLAST and then drop the OpenCL & CLBlast distributions into the repository root like so:

image

the actual folders after unzipping, of course!!

image

Marked as draft due to lack of testing—I unfortunately lost my bespoke chat script at some point and so can't really do my own experimentation immediately, but I do want to put this out there and have it available for others to see and test out for themselves.

Performance seems to be almost exactly on-par with CUDA in my experience. So maybe this will be getting CUDA-like performance out of Intel and AMD GPUs - exciting :D

It took me about 2 hours and 30 minutes of real time to complete this pull request :)

Unzip the OpenCL SDK and CLBlast distribution into the repo root,
then enable RWKV_CLBLAST and regenerate makefiles to pick them up.

Currently builds and runs.
Somehow the path handling is different here which requires me to
be quite a bit more annoying about it.
@LoganDark
Copy link
Contributor Author

Hey @saharNooby macos is failing again for another reason that isn't my fault, I'm starting to think github is just cursed

@saharNooby
Copy link
Collaborator

Finally I realized how to push into PRs... It turns out I was trying to push into your master, which obviously should not work. Pushing into clblast works.

I'll try various hacks here to get it MacOS build.

@LoganDark
Copy link
Contributor Author

Well, that seems to have fixed it.

I think the biggest problem we have right now is that we don't seem to be able to test these libraries on CI or offer them in GitHub releases. We should probably try to do something about that.

@saharNooby
Copy link
Collaborator

we don't seem to be able to test these libraries on CI or offer them in GitHub releases. We should probably try to do something about that.

I'm not sure I understand. You talking about cuBLAS and CLBlast?

@saharNooby
Copy link
Collaborator

OMG LOL IT FIXED THAT ISSUE FOR WHICH SANITIZER WAS ENABLED

@LoganDark
Copy link
Contributor Author

LoganDark commented Jul 5, 2023

we don't seem to be able to test these libraries on CI or offer them in GitHub releases. We should probably try to do something about that.

I'm not sure I understand. You talking about cuBLAS and CLBlast?

Yes, currently people can't get prebuilt binaries for either of those features, and they aren't tested in CI.

OMG LOL IT FIXED THAT ISSUE FOR WHICH SANITIZER WAS ENABLED

LOL

@saharNooby
Copy link
Collaborator

llama.cpp builds and provides binaries for cuBLAS and CLBLast: releases, build file

I'll add it into my backlog, seems easy enough to do.

@saharNooby
Copy link
Collaborator

I would really prefer to have CLBlast build documented. PR desc looks good enough, maybe format it a little and put it into docs/CLBlast_on_Windows.md. It would be similar to docs/cuBLAS_on_Windows.md.

But I will not block this PR because of this, I can write the doc later myself.

@LoganDark
Copy link
Contributor Author

LoganDark commented Jul 5, 2023

The PR's currently blocked anyway because I have only tested the small world models with the little sequence.c and confirmed the logits output is identical, but I have not tested any other models (in particular the larger raven models) and that probably needs to work before we merge this. I have no reason to believe that it doesn't but need to make sure

xXxPainTrainxXx added a commit to C2C-Solutions/rwkv.cpp that referenced this pull request Jul 18, 2023
Used code for CLBlast from PR RWKV#110
@LoganDark
Copy link
Contributor Author

@Mathmagician8191 has done some testing with this i think and i'm not really capable of writing documentation on this right now (on account of dissociative identity disorder hehe) but the code seems functional at least

@LoganDark LoganDark marked this pull request as ready for review July 20, 2023 21:05
@saharNooby saharNooby merged commit 84f34c5 into RWKV:master Jul 21, 2023
24 checks passed
@LoganDark LoganDark deleted the clblast branch July 21, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants