[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Adding PyTorch support with ROCm



Hi Xuanteng,

Thanks for working on this. I will upgrade the pytorch package to the latest version and make it compile on python 3.12. Will let you know when it is ready. It may take several weeks depending on my availability.

On 7/9/24 05:39, Xuanteng Huang wrote:
Hi developers,

As MIOpen gets pacakged (waiting for being accepted in NEW queue) [1], we have the required packages prepared to bring pytorch-rocm into Debian.

First of all, I’ve encountered a FTBFS error when I tried to compile the CPU version due to a deprecated CPython API _PyEval_RequestCodeExtraIndex [2] since CPython 3.12 in sid. If it can be reproduced, maybe we should add a compilation option to suppress this.

P.S. the command I used:

$ DEB_BUILD_OPTIONS="parallel=16" \
   sbuild --chroot-mode=unshare \
   --chroot=$HOME/.cache/sbuild/sid.standard.tgz \
   --dist unstable

After having some brief tours on the package, we may need the following generic steps to create ROCm variant Pytorch:

1. Imitate d/cudabuild.sh to create d/rocmbuild.sh
2. Update d/rules, and add the in-tree hipify process to replace all CUDA runtime API calls with ROCm ones [3] in either override_dh_auto_configure or override_dh_auto_install
2. Introduce extra building dependencies/patches (e.g., LoadHIP.cmake [4] and roctracer) for the ROCm variant
3. Try to build and then prepare .install, .docs tests and other decorating files

Please correct me if I’m wrong or something missed.

Best,
Xuanteng

[1]: https://ftp-master.debian.org/new/miopen_5.5.1+dfsg2-1.html
[2]: https://docs.python.org/3/c-api/code.html#c.PyUnstable_Eval_RequestCodeExtraIndex
[3]: https://github.com/pytorch/pytorch/blob/main/tools/amd_build/build_amd.py
[4]: https://github.com/pytorch/pytorch/pull/116277



Reply to: