Fix sparse windows on CPU with MKL#102604
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/102604
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 4156083 with merge base 6049998 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
06a2d02 to
987b456
Compare
4eb772e to
b387cd9
Compare
3769714 to
097ea78
Compare
f22be71 to
fc8b4da
Compare
85b363a to
aaf3d35
Compare
b2a7af2 to
b72a468
Compare
8e5d591 to
1139d36
Compare
1139d36 to
814df50
Compare
IvanYashchuk
left a comment
There was a problem hiding this comment.
Changes to the aten/ directory look good. Exciting update!
|
cc @amjames for visibility |
amjames
left a comment
There was a problem hiding this comment.
Mainly asking for clarification on a couple of things.
setup.py
Outdated
| "fsspec", | ||
| ] | ||
| if IS_WINDOWS: | ||
| install_requires.append("mkl==2021.4.0") |
There was a problem hiding this comment.
Is an an exact pin needed here? I don't see why can't it be 2021.4.0 or later?
There was a problem hiding this comment.
MKL has the version in its name. Since we still link with the static version of the dlls it will search for dlls with 1 in their name. So if we install MKL 2023.1.0 it will have those libraries but we 2 in their names and it will fail to load. So based on my tests the only thing compatible MKL versions are 2021.1.1-2021.4.0.
There was a problem hiding this comment.
Thanks, I figured you had a good reason here.
|
@malfet - Does this work for you? |
|
@cpuhrsch Change can not go as is as it depends on builder change that hasn't merged yet. |
malfet
left a comment
There was a problem hiding this comment.
Please make suggested changes (and rebase your builder PR first, but looks ok to me)
| !{{ set_runner_specific_vars() }} | ||
| !{{ common.checkout(deep_clone=False, directory="pytorch") }} | ||
| !{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch) }} | ||
| !{{ common.checkout(deep_clone=False, directory="builder", repository="mantaionut/builder", branch="copy_mkl_windows") }} |
There was a problem hiding this comment.
This needs to be updated when builder PR is merged
| ] | ||
| if IS_WINDOWS: | ||
| install_requires.append("mkl>=2021.1.1,<=2021.4.0") |
There was a problem hiding this comment.
Hmm, why build windows with MKL-2021.x, while Linux is build with MKL-2022?
Also, in order to place nice with poetry, one needs to add it unconditionally but add arch + platform constraint
| ] | |
| if IS_WINDOWS: | |
| install_requires.append("mkl>=2021.1.1,<=2021.4.0") | |
| "mkl>=2021.1.1,<=2021.4.0; platform_system == \"Windows\" and platform_machine == \"x86_64\"", | |
| ] |
There was a problem hiding this comment.
I was thinking first to have this implementation since previously we were using MKL 2020. See if everything works well and then in the future will be easier to just change the version to 2022.
There was a problem hiding this comment.
@mantaionut do you still want to update it to 2022? Also, are you sure that we are not double packing mkl into the wheel, but keeping dependency at the same time?
There was a problem hiding this comment.
@malfet the binaries of mkl are not copied in the wheel, only in libtorch they are copied. I created a draft PR #118200 for updating to 2022. However I see for conda it might not be possible since numpy 1.19 -> mkl[version='>=2019.4,<2021.0a0|>=2021.4.0,<2022.0a0|>=2023.1.0,<2024.0a0'].
So based on this we could update to 2022 however on conda we should use 2023 instead. Let me know if you think this will work for you.
|
@mantaionut @malfet - Do we still want to move forward with this? |
I would like to move forward. But it also depends on pytorch/builder#1467 for which i had to make additional changes after rebasing. |
Merged builder PR, please remove temporary changes from this PR and merge it |
Added support for intel Sparse on Windows
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Fix #97352.
This PR changes the way the linking to intel MKL is done and updating MKL on Windows to mkl-2021.4.0 .
There are for both conda and pip packages MKL version with which you can link dynamically. mkl-devel contains the static versions of the dlls and MKL contains the needed dlls for the runtime. MKL dlls and static libs starting with 2021.4.0 have the version in their names( for MKL 2023 we have mkl_core.2.dll and for 2021.4.0 we have mkl_core.1.dll) so its possible to have multiple versions installed and it will work properly.
For the wheel build, I added dependency for whell MKL and on conda a dependecy for the conda MKL and on libtorch I copied the MKL binaries in libtorch.
In order to test this PR I have to use custom builder pytorch/builder#1467
cc @alexsamardzic @nikitaved @pearu @cpuhrsch @amjames @bhosmer @jcaip @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite