-
Notifications
You must be signed in to change notification settings - Fork 18
add xpu build support #185
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
Conversation
Signed-off-by: Wang, Yi A <[email protected]>
I have only verified in local build |
Nice!!! 🎉 I will try to have a look today or Monday. |
@danieldk if we need to enable nix build. Do we need to add "xpu" support in https://github.com/huggingface/hf-nix, since we need torch with "xpu" support? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again, this is really great to have! Added one small comment.
Yes, indeed. Let me know if you need any help. If you want, I can also have a go at adding XPU support to the Torch Nix derivation. |
Signed-off-by: Wang, Yi A <[email protected]>
@danieldk should we wait for the support in hf-nix / torch nix ? |
yes. I try to enable torch xpu in hf-nix. but found some issues.
do you have some suggestion to solve it? Thanks very much |
Yeah, everything needs to be hashed and accessible in the build sandbox, otherwise the builds are not reproducible. We also need to be able to cache build artifacts to avoid that downstream users have to rebuild everything. I am not very familiar with oneAPI, but aren't Ubuntu/RHEL packages available without accepting an EULA? Not sure about the licensing terms though.
|
download key and add signed entry is needed download the key to system keyringwget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB add signed entry to apt sources and configure the APT client to use Intel repository:echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list |
But that's only required because APT will not install anything from a repository if it cannot verify the metadata GPG signatures. Importing the GPG keys does not require accepting the EULA. We should still check if the oneAPI EULA permits our use though -- Nix has to patch binaries (for fixing library paths, etc.), and we have to be able to provide outputs through our binary cache to avoid that users have to rebuild everything. |
maybe could I follow the guide https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html to installed it in nix? see section of "Install through a Command Line" must indicate "--eula accept" |
This is the benefit and constrains of the offline installation Considerations I see there's "allowUnfree = true" for cuda and rocm, so shall I implement it in the same way? |
Note though that If it is necessary to get every user who builds a kernel to accept the oneAPI EULA (since they are by extension downloading oneAPI), than marking oneAPI packages as unfree does not add anything, it's just metadata, but not metadata the user will ever see.
I think the best approach would be to automatically generate Nix derivations from RHEL/RPM packages and then overlay package-specific changes like we do for ROCm (and nixpkgs does for CUDA): https://github.com/huggingface/hf-nix/blob/main/pkgs/rocm-packages/default.nix Using a single installer/tarball makes build times really large and does not compose well. It makes it hard to do fixes on top, whereas with the package-based approach, we can easily layer package-specific extensions: https://github.com/huggingface/hf-nix/blob/main/pkgs/rocm-packages/overrides.nix Most likely there needs to be some compiler/stdenv wrapping, etc., which is much easier with separate packages/derivations. It also avoids that the dependency closures become dependent on all of oneAPI, which will probably be unnecessarily large (for ROCm/CUDA we only end up with a small subset of the toolkits). |
Thinking more about it, I am not sure who should accept the EULA. Us as a party that would redistribute oneAPI through our binary cache? Or kernel developers that use If it is the kernel developer who should accept it, we could consider adding an attribute to |
Also make code match CUDA/Metal more closely.
Merged this PR, many thanks for adding XPU support to build2cmake. 🎉 |
Thanks for all the suggestion, I will have a try if I could automatically generate Nix derivations from RHEL/RPM packages and then overlay package-specific changes like what you have done for ROCm. |
@danieldk how about adding xpu support? I also add example of relu.