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

PyO3: Add mkl support #1159

Merged
merged 2 commits into from
Oct 23, 2023
Merged

Conversation

LLukas22
Copy link
Contributor

Alright this should add mkl support. I also created a quick benchmark script to only test the matmul performance between torch and candle: https://gist.github.com/LLukas22/b58adc148e771afdeaebc4074f0644f7

Results without --features mkl:

PyTorch: 10.230922899999769
Candle: 3.1102483999998185

With --features mkl:

PyTorch: 10.196486699999696
Candle: 4.144704999999703

I'm running this on an AMD Ryzen 7 3700x, ans seeing these results i guess Sarah did a pretty good job optimizing the gemm create.

I also re-ran the embedding "benchmark" and candle still is a bit slower there, but faster than without mkl. I'm guessing we lose some speed in other operations than matmul or trough the python wrapper.

With mkl:

mkl

Without mkl:

no_mkl

That being said i'm probably gonna re-run these tests tomorrow on an intel based system and see if that changes anything.

@LaurentMazare
Copy link
Collaborator

Merged, thanks! Might be worth doing the same for accelerate on macos platforms too at some point.

@LaurentMazare LaurentMazare merged commit eae94a4 into huggingface:main Oct 23, 2023
11 of 13 checks passed
EricLBuehler pushed a commit to EricLBuehler/candle that referenced this pull request Oct 25, 2023
* Add `mkl` support

* Set `mkl` path on linux
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.

2 participants